@cloudflare/ai-search-snippet 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.d.ts +13 -14
- package/dist/search-snippet.es.js +215 -122
- package/dist/search-snippet.es.js.map +1 -1
- package/dist/search-snippet.umd.js +152 -61
- package/dist/search-snippet.umd.js.map +1 -1
- package/package.json +9 -21
- package/README.md +0 -574
- package/dist/clouds.json +0 -417
- package/dist/favicon.ico +0 -0
- package/dist/vite.svg +0 -1
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare class AISearchClient
|
|
1
|
+
export declare class AISearchClient {
|
|
2
|
+
activeRequests: Map<string, RequestState>;
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
constructor(baseUrl: string);
|
|
2
5
|
private request;
|
|
3
6
|
/**
|
|
4
7
|
* Performs a search query with optional streaming
|
|
@@ -159,17 +162,6 @@ declare type ChatTextResponse = {
|
|
|
159
162
|
|
|
160
163
|
declare type ChatTypes = ChatResult | ChatTextResponse | ChatError;
|
|
161
164
|
|
|
162
|
-
declare class Client {
|
|
163
|
-
activeRequests: Map<string, RequestState>;
|
|
164
|
-
baseUrl: string;
|
|
165
|
-
constructor(baseUrl: string);
|
|
166
|
-
search(_query: string, _options?: SearchOptions): Promise<SearchResult[]>;
|
|
167
|
-
searchStream(_query: string, _options?: SearchOptions): AsyncGenerator<SearchResult | SearchError, void, undefined>;
|
|
168
|
-
chat(_message: string, _options?: SearchOptions): AsyncGenerator<ChatTypes, void, undefined>;
|
|
169
|
-
cancelRequest(_requestId: string): void;
|
|
170
|
-
cancelAllRequests(): void;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
165
|
declare interface Message {
|
|
174
166
|
id: string;
|
|
175
167
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -206,7 +198,7 @@ declare class SearchBarSnippet extends HTMLElement {
|
|
|
206
198
|
private handleInputKeydownEnter;
|
|
207
199
|
private handleInputKeydownEscape;
|
|
208
200
|
private handleSearchButtonClick;
|
|
209
|
-
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "debounce-ms", "theme", "hide-branding", "show-url"];
|
|
201
|
+
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "debounce-ms", "theme", "hide-branding", "show-url", "show-date", "hide-thumbnails", "see-more"];
|
|
210
202
|
constructor();
|
|
211
203
|
connectedCallback(): void;
|
|
212
204
|
disconnectedCallback(): void;
|
|
@@ -262,7 +254,7 @@ export declare class SearchModalSnippet extends HTMLElement {
|
|
|
262
254
|
private handleBackdropClick;
|
|
263
255
|
private savedBodyStyles;
|
|
264
256
|
private savedHtmlOverflow;
|
|
265
|
-
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "theme", "shortcut", "use-meta-key", "debounce-ms", "hide-branding", "show-url"];
|
|
257
|
+
static get observedAttributes(): readonly ["api-url", "placeholder", "max-results", "theme", "shortcut", "use-meta-key", "debounce-ms", "hide-branding", "show-url", "show-date", "hide-thumbnails", "see-more"];
|
|
266
258
|
constructor();
|
|
267
259
|
connectedCallback(): void;
|
|
268
260
|
disconnectedCallback(): void;
|
|
@@ -334,6 +326,7 @@ export declare interface SearchResult {
|
|
|
334
326
|
id: string;
|
|
335
327
|
title: string;
|
|
336
328
|
description: string;
|
|
329
|
+
timestamp?: number;
|
|
337
330
|
url?: string;
|
|
338
331
|
image?: string;
|
|
339
332
|
metadata?: Record<string, unknown>;
|
|
@@ -358,6 +351,12 @@ export declare interface SearchSnippetProps {
|
|
|
358
351
|
hideBranding?: boolean;
|
|
359
352
|
/** Show URL in search results (default: false) */
|
|
360
353
|
showUrl?: boolean;
|
|
354
|
+
/** Show date in search results when timestamp is present (default: false) */
|
|
355
|
+
showDate?: boolean;
|
|
356
|
+
/** Hide thumbnails in search results (default: false) */
|
|
357
|
+
hideThumbnails?: boolean;
|
|
358
|
+
/** URL template for "See more" link. The search query is appended URL-encoded. Example: "https://example.com/search?q=" */
|
|
359
|
+
seeMore?: string;
|
|
361
360
|
}
|
|
362
361
|
|
|
363
362
|
/**
|