fix(core): after clearing the history, new chat will report an error (#11549)
Close [BS-3025](https://linear.app/affine-design/issue/BS-3025)
This commit is contained in:
@@ -408,7 +408,6 @@ export class ChatPanel extends SignalWatcher(
|
|||||||
.doc=${this.doc}
|
.doc=${this.doc}
|
||||||
.getSessionId=${this._getSessionId}
|
.getSessionId=${this._getSessionId}
|
||||||
.createSessionId=${this._createSessionId}
|
.createSessionId=${this._createSessionId}
|
||||||
.createChatSessionId=${this._createSessionId}
|
|
||||||
.chatContextValue=${this.chatContextValue}
|
.chatContextValue=${this.chatContextValue}
|
||||||
.updateContext=${this.updateContext}
|
.updateContext=${this.updateContext}
|
||||||
.updateEmbeddingProgress=${this._updateEmbeddingProgress}
|
.updateEmbeddingProgress=${this._updateEmbeddingProgress}
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ export class AIChatComposer extends SignalWatcher(
|
|||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor createSessionId!: () => Promise<string | undefined>;
|
accessor createSessionId!: () => Promise<string | undefined>;
|
||||||
|
|
||||||
@property({ attribute: false })
|
|
||||||
accessor createChatSessionId!: () => Promise<string | undefined>;
|
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor chatContextValue!: AIChatInputContext;
|
accessor chatContextValue!: AIChatInputContext;
|
||||||
|
|
||||||
@@ -123,7 +120,7 @@ export class AIChatComposer extends SignalWatcher(
|
|||||||
.host=${this.host}
|
.host=${this.host}
|
||||||
.chips=${this.chips}
|
.chips=${this.chips}
|
||||||
.getSessionId=${this.getSessionId}
|
.getSessionId=${this.getSessionId}
|
||||||
.createSessionId=${this.createChatSessionId}
|
.createSessionId=${this.createSessionId}
|
||||||
.getContextId=${this._getContextId}
|
.getContextId=${this._getContextId}
|
||||||
.chatContextValue=${this.chatContextValue}
|
.chatContextValue=${this.chatContextValue}
|
||||||
.updateContext=${this.updateContext}
|
.updateContext=${this.updateContext}
|
||||||
|
|||||||
@@ -141,14 +141,10 @@ export class AIChatBlockPeekView extends LitElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private readonly _getSessionId = async () => {
|
private readonly _getSessionId = async () => {
|
||||||
return this._sessionId;
|
return this._forkSessionId ?? this._sessionId;
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly _createSessionId = async () => {
|
private readonly _createSessionId = async () => {
|
||||||
return this._sessionId;
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly _createForkSessionId = async () => {
|
|
||||||
if (this._forkSessionId) {
|
if (this._forkSessionId) {
|
||||||
return this._forkSessionId;
|
return this._forkSessionId;
|
||||||
}
|
}
|
||||||
@@ -506,7 +502,6 @@ export class AIChatBlockPeekView extends LitElement {
|
|||||||
.doc=${this.host.doc}
|
.doc=${this.host.doc}
|
||||||
.getSessionId=${this._getSessionId}
|
.getSessionId=${this._getSessionId}
|
||||||
.createSessionId=${this._createSessionId}
|
.createSessionId=${this._createSessionId}
|
||||||
.createChatSessionId=${this._createForkSessionId}
|
|
||||||
.chatContextValue=${chatContext}
|
.chatContextValue=${chatContext}
|
||||||
.updateContext=${updateContext}
|
.updateContext=${updateContext}
|
||||||
.onHistoryCleared=${this._onHistoryCleared}
|
.onHistoryCleared=${this._onHistoryCleared}
|
||||||
|
|||||||
Reference in New Issue
Block a user