Skip to content

Commit 33f781f

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[Cleanup] Update type location and naming
Things coming from Aida should stay on the layer. Other things should not reference it if not directly using it. Bug: none Change-Id: I96d5cb06c2ed5fcc8fdcb9d9596ba85fec8d7dcc Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6023185 Auto-Submit: Nikolay Vitkov <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]> Commit-Queue: Ergün Erdoğmuş <[email protected]>
1 parent d891761 commit 33f781f

File tree

7 files changed

+19
-24
lines changed

7 files changed

+19
-24
lines changed

front_end/core/host/AidaClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const enum Rating {
2121
NEGATIVE = 'NEGATIVE',
2222
}
2323

24-
export interface Chunk {
24+
export interface HistoryChunk {
2525
text: string;
2626
entity: Entity;
2727
}
@@ -65,10 +65,10 @@ export interface AidaRequest {
6565
input: string;
6666
preamble?: string;
6767
// eslint-disable-next-line @typescript-eslint/naming-convention
68-
chat_history?: Chunk[];
68+
chat_history?: HistoryChunk[];
6969
client: string;
7070
options?: {
71-
temperature?: Number,
71+
temperature?: number,
7272
// eslint-disable-next-line @typescript-eslint/naming-convention
7373
model_id?: string,
7474
};

front_end/panels/freestyler/AiAgent.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AiAgentMock extends AiAgent<unknown> {
2323
clientFeature: Host.AidaClient.ClientFeature = 0;
2424
userTier: undefined;
2525

26-
options: Freestyler.AidaRequestOptions = {
26+
options: Freestyler.RequestOptions = {
2727
temperature: 1,
2828
modelId: 'test model',
2929
};

front_end/panels/freestyler/AiAgent.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,11 @@ export interface UserQuery {
8787
export type ResponseData = AnswerResponse|ErrorResponse|ActionResponse|SideEffectResponse|ThoughtResponse|TitleResponse|
8888
QueryResponse|ContextResponse|UserQuery;
8989

90-
export interface AidaBuildRequestOptions {
90+
export interface BuildRequestOptions {
9191
input: string;
9292
}
9393

94-
export interface HistoryChunk {
95-
text: string;
96-
entity: Host.AidaClient.Entity;
97-
}
98-
99-
export interface AidaRequestOptions {
94+
export interface RequestOptions {
10095
temperature?: number;
10196
modelId?: string;
10297
}
@@ -156,7 +151,7 @@ export abstract class AiAgent<T> {
156151
#aidaClient: Host.AidaClient.AidaClient;
157152
#serverSideLoggingEnabled: boolean;
158153
abstract readonly preamble: string;
159-
abstract readonly options: AidaRequestOptions;
154+
abstract readonly options: RequestOptions;
160155
abstract readonly clientFeature: Host.AidaClient.ClientFeature;
161156
abstract readonly userTier: string|undefined;
162157
abstract handleContextDetails(select: ConversationContext<T>|null): AsyncGenerator<ContextResponse, void, void>;
@@ -178,7 +173,7 @@ export abstract class AiAgent<T> {
178173
this.#serverSideLoggingEnabled = opts.serverSideLoggingEnabled ?? false;
179174
}
180175

181-
get chatHistoryForTesting(): Array<HistoryChunk> {
176+
get chatHistoryForTesting(): Array<Host.AidaClient.HistoryChunk> {
182177
return this.#chatHistoryForAida;
183178
}
184179

@@ -250,7 +245,7 @@ export abstract class AiAgent<T> {
250245
return {response, rpcId};
251246
}
252247

253-
buildRequest(opts: AidaBuildRequestOptions): Host.AidaClient.AidaRequest {
248+
buildRequest(opts: BuildRequestOptions): Host.AidaClient.AidaRequest {
254249
const history = this.#chatHistoryForAida;
255250
const request: Host.AidaClient.AidaRequest = {
256251
input: opts.input,
@@ -317,8 +312,8 @@ STOP`;
317312
return text;
318313
}
319314

320-
get #chatHistoryForAida(): HistoryChunk[] {
321-
const history: Array<HistoryChunk> = [];
315+
get #chatHistoryForAida(): Host.AidaClient.HistoryChunk[] {
316+
const history: Array<Host.AidaClient.HistoryChunk> = [];
322317
let response: {
323318
title?: string,
324319
thought?: string,

front_end/panels/freestyler/DrJonesFileAgent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import * as PanelUtils from '../utils/utils.js';
1212
import {
1313
AgentType,
1414
AiAgent,
15-
type AidaRequestOptions,
1615
type ContextDetail,
1716
type ContextResponse,
1817
ConversationContext,
1918
type ParsedResponse,
19+
type RequestOptions,
2020
ResponseType,
2121
} from './AiAgent.js';
2222

@@ -108,7 +108,7 @@ export class DrJonesFileAgent extends AiAgent<Workspace.UISourceCode.UISourceCod
108108
const config = Common.Settings.Settings.instance().getHostConfig();
109109
return config.devToolsAiAssistanceFileAgent?.userTier;
110110
}
111-
get options(): AidaRequestOptions {
111+
get options(): RequestOptions {
112112
const config = Common.Settings.Settings.instance().getHostConfig();
113113
const temperature = config.devToolsAiAssistanceFileAgent?.temperature;
114114
const modelId = config.devToolsAiAssistanceFileAgent?.modelId;

front_end/panels/freestyler/DrJonesNetworkAgent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import * as PanelUtils from '../utils/utils.js';
1313
import {
1414
AgentType,
1515
AiAgent,
16-
type AidaRequestOptions,
1716
type ContextDetail,
1817
type ContextResponse,
1918
ConversationContext,
2019
type ParsedResponse,
20+
type RequestOptions,
2121
ResponseType,
2222
} from './AiAgent.js';
2323

@@ -136,7 +136,7 @@ export class DrJonesNetworkAgent extends AiAgent<SDK.NetworkRequest.NetworkReque
136136
const config = Common.Settings.Settings.instance().getHostConfig();
137137
return config.devToolsAiAssistanceNetworkAgent?.userTier;
138138
}
139-
get options(): AidaRequestOptions {
139+
get options(): RequestOptions {
140140
const config = Common.Settings.Settings.instance().getHostConfig();
141141
const temperature = config.devToolsAiAssistanceNetworkAgent?.temperature;
142142
const modelId = config.devToolsAiAssistanceNetworkAgent?.modelId;

front_end/panels/freestyler/DrJonesPerformanceAgent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import * as PanelUtils from '../utils/utils.js';
1111
import {
1212
AgentType,
1313
AiAgent,
14-
type AidaRequestOptions,
1514
type ContextResponse,
1615
ConversationContext,
1716
type ParsedResponse,
17+
type RequestOptions,
1818
ResponseType,
1919
} from './AiAgent.js';
2020

@@ -171,7 +171,7 @@ export class DrJonesPerformanceAgent extends AiAgent<TimelineUtils.AICallTree.AI
171171
const config = Common.Settings.Settings.instance().getHostConfig();
172172
return config.devToolsAiAssistancePerformanceAgent?.userTier;
173173
}
174-
get options(): AidaRequestOptions {
174+
get options(): RequestOptions {
175175
const config = Common.Settings.Settings.instance().getHostConfig();
176176
const temperature = config.devToolsAiAssistancePerformanceAgent?.temperature;
177177
const modelId = config.devToolsAiAssistancePerformanceAgent?.modelId;

front_end/panels/freestyler/FreestylerAgent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import {
1515
type ActionResponse,
1616
AgentType,
1717
AiAgent,
18-
type AidaRequestOptions,
1918
type ContextResponse,
2019
ConversationContext,
2120
debugLog,
2221
isDebugMode,
2322
type ParsedResponse,
23+
type RequestOptions,
2424
ResponseType,
2525
type SideEffectResponse,
2626
} from './AiAgent.js';
@@ -262,7 +262,7 @@ export class FreestylerAgent extends AiAgent<SDK.DOMModel.DOMNode> {
262262
return config.devToolsFreestyler?.executionMode ?? Root.Runtime.HostConfigFreestylerExecutionMode.ALL_SCRIPTS;
263263
}
264264

265-
get options(): AidaRequestOptions {
265+
get options(): RequestOptions {
266266
const config = Common.Settings.Settings.instance().getHostConfig();
267267
const temperature = config.devToolsFreestyler?.temperature;
268268
const modelId = config.devToolsFreestyler?.modelId;

0 commit comments

Comments
 (0)