An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
fix: add default values to all optional fields in search schemas
Yoshiki Miura6c02a4d4d3ca
diff --git a/components/chat-panel.tsx b/components/chat-panel.tsxindex 41e77560..1e151733 100644--- a/components/chat-panel.tsx+++ b/components/chat-panel.tsx@@ -64,6 +64,7 @@ export function ChatPanel({const isFirstRender = useRef(true)const [isComposing, setIsComposing] = useState(false) // Composition stateconst [enterDisabled, setEnterDisabled] = useState(false) // Disable Enter after composition ends+ const [isInputFocused, setIsInputFocused] = useState(false) // Track input focusconst { close: closeArtifact } = useArtifact()const isLoading = status === 'submitted' || status === 'streaming'@@ -163,7 +164,10 @@ export function ChatPanel({</Button>)}- <div className="relative flex flex-col w-full gap-2 bg-muted rounded-3xl border border-input focus-within:ring-1 focus-within:ring-ring/20 focus-within:ring-offset-1 focus-within:ring-offset-background/50 transition-shadow">+ <div className={cn(+ "relative flex flex-col w-full gap-2 bg-muted rounded-3xl border border-input transition-shadow",+ isInputFocused && "ring-1 ring-ring/20 ring-offset-1 ring-offset-background/50"+ )}><Textarearef={inputRef}name="input"@@ -172,6 +176,8 @@ export function ChatPanel({tabIndex={0}onCompositionStart={handleCompositionStart}onCompositionEnd={handleCompositionEnd}+ onFocus={() => setIsInputFocused(true)}+ onBlur={() => setIsInputFocused(false)}placeholder="Ask anything..."spellCheck={false}value={input}diff --git a/lib/schema/search.tsx b/lib/schema/search.tsxindex 40832b00..255acaef 100644--- a/lib/schema/search.tsx+++ b/lib/schema/search.tsx@@ -20,22 +20,26 @@ export const searchSchema = z.object({max_results: z.number().optional()+ .default(20).describe('The maximum number of results to return. default is 20'),search_depth: z.string().optional()+ .default('basic').describe('The depth of the search. Allowed values are "basic" or "advanced"'),include_domains: z.array(z.string()).optional()+ .default([]).describe('A list of domains to specifically include in the search results. Default is None, which includes all domains.'),exclude_domains: z.array(z.string()).optional()+ .default([]).describe("A list of domains to specifically exclude from the search results. Default is None, which doesn't exclude any domains.")