From fcfaa5944e66a3982827bf44323fcee680aa5b03 Mon Sep 17 00:00:00 2001 From: josc146 Date: Sat, 16 Sep 2023 13:02:06 +0800 Subject: [PATCH] frontend feature adaptation for api params (user_name, assistant_name, presystem) --- frontend/src/_locales/ja/main.json | 5 ++- frontend/src/_locales/zh-hans/main.json | 5 ++- frontend/src/pages/Chat.tsx | 5 ++- .../pages/PresetsManager/PresetsButton.tsx | 34 +++++++++++++++++-- 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/frontend/src/_locales/ja/main.json b/frontend/src/_locales/ja/main.json index 85d024c..c8b9a10 100644 --- a/frontend/src/_locales/ja/main.json +++ b/frontend/src/_locales/ja/main.json @@ -250,5 +250,8 @@ "VRAM": "VRAM", "GPU Usage": "GPU使用率", "Use Custom Tokenizer": "カスタムトークナイザーを使用する", - "Tokenizer Path (e.g. backend-python/rwkv_pip/20B_tokenizer.json)": "トークナイザーパス (例: backend-python/rwkv_pip/20B_tokenizer.json)" + "Tokenizer Path (e.g. backend-python/rwkv_pip/20B_tokenizer.json)": "トークナイザーパス (例: backend-python/rwkv_pip/20B_tokenizer.json)", + "User Name": "ユーザー名", + "Assistant Name": "アシスタント名", + "Insert default system prompt at the beginning": "最初にデフォルトのシステムプロンプトを挿入" } \ 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 7b4bf58..9f5e094 100644 --- a/frontend/src/_locales/zh-hans/main.json +++ b/frontend/src/_locales/zh-hans/main.json @@ -250,5 +250,8 @@ "VRAM": "显存", "GPU Usage": "GPU占用", "Use Custom Tokenizer": "使用自定义Tokenizer", - "Tokenizer Path (e.g. backend-python/rwkv_pip/20B_tokenizer.json)": "Tokenizer路径 (例如: backend-python/rwkv_pip/20B_tokenizer.json)" + "Tokenizer Path (e.g. backend-python/rwkv_pip/20B_tokenizer.json)": "Tokenizer路径 (例如: backend-python/rwkv_pip/20B_tokenizer.json)", + "User Name": "用户名称", + "Assistant Name": "AI名称", + "Insert default system prompt at the beginning": "在开头自动插入默认系统提示" } \ No newline at end of file diff --git a/frontend/src/pages/Chat.tsx b/frontend/src/pages/Chat.tsx index 057dff7..6cbf435 100644 --- a/frontend/src/pages/Chat.tsx +++ b/frontend/src/pages/Chat.tsx @@ -312,7 +312,10 @@ const ChatPanel: FC = observer(() => { stream: true, model: commonStore.settings.apiChatModelName, // 'gpt-3.5-turbo' temperature: apiParams.temperature, - top_p: apiParams.topP + top_p: apiParams.topP, + user_name: commonStore.activePreset?.userName, + assistant_name: commonStore.activePreset?.assistantName, + presystem: commonStore.activePreset?.presystem }), signal: chatSseController?.signal, onmessage(e) { diff --git a/frontend/src/pages/PresetsManager/PresetsButton.tsx b/frontend/src/pages/PresetsManager/PresetsButton.tsx index 642a956..298c99d 100644 --- a/frontend/src/pages/PresetsManager/PresetsButton.tsx +++ b/frontend/src/pages/PresetsManager/PresetsButton.tsx @@ -56,6 +56,9 @@ export type Preset = { stop: string, injectStart: string, injectEnd: string, + presystem?: boolean, + userName?: string, + assistantName?: string } export const defaultPreset: Preset = { @@ -255,9 +258,36 @@ export const ChatPresetEditor: FC<{ } /> { editingMessages ? - : +
+ { + setEditingPreset({ + presystem: data.checked + }); + }} /> + } /> + { + setEditingPreset({ + userName: data.value + }); + }} /> + } /> + { + setEditingPreset({ + assistantName: data.value + }); + }} /> + } /> + +
:
- { setEditingPreset({