diff --git a/src/api/ai/chat/message/index.ts b/src/api/ai/chat/message/index.ts index 802061af..0547ab1b 100644 --- a/src/api/ai/chat/message/index.ts +++ b/src/api/ai/chat/message/index.ts @@ -39,6 +39,7 @@ export const ChatMessageApi = { conversationId: number, content: string, ctrl, + enableContext: boolean, onMessage, onError, onClose @@ -53,7 +54,8 @@ export const ChatMessageApi = { openWhenHidden: true, body: JSON.stringify({ conversationId, - content + content, + useContext: enableContext, }), onmessage: onMessage, onerror: onError, diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index 67f77d94..999e1736 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -54,7 +54,9 @@ placeholder="问我任何问题...(Shift+Enter 换行,按下 Enter 发送)" >
- +
+ 上下文 +
() // 对话进行中 abort 控制 const inputTimeout = ref() // 处理输入中回车的定时器 const prompt = ref() // prompt const userInfo = ref() // 用户信息 +const enableContext = ref(true) // 是否开启上下文 const fullText = ref(''); const displayedText = ref(''); @@ -327,6 +330,7 @@ const doSendStream = async (userMessage: ChatMessageVO) => { userMessage.conversationId, // TODO 芋艿:这里可能要在优化; userMessage.content, conversationInAbortController.value, + enableContext.value, async (message) => { const data = JSON.parse(message.data) // TODO 芋艿:类型处理; // 如果内容为空,就不处理。