Skip to content

Commit 88aea57

Browse files
Natallia HarshunovaDevtools-frontend LUCI CQ
authored andcommitted
Fix chat history order for queries with images
Previously, when a query contained an image, the asynchronous nature of image processing could cause a delay. This resulted in context-related messages appearing in the conversation history before the user's own query Bug: none Change-Id: I1511c8acd3bcfcf32d8b8a3f00d6be7e5504ec6f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6785550 Reviewed-by: Nikolay Vitkov <[email protected]> Commit-Queue: Natallia Harshunova <[email protected]> Auto-Submit: Natallia Harshunova <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]>
1 parent 37038f1 commit 88aea57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

front_end/models/ai_assistance/AiHistoryStorage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ export class Conversation {
9999
}
100100

101101
async addHistoryItem(item: ResponseData): Promise<void> {
102+
this.history.push(item);
103+
await AiHistoryStorage.instance().upsertHistoryEntry(this.serialize());
102104
if (item.type === ResponseType.USER_QUERY) {
103105
if (item.imageId && item.imageInput && 'inlineData' in item.imageInput) {
104106
const inlineData = item.imageInput.inlineData;
105107
await AiHistoryStorage.instance().upsertImage(
106108
{id: item.imageId, data: inlineData.data, mimeType: inlineData.mimeType});
107109
}
108110
}
109-
this.history.push(item);
110-
await AiHistoryStorage.instance().upsertHistoryEntry(this.serialize());
111111
}
112112

113113
serialize(): SerializedConversation {

0 commit comments

Comments
 (0)