Elffuss BraidHub

kikocis/continue public

Merge pull request #5812 from uinstinct/agent-dev-data

feat: add `tools` in chatInteraction dev data
Changeset567b310f64779f1a897c63c775e0425b998440b4b1d23136de69ee416754c5d4
AuthorDallin Romney <dallinromney@gmail.com> · 2025-06-11 16:16 -07:00
CommitterGitHub <noreply@github.com> · 2025-06-11 16:16 -07:00
Parents0d2a295a29a9, 3cf95f0b2a97

Browse the files at this changeset

4 files changed

modified core/data/log.test.ts +30 −0
@@ -18,6 +18,19 @@
1818 provider: "openai",
1919 },
2020 };
21+
22+const TEST_AGENT_INTERACTION_EVENT: DevDataLogEvent = {
23+ name: 'chatInteraction',
24+ data: {
25+ prompt: "Hello, world!",
26+ completion: "Hello, world!",
27+ modelProvider: "openai",
28+ modelTitle: "gpt-4",
29+ sessionId: "1234",
30+ tools: ['test-tool1']
31+ },
32+}
33+
2134 const SCHEMA = "0.2.0";
2235
2336 describe("DataLogger", () => {
@@ -157,6 +170,23 @@
157170 expect(fileContent).toContain('"model":"gpt-4"');
158171 expect(fileContent).toContain('"eventName":"tokensGenerated"');
159172 });
173+
174+ it('should write agent interaction data to local file', async () => {
175+ // Call the method to log data locally
176+ await dataLogger.logLocalData(TEST_AGENT_INTERACTION_EVENT);
177+
178+ // Verify the file was created
179+ const filepath = getDevDataFilePath(TEST_AGENT_INTERACTION_EVENT.name, SCHEMA);
180+ expect(fs.existsSync(filepath)).toBe(true);
181+
182+ // Read file contents and verify
183+ const fileContent = fs.readFileSync(filepath, "utf8");
184+ console.log('debug1 filecontent', fileContent)
185+ expect(fileContent).toContain('"eventName":"chatInteraction"');
186+ expect(fileContent).toContain('"prompt":"Hello, world!"');
187+ expect(fileContent).toContain('"completion":"Hello, world!"');
188+ expect(fileContent).toContain('"tools":["test-tool1"]');
189+ })
160190 });
161191
162192 describe("logDevData", () => {
modified gui/src/redux/thunks/streamNormalInput.ts +3 −0
@@ -82,6 +82,9 @@
8282 modelProvider: selectedChatModel.underlyingProviderName,
8383 modelTitle: selectedChatModel.title,
8484 sessionId: state.session.id,
85+ ...(state.session.mode === 'agent' && {
86+ tools: activeTools.map((tool) => tool.function.name),
87+ }),
8588 },
8689 });
8790 }
modified packages/config-yaml/src/schemas/data/chatInteraction/index.ts +1 −0
@@ -7,4 +7,5 @@
77 prompt: z.string(),
88 completion: z.string(),
99 sessionId: z.string(),
10+ tools: z.array(z.string()).optional()
1011 });
modified packages/config-yaml/src/schemas/data/chatInteraction/v0.2.0.ts +1 −0
@@ -16,6 +16,7 @@
1616 modelTitle: true,
1717 modelProvider: true,
1818 sessionId: true,
19+ tools: true
1920 });
2021
2122 export const chatInteractionEventSchema_0_2_0_noCode =