Skip to content

Save different API configurations to quickly switch between providers and settings#297

Merged
mrubens merged 17 commits intomainfrom
api_config
Jan 8, 2025
Merged

Save different API configurations to quickly switch between providers and settings#297
mrubens merged 17 commits intomainfrom
api_config

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented Jan 8, 2025

Slight cleanup of #240 to make it easy to switch between different API configurations. This enables people to switch between multiple keys on the same provider, to easily maintain two different OpenAI compatible providers, and to simulate different chat modes (for instance o1 for planning and sonnet for coding - more on that soon 🙏 ).

Screenshot 2025-01-07 at 8 26 51 PM

Screenshot 2025-01-07 at 8 27 13 PM

Screenshot 2025-01-07 at 8 27 29 PM


Important

Adds functionality to manage multiple API configurations, including UI components and tests, enabling easy switching between providers and settings.

  • Behavior:
    • Adds ConfigManager in ConfigManager.ts to manage multiple API configurations with methods for saving, loading, deleting, and listing configurations.
    • Updates ClineProvider.ts to integrate ConfigManager for handling API configurations.
    • Adds UI components in ApiConfigManager.tsx and SettingsView.tsx for managing configurations, including adding, renaming, and deleting configurations.
  • Tests:
    • Adds tests in ConfigManager.test.ts for ConfigManager methods to ensure correct behavior.
    • Updates SettingsView.test.tsx to test new configuration management UI.
  • Misc:
    • Updates README.md to mention the new feature of saving different API configurations.
    • Adds checkExistKey() in checkExistApiConfig.ts to verify if a configuration key exists.
    • Updates ChatTextArea.tsx and ChatView.tsx to support new configuration management.

This description was created by Ellipsis for fd07550. It will automatically update as commits are pushed.

samhvw8 and others added 9 commits January 7, 2025 20:09
Added useEffect hooks to GlamaModelPicker, OpenAiModelPicker, and OpenRouterModelPicker components to ensure the search term stays synchronized with the selected model ID from apiConfiguration. This prevents the search term from getting out of sync when the model is changed.
@changeset-bot
Copy link

changeset-bot bot commented Jan 8, 2025

🦋 Changeset detected

Latest commit: 9d16006

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
roo-cline Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

})


this.configManager.ListConfig().then(async (listApiConfig) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using async/await makes asynchronous code more readable and easier to maintain than chaining .then() calls. Please refactor this to use async/await. This is from our Development Standards: Development Standards.

setAlwaysAllowMcp(e.target.checked)
vscode.postMessage({ type: "alwaysAllowMcp", bool: e.target.checked })
}}>
onChange={(e: any) => setAlwaysAllowMcp(e.target.checked)}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using the any type for event handlers. Instead, use a more specific type like React.ChangeEvent<HTMLInputElement> for better type safety. This is applicable in other places as well, such as lines 254, 278, 317, 364, 400, 412, 448, and 459. This is from our Development Standards: https://www.notion.so/Development-Standards-59febcf8ead647fd9c2ec3f60c22f3df?pvs=4#11869ad2d5818051ae9cefd92c3aac2b

@mrubens mrubens merged commit 23fd205 into main Jan 8, 2025
4 checks passed
@mrubens mrubens deleted the api_config branch January 8, 2025 13:50
@mrubens mrubens mentioned this pull request Jan 9, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants