Elffuss BraidHub

kikocis/continue public

add `tools` key in chatInteraction
Changesetbdbad06b302ddf9e6a362b7bcf70aea36fa6ffbb5ae7868a254d87a412157bdd
Authoruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-05-26 18:33 +05:30
Committeruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-05-26 18:33 +05:30
Parents2e6c624272fb

Browse the files at this changeset

5 files changed

modified core/data/log.test.ts +5 −2
@@ -20,13 +20,14 @@
2020 };
2121
2222 const TEST_AGENT_INTERACTION_EVENT: DevDataLogEvent = {
23- name: 'agentInteraction',
23+ name: 'chatInteraction',
2424 data: {
2525 prompt: "Hello, world!",
2626 completion: "Hello, world!",
2727 modelProvider: "openai",
2828 modelTitle: "gpt-4",
2929 sessionId: "1234",
30+ tools: ['test-tool1']
3031 },
3132 }
3233
@@ -180,9 +181,11 @@
180181
181182 // Read file contents and verify
182183 const fileContent = fs.readFileSync(filepath, "utf8");
183- expect(fileContent).toContain('"eventName":"agentInteraction"');
184+ console.log('debug1 filecontent', fileContent)
185+ expect(fileContent).toContain('"eventName":"chatInteraction"');
184186 expect(fileContent).toContain('"prompt":"Hello, world!"');
185187 expect(fileContent).toContain('"completion":"Hello, world!"');
188+ expect(fileContent).toContain('"tools":["test-tool1"]');
186189 })
187190 });
188191
modified gui/src/redux/thunks/streamNormalInput.ts +5 −1
@@ -36,6 +36,7 @@
3636 throw new Error("Default model not defined");
3737 }
3838
39+ const isInEdit = state.session.isInEdit;
3940 let completionOptions: LLMFullCompletionOptions = {};
4041 const activeTools = selectActiveTools(state);
4142 const toolsSupported = modelSupportsTools(selectedChatModel);
@@ -75,13 +76,16 @@
7576 try {
7677 if (state.session.mode === "chat" || state.session.mode === "agent") {
7778 extra.ideMessenger.post("devdata/log", {
78- name: state.session.mode === 'chat' ? "chatInteraction" : "agentInteraction",
79+ name: "chatInteraction",
7980 data: {
8081 prompt: next.value.prompt,
8182 completion: next.value.completion,
8283 modelProvider: selectedChatModel.underlyingProviderName,
8384 modelTitle: selectedChatModel.title,
8485 sessionId: state.session.id,
86+ ...(isInEdit && {
87+ tools: activeTools.map((tool) => tool.function.name),
88+ }),
8589 },
8690 });
8791 }
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 =
modified packages/config-yaml/src/schemas/data/index.ts +0 −3
@@ -72,7 +72,6 @@
7272 tokensGenerated: tokensGeneratedEventAllSchema,
7373 chatInteraction: chatInteractionEventAllSchema,
7474 editInteraction: editInteractionEventAllSchema,
75- agentInteraction: chatInteractionEventAllSchema
7675 });
7776
7877 // Version and level specific schemas are organized here
@@ -98,7 +97,6 @@
9897 tokensGenerated: tokensGeneratedEventSchema_0_2_0,
9998 chatInteraction: chatInteractionEventSchema_0_2_0,
10099 editInteraction: editInteractionEventSchema_0_2_0,
101- agentInteraction: chatInteractionEventSchema_0_2_0,
102100 },
103101 noCode: {
104102 autocomplete: autocompleteEventSchema_0_2_0_noCode,
@@ -106,7 +104,6 @@
106104 tokensGenerated: tokensGeneratedEventSchema_0_2_0_noCode,
107105 chatInteraction: chatInteractionEventSchema_0_2_0_noCode,
108106 editInteraction: editInteractionEventSchema_0_2_0_noCode,
109- agentInteraction: chatInteractionEventSchema_0_2_0_noCode,
110107 },
111108 },
112109 };