Add a neutral "Custom OpenAI-compatible" preset for LLM profiles

Aperta
#648 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend, frontend

Direzione di ricerca

Start with ConfigFrom for the openai format in the agent package and the generic provider in agent/provider.go, then find where the LLM profile form in System -> LLM sets the format and base URL placeholder. Write the regression test for stripping a trailing /chat/completions first, and add the db profile round-trip test. Done when those tests pass with go test ./... and the frontend preset test passes. The placement of the preset and whether to validate /v1 are still open maintainer questions.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feature

Problem

Users who run a self-hosted or third-party OpenAI-compatible endpoint (a local gateway, a relay/proxy, or a custom model name) must currently pick the generic "openai" format and know the base URL and model conventions themselves. The docs cover this in README ("Base URL gotcha"), but the profile form gives no guided path. Reports of confusion and wrong base URLs (for example, a trailing /v1 or a pasted /chat/completions) are the common failure mode.

Proposal

Add a neutral preset named "Custom OpenAI-compatible" to the LLM profile form in System -> LLM. The preset does three things and nothing more:

  1. Selects the existing openai format (no new wire format, no schema migration).
  2. Pre-fills an empty base URL placeholder that shows the expected shape (https://<host>/v1), without a vendor name or a baked endpoint.
  3. Shows a one-line hint that the base must end in /v1 for OpenAI-format endpoints, and that the path /chat/completions is appended by the provider.

No vendor logos, no vendor-specific environment variables, no promotional content, no hard-coded endpoints. This matches CONTRIBUTING.md ("provider convenience goes in as a neutral preset (name and base URL) or a docs recipe").

Non-goals

  • No new wire format and no schema change. This is a form-level preset only.
  • No ChatGPT-subscription or session-token auth. Only API-key based endpoints are in scope.
  • No automatic model discovery. A user types the model name.

Behavior spec

  • Preset is selectable in the profile form. Choosing it sets format to openai and fills the base URL placeholder.
  • Saving with an empty base URL falls back to the existing behavior (the public OpenAI endpoint), so behavior for current profiles is unchanged.
  • Trailing /chat/completions in the base URL is stripped, as ConfigFrom already does for openai.
  • Existing profiles are not modified.

Rationale

  • Reduces setup errors for any OpenAI-compatible backend without adding vendor-specific code.
  • Keeps the generic provider pattern in agent/provider.go intact.
  • Scope is one focused change, consistent with the one-change-per-PR rule.

Test plan (TDD: failing test first)

  1. Unit test (Go, agent package): ConfigFrom("openai", ...) given a base URL with a trailing /chat/completions returns a base URL with it stripped. This already exists in behavior; add a regression test pinning it so the preset cannot regress it.
  2. Profile save/load test (db package): save an openai profile with a custom base URL and a custom model name, reload it, and assert base URL, model, and format round-trip unchanged.
  3. Frontend test: selecting the preset sets format to openai and the base URL placeholder; saving an empty base URL does not write a value.
  4. Live connection test: run the existing connection test against a local OpenAI-compatible endpoint and confirm HTTP 200 and a model reply.

Order: write tests 1-3 first, watch them fail, then implement the preset, then watch them pass. Run go vet ./... and go test ./..., and the frontend test suite.

Verification status

Not yet run. This issue is a proposal. The code change has not been written or tested.

Open questions for maintainers

  • Should the preset appear only under "Advanced" in the form, or on the main format selector?
  • Is a placeholder hint enough, or should the form validate that the base URL ends in /v1 for the openai format?
Lingua principale
Go
Stelle
18.7k
Fork
7k
Merge medio
10h 41m
PR unite (30g)
342

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di BaaRai/ARTEX

Tutte le issue di BaaRai/ARTEX

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.