feat(settings): reorganize the settings dialog and the model settings

Tabs Models, General, Drawing and About, each with a fixed title row.

The models tab becomes three pages: the user's providers with one status
each and the server's models; a searchable picker of all 24 providers in
four groups; and a provider page in three steps (connection, models,
test). A new provider gets its first suggested model, and a passing test
offers to use the model in the chat. Bedrock asks for one way of signing
in, with an optional session token for temporary access keys.

The composer's model picker lists every model, marking untested and
failed ones, and can open the provider picker. A chat error that offers
model settings opens the provider the request went to.
This commit is contained in:
dayuan.jiang
2026-10-08 17:44:08 +09:00
parent c513d1a0c2
commit 69fb66804d
32 changed files with 4237 additions and 1730 deletions
+42
View File
@@ -260,3 +260,45 @@ describe("useModelConfig across tabs", () => {
expect(result.current.config.providers).toHaveLength(2)
})
})
describe("useModelConfig migration", () => {
const OLD = {
provider: "next-ai-draw-io-ai-provider",
baseUrl: "next-ai-draw-io-ai-base-url",
apiKey: "next-ai-draw-io-ai-api-key",
model: "next-ai-draw-io-ai-model",
}
it("moves an old keyless Ollama setup into the new format", async () => {
localStorage.setItem(OLD.provider, "ollama")
localStorage.setItem(OLD.baseUrl, "http://localhost:11434/api")
localStorage.setItem(OLD.apiKey, "")
localStorage.setItem(OLD.model, "llama3.2")
const { result } = await renderLoaded()
const [provider] = result.current.config.providers
expect(provider).toMatchObject({
provider: "ollama",
apiKey: "",
baseUrl: "http://localhost:11434/api",
models: [{ modelId: "llama3.2" }],
})
expect(result.current.selectedModelId).toBe(provider.models[0].id)
expect(localStorage.getItem(OLD.model)).toBeNull()
})
it("keeps an old Ollama without a URL on the server's Ollama", async () => {
localStorage.setItem(OLD.provider, "ollama")
localStorage.setItem(OLD.apiKey, "")
localStorage.setItem(OLD.model, "llama3.2")
const { result } = await renderLoaded()
// No cloud address: the request takes OLLAMA_BASE_URL or this machine
expect(result.current.config.providers[0].baseUrl).toBe("")
})
it("still needs a key for other providers", async () => {
localStorage.setItem(OLD.provider, "openai")
localStorage.setItem(OLD.model, "gpt-4o")
const { result } = await renderLoaded()
expect(result.current.config.providers).toEqual([])
})
})