Skip to content

An AI-powered search engine with a generative UI

Fix GPT-5 reasoning display configuration

Yoshiki Miuraf41dd174bf83
diff --git a/components/reasoning-section.tsx b/components/reasoning-section.tsx
index 75387e4a..ee374d58 100644
--- a/components/reasoning-section.tsx
+++ b/components/reasoning-section.tsx
@@ -1,7 +1,7 @@
'use client'
import type { ReasoningPart } from '@ai-sdk/provider-utils'
-import { Lightbulb, Loader2 } from 'lucide-react'
+import { Lightbulb } from 'lucide-react'
import { useArtifact } from '@/components/artifact/artifact-context'
@@ -32,17 +32,11 @@ export function ReasoningSection({
onClick={() =>
open({ type: 'reasoning', text: content.reasoning } as ReasoningPart)
}
- className="flex items-center gap-1 w-full text-left text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer"
+ className={`flex items-center gap-1 w-full text-left text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer ${!content.isDone ? 'animate-pulse' : ''}`}
title="Open details"
>
<Lightbulb size={14} />
<span>{!content.isDone ? 'Thinking...' : 'Thoughts'}</span>
- {!content.isDone && (
- <Loader2
- size={14}
- className="animate-spin text-muted-foreground/50 ml-auto"
- />
- )}
</button>
)
diff --git a/lib/agents/researcher.ts b/lib/agents/researcher.ts
index 0f90dd54..d2535bac 100644
--- a/lib/agents/researcher.ts
+++ b/lib/agents/researcher.ts
@@ -70,12 +70,16 @@ For complex queries requiring systematic investigation:
- Mark all tasks as completed before finishing your work
`
+import { Model } from '@/lib/types/models'
+
export function researcher({
model,
+ modelConfig,
abortSignal,
writer
}: {
model: string
+ modelConfig?: Model
abortSignal?: AbortSignal
writer?: UIMessageStreamWriter
}) {
@@ -112,7 +116,10 @@ export function researcher({
tools,
activeTools: activeToolsList,
stopWhen: stepCountIs(20),
- abortSignal
+ abortSignal,
+ ...(modelConfig?.providerOptions && {
+ providerOptions: modelConfig.providerOptions
+ })
})
} catch (error) {
console.error('Error in researcher:', error)
diff --git a/lib/config/default-models.json b/lib/config/default-models.json
index 58c539fb..0b71b2d0 100644
--- a/lib/config/default-models.json
+++ b/lib/config/default-models.json
@@ -22,19 +22,37 @@
"id": "gpt-5-2025-08-07",
"name": "GPT-5",
"provider": "OpenAI",
- "providerId": "openai"
+ "providerId": "openai",
+ "providerOptions": {
+ "openai": {
+ "reasoningEffort": "low",
+ "reasoningSummary": "detailed"
+ }
+ }
},
{
"id": "gpt-5-mini-2025-08-07",
"name": "GPT-5 Mini",
"provider": "OpenAI",
- "providerId": "openai"
+ "providerId": "openai",
+ "providerOptions": {
+ "openai": {
+ "reasoningEffort": "low",
+ "reasoningSummary": "detailed"
+ }
+ }
},
{
"id": "gpt-5-nano-2025-08-07",
"name": "GPT-5 Nano",
"provider": "OpenAI",
- "providerId": "openai"
+ "providerId": "openai",
+ "providerOptions": {
+ "openai": {
+ "reasoningEffort": "low",
+ "reasoningSummary": "detailed"
+ }
+ }
},
{
"id": "claude-opus-4-1-20250805",
diff --git a/lib/streaming/create-chat-stream-response.ts b/lib/streaming/create-chat-stream-response.ts
index d52844b9..2547e0bf 100644
--- a/lib/streaming/create-chat-stream-response.ts
+++ b/lib/streaming/create-chat-stream-response.ts
@@ -73,6 +73,7 @@ export async function createChatStreamResponse(
// Get the researcher agent
const researchAgent = researcher({
model: context.modelId,
+ modelConfig: model,
abortSignal,
writer
})
diff --git a/lib/types/models.ts b/lib/types/models.ts
index a06c9906..4602ef0f 100644
--- a/lib/types/models.ts
+++ b/lib/types/models.ts
@@ -3,4 +3,5 @@ export interface Model {
name: string
provider: string
providerId: string
+ providerOptions?: Record<string, any>
}
diff --git a/public/config/models.json b/public/config/models.json
index 9aafa6e3..0482b23e 100644
--- a/public/config/models.json
+++ b/public/config/models.json
@@ -22,19 +22,37 @@
"id": "gpt-5-2025-08-07",
"name": "GPT-5",
"provider": "OpenAI",
- "providerId": "openai"
+ "providerId": "openai",
+ "providerOptions": {
+ "openai": {
+ "reasoningEffort": "low",
+ "reasoningSummary": "detailed"
+ }
+ }
},
{
"id": "gpt-5-mini-2025-08-07",
"name": "GPT-5 mini",
"provider": "OpenAI",
- "providerId": "openai"
+ "providerId": "openai",
+ "providerOptions": {
+ "openai": {
+ "reasoningEffort": "low",
+ "reasoningSummary": "detailed"
+ }
+ }
},
{
"id": "gpt-5-nano-2025-08-07",
"name": "GPT-5 nano",
"provider": "OpenAI",
- "providerId": "openai"
+ "providerId": "openai",
+ "providerOptions": {
+ "openai": {
+ "reasoningEffort": "low",
+ "reasoningSummary": "detailed"
+ }
+ }
},
{
"id": "claude-opus-4-1-20250805",