Skip to content

An AI-powered search engine with a generative UI

Update inquiry schema and copilot component

Yoshiki Miura1550d6c7d91e
diff --git a/components/copilot.tsx b/components/copilot.tsx
index 2096b26a..c12292e5 100644
--- a/components/copilot.tsx
+++ b/components/copilot.tsx
@@ -122,7 +122,7 @@ export const Copilot: React.FC<CopilotProps> = ({
className={cn('w-4 h-4 flex-shrink-0', { 'animate-spin': pending })}
/>
<p className="text-lg text-foreground text-semibold ml-2">
- {data?.inquiry}
+ {data?.question}
</p>
</div>
<form onSubmit={onFormSubmit}>
diff --git a/lib/agents/inquire.tsx b/lib/agents/inquire.tsx
index 1313b813..687ac8fa 100644
--- a/lib/agents/inquire.tsx
+++ b/lib/agents/inquire.tsx
@@ -20,7 +20,7 @@ export async function inquire(
Only ask additional questions if absolutely necessary after receiving an initial response from the user.
Structure your inquiry as follows:
e.g., {
- "inquiry": "What specific information are you seeking about Rivian?",
+ "question": "What specific information are you seeking about Rivian?",
"options": [
{"value": "history", "label": "History"},
{"value": "products", "label": "Products"},
diff --git a/lib/schema/inquiry.tsx b/lib/schema/inquiry.tsx
index 2d929c4a..7417011b 100644
--- a/lib/schema/inquiry.tsx
+++ b/lib/schema/inquiry.tsx
@@ -2,17 +2,21 @@ import { DeepPartial } from 'ai'
import { z } from 'zod'
export const inquirySchema = z.object({
- inquiry: z.string().describe(''),
- options: z.array(
- z.object({
- value: z.string(),
- label: z.string()
- })
- ),
- names: z.array(z.string()),
- allowsInput: z.boolean(),
- inputLabel: z.string().optional(),
- inputPlaceholder: z.string().optional()
+ question: z.string().describe('The inquiry question'),
+ options: z
+ .array(
+ z.object({
+ value: z.string(),
+ label: z.string()
+ })
+ )
+ .describe('The inquiry options'),
+ allowsInput: z.boolean().describe('Whether the inquiry allows for input'),
+ inputLabel: z.string().optional().describe('The label for the input field'),
+ inputPlaceholder: z
+ .string()
+ .optional()
+ .describe('The placeholder for the input field')
})
export type PartialInquiry = DeepPartial<typeof inquirySchema>