feat(ai): streaming, reasoning y selección de modelos en la tab de IA#18
Merged
Conversation
…ool-calls) - base.ts: modelo de eventos AgentStreamEvent + abstract chatStream - sse.ts: parser SSE compartido (resiliente a chunks partidos) + readStreamError - common.ts: refactor a prepareSession/persistAssistant; chatStream con hard fallback al query() no-streaming; abstract queryStream. query()/run() intactos - chatgpt/anthropic/gemini: queryStream parseando SSE (Anthropic con thinking, Gemini con thought parts best-effort) - list.tsx: chatStream que resuelve el driver y delega
- common.ts: el hard fallback gatea por TEXTO emitido, no por emittedAny. Si el stream emite solo reasoning (Anthropic/Gemini) y después falla antes del texto, ahora cae al query() no-streaming en vez de dejar el turno con 'Error:' - provider-picker: al cambiar de provider limpia el token (la key vieja es de otro provider → 401 silencioso que rompía chat Y Ctrl+B) y abre el dialog de key - sse.ts: cancela el reader en el path de error para no colgar la conexión - tests: reasoning→error→fallback, y merge con token vacío
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qué hace
Mejoras end-to-end de la tab de IA del chat: streaming SSE token a token con reasoning, header con selección de proveedor/modelo, fetch de modelos live + fallback curado, dialogs dedicados y un loader estilo Gemini. Todo aditivo: el
agentDriveres compartido con el Ctrl+B text-to-SQL del query-tab yquery()/run()quedan intactos — el streaming es un camino nuevo.Alcance (decisiones cerradas)
/modelsde cada provider con la API key; si falla (CORS/permiso/offline) cae a una lista curada por provider con badge "lista offline".Cambios
Drivers / streaming
base.ts: modelo de eventosAgentStreamEvent(reasoning/text/tool_call/done/error) +abstract chatStream.sse.ts(nuevo): parser SSE compartido, resiliente a chunks partidos; cancela el reader en el path de error;readStreamError.common.ts: refactor aprepareSession/persistAssistant(mismo historial multi-turno que antes);chatStreamcon hard fallback alquery()no-streaming.query()/run()sin tocar.chatgpt/anthropic/gemini:queryStreamparseando SSE. Anthropic conthinking(reasoning best-effort); Gemini parseathoughtparts sin forzarincludeThoughts(no rompe el default 2.0-flash). OpenAI por chat-completions no expone reasoning (documentado, no se inventa).list.tsx:chatStreamque resuelve el driver y delega.Modelos y storage
agent-models.ts(nuevo):fetchProviderModels(OpenAI/Anthropic/Gemini) +CURATED_MODELS+ filtros puros.ai-agent-storage.ts:mergeAgentConfig/patchAgentConfig(update parcial de config).UI
chat-tab-header.tsx(nuevo):[sparkle] Provider · model(clickeables) + 🔑 API key + + new chat. Lee config vía el SWR/local-agent-setting.model-picker-dialog.tsx/provider-picker-dialog.tsx(nuevos) +local-setting-dialog.tsx(queda como dialog de API key).chat-shimmer.tsx(nuevo): sparkle que pulsa + texto con gradiente que barre (CSS puro).chat-tab.tsx: consume el stream (reasoning colapsable, tool chips scaffold, shimmer, new chat).Review adversarial
Pasé un workflow de review por dimensión (SSE, fallback/errores, regresión Ctrl+B, React/UI, dialogs/a11y) con verificación escéptica independiente de cada hallazgo: 3 confirmados, 7 refutados. Los confirmados ya están arreglados en este PR:
Verificación local
typecheck✓ ·lint✓ ·jest153/153 ✓ ·audit:gate✓ ·build✓Tests nuevos: parseo de
/modelspor provider + fallback curado;queryStreamSSE (text vs reasoning) por provider; hard fallback (incluido reasoning→error→fallback); helpers de storage.