瀏覽代碼

优化还想问接口

S0025136190 6 月之前
父節點
當前提交
b70586c755
共有 3 個文件被更改,包括 9 次插入1 次删除
  1. 5 0
      app/client/platforms/bigModel.ts
  2. 2 1
      app/components/chat.tsx
  3. 2 0
      app/store/chat.ts

+ 5 - 0
app/client/platforms/bigModel.ts

@@ -51,6 +51,7 @@ export class BigModelApi implements LLMApi {
     const params = {
       appId: options.config.appId,// 应用id
       prompt: userMessages,
+      chat_id: options.config.chat_id,
       // 进阶配置
       request_id: 'jkec2024-knowledge-base',
       returnType: undefined,
@@ -152,6 +153,10 @@ export class BigModelApi implements LLMApi {
           if (info.event === 'finish') {
             const chatMode = useChatStore.getState().chatMode;
             if (chatMode === 'LOCAL') {// 切片
+              useChatStore.getState().updateCurrentSession((se) => {
+                console.log('update chat_id', info.id);
+                se.chat_id = info.id;
+              });
               sliceInfoPromise = (async () => {
                 try {
                   const res: any = await api.get(`deepseek/api/slice/search/${info.id}`);

+ 2 - 1
app/components/chat.tsx

@@ -626,7 +626,8 @@ export function ChatActions(props: {
             content: record.content,
             role: record.role,
           }
-        ]
+        ],
+        chat_id: session.chat_id,
       }
       let url = '';
       if (chatStore.chatMode === 'LOCAL') {

+ 2 - 0
app/store/chat.ts

@@ -65,6 +65,7 @@ export interface ChatSession {
   appId: string,
   id: string;
   topic: string;
+  chat_id: string;
 
   memoryPrompt: string;
   messages: ChatMessage[];
@@ -86,6 +87,7 @@ function createEmptySession(): ChatSession {
   return {
     appId: '',
     id: nanoid(),
+    chat_id: '',
     topic: DEFAULT_TOPIC,
     memoryPrompt: "",
     messages: [],