Explorar o código

Merge pull request #5645 from kivvi3412/main

[feat] Set whether to stream individually for the model
Timothy Jaeryang Baek hai 7 meses
pai
achega
9a81a37008

+ 2 - 2
src/lib/components/chat/Chat.svelte

@@ -952,7 +952,7 @@
 
 		await tick();
 
-		const stream = $settings?.streamResponse ?? true;
+		const stream = model?.info?.params?.stream_response ?? $settings?.streamResponse ?? true;
 		const [res, controller] = await generateChatCompletion(localStorage.token, {
 			stream: stream,
 			model: model.id,
@@ -1248,7 +1248,7 @@
 		await tick();
 
 		try {
-			const stream = $settings?.streamResponse ?? true;
+			const stream = model?.info?.params?.stream_response ?? $settings?.streamResponse ?? true;
 			const [res, controller] = await generateOpenAIChatCompletion(
 				localStorage.token,
 				{

+ 25 - 0
src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte

@@ -10,6 +10,7 @@
 
 	export let params = {
 		// Advanced
+		stream_response: null,	// Set stream responses for this model individually
 		seed: null,
 		stop: null,
 		temperature: null,
@@ -42,6 +43,30 @@
 </script>
 
 <div class=" space-y-1 text-xs pb-safe-bottom">
+	<div>
+		<div class=" py-0.5 flex w-full justify-between">
+			<div class=" self-center text-xs">
+				{$i18n.t('Stream Chat Response')}
+			</div>
+
+			<button
+				class="p-1 px-3 text-xs flex rounded transition"
+				on:click={() => {
+				params.stream_response = (params?.stream_response ?? null) === null ? true : (params.stream_response ? false : null);
+			}}
+				type="button"
+			>
+				{#if params.stream_response === true}
+					<span class="ml-2 self-center">{$i18n.t('On')}</span>
+				{:else if params.stream_response === false}
+					<span class="ml-2 self-center">{$i18n.t('Off')}</span>
+				{:else}
+					<span class="ml-2 self-center">{$i18n.t('Default')}</span>
+				{/if}
+			</button>
+		</div>
+	</div>
+
 	<div class=" py-0.5 w-full justify-between">
 		<div class="flex w-full justify-between">
 			<div class=" self-center text-xs font-medium">{$i18n.t('Seed')}</div>

+ 1 - 1
src/lib/i18n/locales/zh-CN/translation.json

@@ -614,7 +614,7 @@
 	"Sign up": "注册",
 	"Signing in": "正在登录",
 	"Source": "来源",
-	"Speech Playback Speed": "",
+	"Speech Playback Speed": "语音播放速度",
 	"Speech recognition error: {{error}}": "语音识别错误:{{error}}",
 	"Speech-to-Text Engine": "语音转文本引擎",
 	"Stop Sequence": "停止序列 (Stop Sequence)",

+ 1 - 1
src/lib/i18n/locales/zh-TW/translation.json

@@ -615,7 +615,7 @@
 	"Sign up": "註冊",
 	"Signing in": "正在登入",
 	"Source": "來源",
-	"Speech Playback Speed": "",
+	"Speech Playback Speed": "語音播放速度",
 	"Speech recognition error: {{error}}": "語音辨識錯誤:{{error}}",
 	"Speech-to-Text Engine": "語音轉文字 (STT) 引擎",
 	"Stop Sequence": "停止序列",