bug fixes, and performance improvements, and drawer
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { Result } from "../../types/result";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { z } from "zod";
|
||||
import { Err, Ok } from "../../types/result";
|
||||
|
||||
@@ -20,6 +21,7 @@ export const searchOutputSchema = z.object({
|
||||
results: z.array(z.object({
|
||||
title: z.string(),
|
||||
link: z.string(),
|
||||
sourceId: z.string().describe('Copy this exact ID into [[cite:ID]]. The literal "cite:" prefix is required; [[ID]] is invalid.').optional(),
|
||||
snippet: z.string(),
|
||||
})),
|
||||
warnings: z.array(z.object({ engine: z.string(), reason: z.string() })),
|
||||
@@ -43,6 +45,7 @@ export const readSearchResponse = (body: unknown): Result<SearchOutput, string>
|
||||
}
|
||||
return Ok({
|
||||
results: parsed.data.results.map(item => ({
|
||||
sourceId: `s${randomUUID().replaceAll("-", "")}`,
|
||||
title: item.title,
|
||||
link: item.url,
|
||||
snippet: item.content,
|
||||
|
||||
Reference in New Issue
Block a user