Skip to content

Conversation

caarlos0
Copy link
Member

  • default-api in the configuration file
  • cache stores the API as well - and displays it in the list
  • improved resolution of api+model/aliases

this should give more control to which model/api to use

closes #300

- `default-api` in the configuration file
- cache stores the API as well - and displays it in the list
- improved resolution of api+model/aliases

closes #300
@caarlos0 caarlos0 requested review from aymanbagabas and Copilot May 22, 2025 19:34
@caarlos0 caarlos0 self-assigned this May 22, 2025
@caarlos0 caarlos0 added the enhancement New feature or request label May 22, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds explicit handling of API endpoints alongside models, persisting the API in the cache and configuration, and improves resolution logic to match models and aliases per-API.

  • Introduce default-api in config and load it into Config.API
  • Migrate DB to add an api column and update all Save calls
  • Add resolveModel helper to pair an API with its model (including alias support)

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
mods.go Load and propagate API in state, replace inline model lookup with resolveModel, extend cacheDetails to include API
db.go Auto-migrate new api column, update Save to store API
main.go Display API in conversation list and pass API to DB
config.go Add default-api field, update help text
config_template.yml Add default-api to template
mods_test.go Update tests to include API parameter in Save
db_test.go Update DB tests to cover new api column
Comments suppressed due to low confidence (1)

mods.go:726

  • The new resolveModel function contains non-trivial logic for alias matching and error handling, but there are no dedicated unit tests for it. Consider adding tests covering valid resolutions, alias handling, and each error branch.
func (m *Mods) resolveModel(cfg *Config) (API, Model, error) {

@caarlos0 caarlos0 merged commit e92f508 into main May 27, 2025
14 checks passed
@caarlos0 caarlos0 deleted the api branch May 27, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no clear / controllable which api is being used
2 participants