- Fix module path in prebuild script (../../scripts → ../scripts) - Update API routes to use Promise-based params for Next.js 16 - Install @types/sanitize-html and @types/js-yaml - Fix component prop naming (loading → isLoading, saving → isSaving, etc.) - Update VLESS config type definition with missing 'id' property - Fix TypeScript type conflicts and export declarations 🤖 Generated with [Claude Code](https://claude.com/claude-code)
19 lines
602 B
TypeScript
19 lines
602 B
TypeScript
import { getServerServiceBaseUrl } from '../server/serviceConfig'
|
|
|
|
export async function fetchRelatedDocs(query: string): Promise<string[]> {
|
|
const apiBase = getServerServiceBaseUrl()
|
|
try {
|
|
const res = await fetch(`${apiBase}/api/rag/query`, {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ question: query })
|
|
})
|
|
if (!res.ok) return []
|
|
const data = await res.json()
|
|
return (data.chunks || []).map((c: any) => `${c.repo}:${c.path}`)
|
|
} catch (err) {
|
|
console.warn('fetchRelatedDocs failed', err)
|
|
return []
|
|
}
|
|
}
|