Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/five-pigs-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"roo-cline": patch
---

Organize provider settings into separate components
9 changes: 4 additions & 5 deletions src/api/providers/__tests__/chutes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ describe("ChutesHandler", () => {
beforeEach(() => {
jest.clearAllMocks()
mockCreate = (OpenAI as unknown as jest.Mock)().chat.completions.create
handler = new ChutesHandler({})
handler = new ChutesHandler({ chutesApiKey: "test-chutes-api-key" })
})

test("should use the correct Chutes base URL", () => {
new ChutesHandler({})
new ChutesHandler({ chutesApiKey: "test-chutes-api-key" })
expect(OpenAI).toHaveBeenCalledWith(expect.objectContaining({ baseURL: "https://llm.chutes.ai/v1" }))
})

Expand All @@ -41,9 +41,8 @@ describe("ChutesHandler", () => {

test("should return specified model when valid model is provided", () => {
const testModelId: ChutesModelId = "deepseek-ai/DeepSeek-R1"
const handlerWithModel = new ChutesHandler({ apiModelId: testModelId })
const handlerWithModel = new ChutesHandler({ apiModelId: testModelId, chutesApiKey: "test-chutes-api-key" })
const model = handlerWithModel.getModel()

expect(model.id).toBe(testModelId)
expect(model.info).toEqual(chutesModels[testModelId])
})
Expand Down Expand Up @@ -110,7 +109,7 @@ describe("ChutesHandler", () => {
test("createMessage should pass correct parameters to Chutes client", async () => {
const modelId: ChutesModelId = "deepseek-ai/DeepSeek-R1"
const modelInfo = chutesModels[modelId]
const handlerWithModel = new ChutesHandler({ apiModelId: modelId })
const handlerWithModel = new ChutesHandler({ apiModelId: modelId, chutesApiKey: "test-chutes-api-key" })

mockCreate.mockImplementationOnce(() => {
return {
Expand Down
17 changes: 8 additions & 9 deletions src/api/providers/__tests__/groq.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ describe("GroqHandler", () => {
beforeEach(() => {
jest.clearAllMocks()
mockCreate = (OpenAI as unknown as jest.Mock)().chat.completions.create
handler = new GroqHandler({})
handler = new GroqHandler({ groqApiKey: "test-groq-api-key" })
})

test("should use the correct Groq base URL", () => {
new GroqHandler({})
new GroqHandler({ groqApiKey: "test-groq-api-key" })
expect(OpenAI).toHaveBeenCalledWith(expect.objectContaining({ baseURL: "https://api.groq.com/openai/v1" }))
})

Expand All @@ -35,17 +35,16 @@ describe("GroqHandler", () => {

test("should return default model when no model is specified", () => {
const model = handler.getModel()
expect(model.id).toBe(groqDefaultModelId) // Use groqDefaultModelId
expect(model.info).toEqual(groqModels[groqDefaultModelId]) // Use groqModels
expect(model.id).toBe(groqDefaultModelId)
expect(model.info).toEqual(groqModels[groqDefaultModelId])
})

test("should return specified model when valid model is provided", () => {
const testModelId: GroqModelId = "llama-3.3-70b-versatile" // Use a valid Groq model ID and type
const handlerWithModel = new GroqHandler({ apiModelId: testModelId }) // Instantiate GroqHandler
const testModelId: GroqModelId = "llama-3.3-70b-versatile"
const handlerWithModel = new GroqHandler({ apiModelId: testModelId, groqApiKey: "test-groq-api-key" })
const model = handlerWithModel.getModel()

expect(model.id).toBe(testModelId)
expect(model.info).toEqual(groqModels[testModelId]) // Use groqModels
expect(model.info).toEqual(groqModels[testModelId])
})

test("completePrompt method should return text from Groq API", async () => {
Expand Down Expand Up @@ -110,7 +109,7 @@ describe("GroqHandler", () => {
test("createMessage should pass correct parameters to Groq client", async () => {
const modelId: GroqModelId = "llama-3.1-8b-instant"
const modelInfo = groqModels[modelId]
const handlerWithModel = new GroqHandler({ apiModelId: modelId })
const handlerWithModel = new GroqHandler({ apiModelId: modelId, groqApiKey: "test-groq-api-key" })

mockCreate.mockImplementationOnce(() => {
return {
Expand Down
Loading