diff --git a/frontend/src/_locales/ja/main.json b/frontend/src/_locales/ja/main.json index 549cf39..f57494d 100644 --- a/frontend/src/_locales/ja/main.json +++ b/frontend/src/_locales/ja/main.json @@ -338,5 +338,8 @@ "If you don't know what it is, keep it default.": "何であるかわからない場合はデフォルトのままにしてください。", "Failed to find the base model, please try to change your base model.": "ベースモデルが見つかりませんでした、ベースモデルを変更してみてください。", "Markdown Renderer": "Markdownレンダリング", - "Load Conversation": "会話を読み込む" + "Load Conversation": "会話を読み込む", + "The latest X messages will be sent to the server. If you are using the RWKV-Runner server, please use the default value because RWKV-Runner has built-in state cache management which only calculates increments. Sending all messages will have lower cost. If you are using ChatGPT, adjust this value according to your needs to reduce ChatGPT expenses.": "最新のX件のメッセージがサーバーに送信されます。RWKV-Runnerサーバーを使用している場合は、デフォルト値を使用してください。RWKV-Runnerには組み込みの状態キャッシュ管理があり、増分のみを計算します。すべてのメッセージを送信すると、コストが低くなります。ChatGPTを使用している場合は、ChatGPTの費用を削減するために必要に応じてこの値を調整してください。", + "History Message Number": "履歴メッセージ数", + "Send All Message": "すべてのメッセージを送信" } \ No newline at end of file diff --git a/frontend/src/_locales/zh-hans/main.json b/frontend/src/_locales/zh-hans/main.json index fc5a6eb..0008e2a 100644 --- a/frontend/src/_locales/zh-hans/main.json +++ b/frontend/src/_locales/zh-hans/main.json @@ -338,5 +338,8 @@ "If you don't know what it is, keep it default.": "如果你不知道这是什么,保持默认", "Failed to find the base model, please try to change your base model.": "未找到基底模型,请尝试更换基底模型", "Markdown Renderer": "Markdown渲染", - "Load Conversation": "读取对话" + "Load Conversation": "读取对话", + "The latest X messages will be sent to the server. If you are using the RWKV-Runner server, please use the default value because RWKV-Runner has built-in state cache management which only calculates increments. Sending all messages will have lower cost. If you are using ChatGPT, adjust this value according to your needs to reduce ChatGPT expenses.": "最近的X条消息会发送至服务器. 如果你正在使用RWKV-Runner服务器, 请使用默认值, 因为RWKV-Runner内置了state缓存管理, 只计算增量, 发送所有消息将具有更低的成本. 如果你正在使用ChatGPT, 则根据你的需要调整此值, 这可以降低ChatGPT的费用", + "History Message Number": "历史消息数量", + "Send All Message": "发送所有消息" } \ No newline at end of file diff --git a/frontend/src/pages/Chat.tsx b/frontend/src/pages/Chat.tsx index 68bf8dd..3cf8e13 100644 --- a/frontend/src/pages/Chat.tsx +++ b/frontend/src/pages/Chat.tsx @@ -231,7 +231,7 @@ const SidePanel: FC = observer(() => { onClick={() => commonStore.setSidePanelCollapsed(true)} /> -
+
{ }); }} /> } /> + { + commonStore.setChatParams({ + historyN: data.value + }); + }} /> + } />
{ Authorization: `Bearer ${commonStore.settings.apiKey}` }, body: JSON.stringify({ - messages, + messages: messages.slice(-commonStore.chatParams.historyN), stream: true, model: commonStore.settings.apiChatModelName, // 'gpt-3.5-turbo' temperature: commonStore.chatParams.temperature, @@ -594,7 +607,7 @@ const ChatPanel: FC = observer(() => { style={{ zIndex: 1 }} icon={commonStore.sidePanelCollapsed ? : } onClick={() => commonStore.setSidePanelCollapsed(!commonStore.sidePanelCollapsed)} /> -
+
{commonStore.conversationOrder.map(uuid => )} diff --git a/frontend/src/stores/commonStore.ts b/frontend/src/stores/commonStore.ts index 4110c4d..a6d973b 100644 --- a/frontend/src/stores/commonStore.ts +++ b/frontend/src/stores/commonStore.ts @@ -3,7 +3,12 @@ import { getUserLanguage, isSystemLightMode, saveCache, saveConfigs, savePresets import { WindowSetDarkTheme, WindowSetLightTheme } from '../../wailsjs/runtime'; import manifest from '../../../manifest.json'; import i18n from 'i18next'; -import { defaultCompositionPrompt, defaultModelConfigs, defaultModelConfigsMac } from '../pages/defaultConfigs'; +import { + defaultCompositionPrompt, + defaultModelConfigs, + defaultModelConfigsMac, + defaultPenaltyDecay +} from '../pages/defaultConfigs'; import { ChartData } from 'chart.js'; import { Preset } from '../types/presets'; import { AboutContent } from '../types/about'; @@ -80,7 +85,8 @@ class CommonStore { topP: 0.3, presencePenalty: 0, frequencyPenalty: 1, - penaltyDecay: 0.996, + penaltyDecay: defaultPenaltyDecay, + historyN: 0, markdown: true }; sidePanelCollapsed: boolean | 'auto' = 'auto'; diff --git a/frontend/src/types/chat.ts b/frontend/src/types/chat.ts index e2fdb53..74e211b 100644 --- a/frontend/src/types/chat.ts +++ b/frontend/src/types/chat.ts @@ -35,5 +35,6 @@ export type Attachment = { content: string; } export type ChatParams = Omit & { - markdown: boolean + historyN: number; + markdown: boolean; } \ No newline at end of file