From 73285d9d079110cacaac9676afc225b7d6ecda39 Mon Sep 17 00:00:00 2001 From: balibabu <cike8899@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:45:14 +0800 Subject: [PATCH] feat: add quote item to PromptEngine (#338) ### What problem does this PR solve? Show original text source in conversation messages Issue link: #337 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/locales/en.ts | 2 ++ web/src/locales/zh-traditional.ts | 2 ++ web/src/locales/zh.ts | 2 ++ .../chat/chat-configuration-modal/prompt-engine.tsx | 9 +++++++++ web/src/pages/chat/index.tsx | 4 ++-- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 1dccda9..430250b 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -333,6 +333,8 @@ export default { maxTokensMessage: 'Max Tokens is required', maxTokensTip: 'This sets the maximum length of the model’s output, measured in the number of tokens (words or pieces of words).', + quote: 'Show Quote', + quoteTip: 'Should the source of the original text be displayed?', }, setting: { profile: 'Profile', diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index b2a3e72..b6af198 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -308,6 +308,8 @@ export default { maxTokensMessage: '最大token數ćŻĺż…ĺˇ«é …', maxTokensTip: '這č¨ç˝®äş†ć¨ˇĺž‹čĽ¸ĺ‡şçš„最大長度,以標č¨ďĽĺ–®č©žć–單詞片段)的數量來衡量。', + quote: '顯示引文', + quoteTip: 'ćŻĺ¦ć‡‰č©˛éˇŻç¤şĺŽźć–‡ĺ‡şč™•ďĽź', }, setting: { profile: '概述', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 0b2a86e..e2bbd04 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -324,6 +324,8 @@ export default { maxTokensMessage: '最大tokenć•°ćŻĺż…填项', maxTokensTip: 'čż™č®ľç˝®äş†ć¨ˇĺž‹čľ“ĺ‡şçš„ćś€ĺ¤§é•żĺş¦ďĽŚä»Ąć ‡č®°ďĽĺŤ•čŻŤć–单词片段)的数量来衡量。', + quote: 'ćľç¤şĺĽ•ć–‡', + quoteTip: 'ćŻĺ¦ĺş”该ćľç¤şĺŽźć–‡ĺ‡şĺ¤„?', }, setting: { profile: '概č¦', diff --git a/web/src/pages/chat/chat-configuration-modal/prompt-engine.tsx b/web/src/pages/chat/chat-configuration-modal/prompt-engine.tsx index 1e49bc9..43d8c53 100644 --- a/web/src/pages/chat/chat-configuration-modal/prompt-engine.tsx +++ b/web/src/pages/chat/chat-configuration-modal/prompt-engine.tsx @@ -172,6 +172,15 @@ const PromptEngine = ( > <Slider max={30} /> </Form.Item> + <Form.Item + label={t('quote')} + valuePropName="checked" + name={['prompt_config', 'quote']} + tooltip={t('quoteTip')} + initialValue={true} + > + <Switch /> + </Form.Item> <section className={classNames(styles.variableContainer)}> <Row align={'middle'} justify="end"> <Col span={7} className={styles.variableAlign}> diff --git a/web/src/pages/chat/index.tsx b/web/src/pages/chat/index.tsx index e18d30c..38f826c 100644 --- a/web/src/pages/chat/index.tsx +++ b/web/src/pages/chat/index.tsx @@ -177,7 +177,7 @@ const Chat = () => { label: ( <Space> <EditOutlined /> - Edit + {t('rename', { keyPrefix: 'common' })} </Space> ), }, @@ -188,7 +188,7 @@ const Chat = () => { label: ( <Space> <DeleteOutlined /> - Delete chat + {t('delete', { keyPrefix: 'common' })} </Space> ), }, -- GitLab