Reasoning effort was a free-text profile field that only reached OpenAI and OpenRouter, so Anthropic, Google, and DeepSeek models never thought in direct chat. AI SDK 7 standardizes a `reasoning` call option that those providers map to their own thinking settings, so profiles now store one typed thinking level, shared with Pi, and requests pass it through that option. OpenRouter's provider ignores the standard option and receives its own reasoning option instead. The composer offers the level next to the Design profile and reads it per request, so a change applies to the next message without rebuilding the transport. Saved profiles migrate from the Pi level or the old effort string. Finished reasoning shows how long the model thought while the block streamed.
23 lines
827 B
TypeScript
23 lines
827 B
TypeScript
import { createToolLoopTransport } from '@/app/ai/chat/transports'
|
|
|
|
import { createRenderStreamModel, type RenderStreamScenario } from './model'
|
|
|
|
/** Test-only browser entrypoint. Uses the existing transport override, not production test hooks. */
|
|
export function installBrowserRenderStream(scenario: RenderStreamScenario) {
|
|
const store = window.openPencil?.getStore?.()
|
|
const setTransport = window.openPencil?.setChatTransport
|
|
if (!store || !setTransport) throw new Error('Editor/chat bridge unavailable')
|
|
const { model, ...controls } = createRenderStreamModel(scenario)
|
|
setTransport(() =>
|
|
createToolLoopTransport({
|
|
store,
|
|
model,
|
|
providerID: 'openrouter',
|
|
effectiveModelID: 'streaming-jsx',
|
|
maxOutputTokens: 4096,
|
|
thinkingLevel: () => 'default'
|
|
})
|
|
)
|
|
return controls
|
|
}
|