Skip to content

Commit 53f41e5

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[Freestyler] Create History from run yields
We want to update the way we handle history so we can restore it from storage eventually. For this we store the whole run with every detail, that way we can rebuild both the UI and the AIDA history from a single point. go/chrome-devtools:ai-history Bug: 369303513 Change-Id: Ic97e3222d4f7827b900d904e73d607e72391265d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5954344 Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Alex Rudenko <[email protected]>
1 parent 6d42f5f commit 53f41e5

File tree

7 files changed

+238
-203
lines changed

7 files changed

+238
-203
lines changed

front_end/panels/freestyler/AiAgent.test.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import * as Host from '../../core/host/host.js';
5+
import type * as Host from '../../core/host/host.js';
66
import {
77
describeWithEnvironment,
88
} from '../../testing/EnvironmentHelpers.js';
99

1010
import * as Freestyler from './freestyler.js';
1111

12-
const {AiAgent} = Freestyler;
12+
const {AiAgent, ResponseType} = Freestyler;
1313

1414
class AiAgentMock extends AiAgent<unknown> {
1515
override preamble = 'preamble';
1616

17+
// eslint-disable-next-line require-yield
18+
override async * handleContextDetails(): AsyncGenerator<Freestyler.ContextResponse, void, void> {
19+
return;
20+
}
21+
1722
clientFeature: Host.AidaClient.ClientFeature = 0;
1823
userTier: undefined;
1924

@@ -122,15 +127,17 @@ describeWithEnvironment('AiAgent', () => {
122127
const agent = new AiAgentMock({
123128
aidaClient: {} as Host.AidaClient.AidaClient,
124129
});
125-
agent.chatHistoryForTesting = new Map([[
126-
0,
130+
agent.chatNewHistoryForTesting = new Map([
127131
[
128-
{
129-
text: 'test',
130-
entity: Host.AidaClient.Entity.USER,
131-
},
132+
0,
133+
[
134+
{
135+
type: ResponseType.QUERYING,
136+
query: 'test',
137+
},
138+
],
132139
],
133-
]]);
140+
]);
134141

135142
const request = agent.buildRequest({
136143
input: 'test input',

0 commit comments

Comments
 (0)