mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
fix: add null check for providerSettings and update tests for user preference behavior
This commit is contained in:
parent
c418a830f0
commit
d30b3b4523
3 changed files with 13 additions and 19 deletions
|
|
@ -1200,8 +1200,9 @@ describe("VertexHandler", () => {
|
|||
)
|
||||
})
|
||||
|
||||
it("should include tools even when toolProtocol is set to xml (user preference now ignored)", async () => {
|
||||
// XML protocol deprecation: user preference is now ignored when model supports native tools
|
||||
it("should NOT include tools when toolProtocol is set to xml (user preference is now respected)", async () => {
|
||||
// User preference is now respected: when XML protocol is selected, tools are NOT sent to the API
|
||||
// (tools are handled via XML in the system prompt instead)
|
||||
handler = new AnthropicVertexHandler({
|
||||
apiModelId: "claude-3-5-sonnet-v2@20241022",
|
||||
vertexProjectId: "test-project",
|
||||
|
|
@ -1242,14 +1243,10 @@ describe("VertexHandler", () => {
|
|||
// Just consume
|
||||
}
|
||||
|
||||
// Native is forced when supportsNativeTools===true, so tools should still be included
|
||||
// User preference for XML is now respected, so tools should NOT be included
|
||||
expect(mockCreate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
tools: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
name: "get_weather",
|
||||
}),
|
||||
]),
|
||||
expect.not.objectContaining({
|
||||
tools: expect.anything(),
|
||||
}),
|
||||
undefined,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -451,8 +451,9 @@ describe("AnthropicHandler", () => {
|
|||
)
|
||||
})
|
||||
|
||||
it("should include tools even when toolProtocol is set to xml (user preference now ignored)", async () => {
|
||||
// XML protocol deprecation: user preference is now ignored when model supports native tools
|
||||
it("should NOT include tools when toolProtocol is set to xml (user preference is now respected)", async () => {
|
||||
// User preference is now respected: when XML protocol is selected, tools are NOT sent to the API
|
||||
// (tools are handled via XML in the system prompt instead)
|
||||
const xmlHandler = new AnthropicHandler({
|
||||
...mockOptions,
|
||||
toolProtocol: "xml",
|
||||
|
|
@ -468,14 +469,10 @@ describe("AnthropicHandler", () => {
|
|||
// Just consume
|
||||
}
|
||||
|
||||
// Native is forced when supportsNativeTools===true, so tools should still be included
|
||||
// User preference for XML is now respected, so tools should NOT be included
|
||||
expect(mockCreate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
tools: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
name: "get_weather",
|
||||
}),
|
||||
]),
|
||||
expect.not.objectContaining({
|
||||
tools: expect.anything(),
|
||||
}),
|
||||
expect.anything(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export function resolveToolProtocol(
|
|||
// 2. User/Profile Preference - allow users to explicitly force XML protocol
|
||||
// This is useful for models that don't handle native tool calling well
|
||||
// (e.g., some OpenAI-compatible models like Qwen3, Kimi2)
|
||||
if (providerSettings.toolProtocol) {
|
||||
if (providerSettings?.toolProtocol) {
|
||||
return providerSettings.toolProtocol
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue