commit 0bf0548a9c74d9ab35f8961b603659771491eef6
parent efd1b5b9f2cf6eca7ca80e3680c0f0e8c03b30da
Author: pstanciu <pstanciu@mozilla.com>
Date: Sat, 20 Dec 2025 00:29:21 +0200
Revert "Bug 2006507 - Hook up actual tools r=ai-models-reviewers,tburrell" for causing bc fails @browser_all_files_referenced.js
This reverts commit 3ef513152eeba70f727d780959a658fe0495d188.
Diffstat:
2 files changed, 3 insertions(+), 39 deletions(-)
diff --git a/browser/components/aiwindow/models/Chat.sys.mjs b/browser/components/aiwindow/models/Chat.sys.mjs
@@ -11,22 +11,12 @@ import {
OAUTH_CLIENT_ID,
SCOPE_PROFILE,
} from "resource://gre/modules/FxAccountsCommon.sys.mjs";
-import {
- toolsConfig,
- getOpenTabs,
- searchBrowsingHistory,
- GetPageContent,
-} from "moz-src:///browser/components/aiwindow/models/Tools.sys.mjs";
/**
* Chat
*/
export const Chat = {
- toolMap: {
- get_open_tabs: getOpenTabs,
- search_browsing_history: searchBrowsingHistory,
- get_page_content: GetPageContent.getPageContent.bind(GetPageContent),
- },
+ toolMap: {}, // TODO can import toolMap
async _getFxAccountToken() {
try {
@@ -67,7 +57,7 @@ export const Chat = {
streamOptions: { enabled: true },
fxAccountToken,
tool_choice: "auto",
- tools: toolsConfig,
+ // tools: Add your tools configuration here,
args: convo,
});
@@ -94,13 +84,9 @@ export const Chat = {
}
// 3) Build the assistant tool_calls message exactly as expected by the API
- // Bug 2006159 - Implement parallel tool calling
- // TODO: Temporarily only include the first tool call due to quality issue
- // with subsequent tool call responses, will include all later once above
- // ticket is resolved.
const assistantToolMsg = {
role: "assistant",
- tool_calls: pendingToolCalls.slice(0, 1).map(toolCall => ({
+ tool_calls: pendingToolCalls.map(toolCall => ({
id: toolCall.id,
type: "function",
function: {
@@ -111,7 +97,6 @@ export const Chat = {
};
// 4) Execute each tool locally and create a tool message with the result
- // TODO: Temporarily only execute the first tool call, will run all later
const toolResultMessages = [];
for (const toolCall of pendingToolCalls) {
const { id, function: functionSpec } = toolCall;
@@ -161,9 +146,6 @@ export const Chat = {
tool_call_id: id,
content: typeof result === "string" ? result : JSON.stringify(result),
});
-
- // Bug 2006159 - Implement parallel tool calling, remove after implemented
- break;
}
convo = [...convo, assistantToolMsg, ...toolResultMessages];
diff --git a/browser/components/aiwindow/models/tests/xpcshell/test_Chat.js b/browser/components/aiwindow/models/tests/xpcshell/test_Chat.js
@@ -26,24 +26,6 @@ registerCleanupFunction(() => {
}
});
-add_task(async function test_Chat_real_tools_are_registered() {
- Assert.strictEqual(
- typeof Chat.toolMap.get_open_tabs,
- "function",
- "get_open_tabs should be registered in toolMap"
- );
- Assert.strictEqual(
- typeof Chat.toolMap.search_browsing_history,
- "function",
- "search_browsing_history should be registered in toolMap"
- );
- Assert.strictEqual(
- typeof Chat.toolMap.get_page_content,
- "function",
- "get_page_content should be registered in toolMap"
- );
-});
-
add_task(async function test_openAIEngine_build_uses_prefs() {
Services.prefs.setStringPref(PREF_API_KEY, "test-key-123");
Services.prefs.setStringPref(PREF_ENDPOINT, "https://example.test/v1");