From 066a237770bd4cb6ca5ad8096b0772b16e82f32d Mon Sep 17 00:00:00 2001 From: Zhang Minghan Date: Fri, 6 Oct 2023 17:01:49 +0800 Subject: [PATCH] fix conversation context error thanks @sipc --- app/src/conf.ts | 2 +- app/src/conversation/conversation.ts | 14 ++++++++++++++ app/src/conversation/manager.ts | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/src/conf.ts b/app/src/conf.ts index 1fd5d31..7ed4881 100644 --- a/app/src/conf.ts +++ b/app/src/conf.ts @@ -1,6 +1,6 @@ import axios from "axios"; -export const version = "3.3.0"; +export const version = "3.3.1"; export const deploy: boolean = true; export let rest_api: string = "http://localhost:8094"; export let ws_api: string = "ws://localhost:8094"; diff --git a/app/src/conversation/conversation.ts b/app/src/conversation/conversation.ts index 1a28864..5e2e8a1 100644 --- a/app/src/conversation/conversation.ts +++ b/app/src/conversation/conversation.ts @@ -129,4 +129,18 @@ export class Conversation { return true; } + + public sendMessageWithRaise(t: any, id: number, props: ChatProps): boolean { + if (!this.end) return false; + + this.addMessage({ + content: props.message, + role: "user", + }); + + this.send(t, props); + this.setId(id); + + return true; + } } diff --git a/app/src/conversation/manager.ts b/app/src/conversation/manager.ts index 4f6ea07..073b797 100644 --- a/app/src/conversation/manager.ts +++ b/app/src/conversation/manager.ts @@ -98,7 +98,7 @@ export class Manager { delete this.conversations[-1]; // fix pointer this.conversations[-1] = this.createConversation(-1); this.current = target; - return this.get(target)!.sendMessage(t, props); + return this.get(target)!.sendMessageWithRaise(t, target, props); } const conversation = this.get(id); if (!conversation) return false;