An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
refactor: address Copilot type safety review comments
Yoshiki Miurabfc65520b25d
diff --git a/lib/tools/fetch.ts b/lib/tools/fetch.tsindex 1ca493e2..4e25407c 100644--- a/lib/tools/fetch.ts+++ b/lib/tools/fetch.ts@@ -4,6 +4,7 @@ import { fetchSchema } from '@/lib/schema/fetch'import { SearchResults as SearchResultsType } from '@/lib/types'const CONTENT_CHARACTER_LIMIT = 10000+const TITLE_CHARACTER_LIMIT = 100async function fetchRegularData(url: string@@ -41,7 +42,9 @@ async function fetchRegularData(const titleMatch = html.match(/<title[^>]*>([^<]*)<\/title>/i)const rawTitle = titleMatch ? titleMatch[1].trim() : new URL(url).hostnameconst title =- rawTitle.length > 100 ? rawTitle.substring(0, 100) + '...' : rawTitle+ rawTitle.length > TITLE_CHARACTER_LIMIT+ ? rawTitle.substring(0, TITLE_CHARACTER_LIMIT) + '...'+ : rawTitle// Process HTML contentlet processedHtml = html@@ -145,7 +148,7 @@ async function fetchTavilyExtractData(return {results: [{- title: content.slice(0, 100),+ title: content.slice(0, TITLE_CHARACTER_LIMIT),content,url: result.url}