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
+14 -3
View File
@@ -413,6 +413,8 @@ export function ChatEngineProvider({
// screen): an answer started meanwhile would land in the next chat
const leavingRef = useRef(false)
const [isLeaving, setIsLeaving] = useState(false)
// The user's provider the current turn was sent to, for its errors
const requestProviderIdRef = useRef<string | undefined>(undefined)
// A message is being sent again (retry, regenerate, edit), until the
// SDK has put it back
const [isResending, setIsResending] = useState(false)
@@ -607,6 +609,11 @@ export function ChatEngineProvider({
// Not in another chat that came on screen meanwhile
if (getChatGeneration() !== turnChatRef.current) return
// The provider the turn was sent to (none for a server model);
// the model selected may have changed since, e.g. in another tab
const providerId = requestProviderIdRef.current
// A system message, so it can be cleared with the conversation
setMessages((currentMessages) => [
...currentMessages,
@@ -614,14 +621,15 @@ export function ChatEngineProvider({
id: `error-${Date.now()}`,
role: "system" as const,
parts: [{ type: "text" as const, text }],
// The message shows a button that opens model settings
// The message shows a button that opens model settings,
// on the page of the provider that refused
...(openModelConfig && {
metadata: { openModelConfig: true },
metadata: { openModelConfig: true, providerId },
}),
},
])
if (isAccessCodeError) openSettings("advanced")
if (isAccessCodeError) openSettings("general")
},
// Re-render streamed messages at most every 150 ms. The streaming
// diagram preview draws on each update, so this also limits redraws
@@ -1200,6 +1208,9 @@ export function ChatEngineProvider({
const config = getSelectedAIConfig()
const { customSystemMessage, minimalStyle, maxOutputTokens } =
useSettingsStore.getState()
// For this turn's errors: the provider these headers name (read with
// them, from storage: another tab may have changed it meanwhile)
requestProviderIdRef.current = config.providerId || undefined
const selected = selectedCells.map(({ id, label }) => ({ id, label }))
const options = {