fix conversation context error

thanks @sipc
This commit is contained in:
Zhang Minghan 2023-10-06 17:01:49 +08:00
parent af91621800
commit 066a237770
3 changed files with 16 additions and 2 deletions

View File

@ -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";

View File

@ -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;
}
}

View File

@ -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;