fix(core): always update session prompt before chat (#10483)

Why make this fix?
The network search flag is saved locally. If the user opens multiple clients, the local status and server status may be inconsistent.
This commit is contained in:
akumatus
2025-02-27 09:44:19 +00:00
parent fc4a716ef1
commit 1bb5dd0eda
2 changed files with 6 additions and 16 deletions

View File

@@ -203,8 +203,6 @@ export class ChatPanelInput extends SignalWatcher(WithDisposable(LitElement)) {
@property({ attribute: false })
accessor networkSearchConfig!: AINetworkSearchConfig;
private _lastPromptName: string | null = null;
private get _isNetworkActive() {
return (
!!this.networkSearchConfig.visible.value &&
@@ -230,12 +228,9 @@ export class ChatPanelInput extends SignalWatcher(WithDisposable(LitElement)) {
}
private async _updatePromptName(promptName: string) {
if (this._lastPromptName !== promptName) {
const sessionId = await this.getSessionId();
if (sessionId && AIProvider.session) {
await AIProvider.session.updateSession(sessionId, promptName);
this._lastPromptName = promptName;
}
const sessionId = await this.getSessionId();
if (sessionId && AIProvider.session) {
await AIProvider.session.updateSession(sessionId, promptName);
}
}

View File

@@ -239,8 +239,6 @@ export class ChatBlockInput extends SignalWatcher(LitElement) {
@state()
accessor _focused = false;
private _lastPromptName: string | null = null;
private get _isNetworkActive() {
return (
!!this.networkSearchConfig.visible.value &&
@@ -262,12 +260,9 @@ export class ChatBlockInput extends SignalWatcher(LitElement) {
}
private async _updatePromptName(promptName: string) {
if (this._lastPromptName !== promptName) {
const { currentSessionId } = this.chatContext;
if (currentSessionId && AIProvider.session) {
await AIProvider.session.updateSession(currentSessionId, promptName);
this._lastPromptName = promptName;
}
const { currentSessionId } = this.chatContext;
if (currentSessionId && AIProvider.session) {
await AIProvider.session.updateSession(currentSessionId, promptName);
}
}