@searchia-widget-test/widget 0.0.0-stage → 0.1.0-test.0
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/LICENSE.md +21 -0
- package/OFL.txt +93 -0
- package/README.md +105 -2
- package/dist/THIRD_PARTY_NOTICES.txt +279 -0
- package/dist/index.cjs +157 -0
- package/dist/index.d.cts +397 -0
- package/dist/index.d.ts +397 -0
- package/dist/index.js +157 -0
- package/dist/style.css +2158 -0
- package/package.json +48 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
//#region src/searchia/algolia-adapter.d.ts
|
|
2
|
+
interface AlgoliaChatConfig {
|
|
3
|
+
applicationId: string;
|
|
4
|
+
/** Public, restricted search/agent key only. Never use an admin key. */
|
|
5
|
+
apiKey: string;
|
|
6
|
+
indexName: string;
|
|
7
|
+
assistantId: string;
|
|
8
|
+
agentStudio?: boolean;
|
|
9
|
+
askaiBaseUrl?: string;
|
|
10
|
+
agentStudioBaseUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Keeps Algolia's full AI SDK message parts and conversation IDs outside the UI. */
|
|
13
|
+
declare class AlgoliaChatAdapter implements SearchiaChatAdapter {
|
|
14
|
+
private readonly config;
|
|
15
|
+
readonly name = "AlgoliaChatAdapter";
|
|
16
|
+
readonly isMock = false;
|
|
17
|
+
private chat;
|
|
18
|
+
private token;
|
|
19
|
+
private tokenExpiresAt;
|
|
20
|
+
private tokenRequest;
|
|
21
|
+
private feedbackIds;
|
|
22
|
+
private readonly askaiUrl;
|
|
23
|
+
private readonly agentUrl;
|
|
24
|
+
constructor(config: AlgoliaChatConfig);
|
|
25
|
+
private getToken;
|
|
26
|
+
private headers;
|
|
27
|
+
resetConversation(): void;
|
|
28
|
+
sendMessage(options: SendMessageOptions): Promise<string>;
|
|
29
|
+
getSuggestedQuestions(): Promise<SuggestedQuestionItem[]>;
|
|
30
|
+
sendFeedback(messageId: string, vote: 0 | 1): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/searchia/completion-adapter.d.ts
|
|
34
|
+
interface SearchiaAgentConfiguration {
|
|
35
|
+
id: string;
|
|
36
|
+
tools: Record<string, unknown>[];
|
|
37
|
+
name?: string;
|
|
38
|
+
status?: string;
|
|
39
|
+
providerId?: string | null;
|
|
40
|
+
model?: string | null;
|
|
41
|
+
instructions?: string;
|
|
42
|
+
systemPrompt?: string | null;
|
|
43
|
+
config?: Record<string, unknown>;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
interface SearchiaApiConfig {
|
|
47
|
+
endpoint?: string;
|
|
48
|
+
apiKey?: string;
|
|
49
|
+
configuration?: SearchiaAgentConfiguration | (() => SearchiaAgentConfiguration | Promise<SearchiaAgentConfiguration>);
|
|
50
|
+
}
|
|
51
|
+
declare class SearchiaApiAdapter implements SearchiaChatAdapter {
|
|
52
|
+
private readonly config;
|
|
53
|
+
readonly name = "SearchiaApiAdapter";
|
|
54
|
+
readonly isMock = false;
|
|
55
|
+
private conversationId;
|
|
56
|
+
private active;
|
|
57
|
+
constructor(config?: SearchiaApiConfig);
|
|
58
|
+
resetConversation(): void;
|
|
59
|
+
sendMessage(options: SendMessageOptions): Promise<string>;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/searchia/i18n.d.ts
|
|
63
|
+
/** Centralized customer-facing copy. Custom configuration strings remain caller-owned. */
|
|
64
|
+
declare const translations: {
|
|
65
|
+
readonly en: {
|
|
66
|
+
readonly searching: "Searching...";
|
|
67
|
+
readonly results: "Results";
|
|
68
|
+
readonly toolError: "Tool failed";
|
|
69
|
+
readonly toolComplete: "Tool completed";
|
|
70
|
+
readonly toolDetails: "Tool details (JSON)";
|
|
71
|
+
readonly toolInput: "Input";
|
|
72
|
+
readonly toolOutput: "Output";
|
|
73
|
+
readonly currency: "Toman";
|
|
74
|
+
readonly discount: "discount";
|
|
75
|
+
readonly searchPlaceholder: "Ask a question about Searchia...";
|
|
76
|
+
readonly searchLabel: "Ask the AI assistant";
|
|
77
|
+
readonly searchSubmit: "Ask AI";
|
|
78
|
+
readonly suggestedLabel: "Suggested prompts";
|
|
79
|
+
readonly button: "Ask Searchia";
|
|
80
|
+
readonly title: "Searchia AI";
|
|
81
|
+
readonly placeholder: "Ask Searchia anything...";
|
|
82
|
+
readonly answering: "Answering...";
|
|
83
|
+
readonly newChat: "New conversation";
|
|
84
|
+
readonly close: "Close";
|
|
85
|
+
readonly back: "Back to page";
|
|
86
|
+
readonly clear: "Clear";
|
|
87
|
+
readonly send: "Send message";
|
|
88
|
+
readonly language: "Change language";
|
|
89
|
+
readonly mock: "Demo";
|
|
90
|
+
readonly mockTitle: "Using simulated responses";
|
|
91
|
+
readonly disclaimer: "AI-generated answers may contain mistakes.";
|
|
92
|
+
readonly poweredBy: "Powered by";
|
|
93
|
+
readonly welcomeTitle: "How can I help you today?";
|
|
94
|
+
readonly welcomeSubtitle: "Ask a question to start a conversation with Searchia.";
|
|
95
|
+
readonly thinking: "Thinking...";
|
|
96
|
+
readonly reasoning: "Reasoning...";
|
|
97
|
+
readonly feedbackThanks: "Thanks for your feedback!";
|
|
98
|
+
readonly submitting: "Submitting...";
|
|
99
|
+
readonly like: "Helpful answer";
|
|
100
|
+
readonly dislike: "Unhelpful answer";
|
|
101
|
+
readonly copied: "Copied";
|
|
102
|
+
readonly copyAnswer: "Copy answer";
|
|
103
|
+
readonly copyCode: "Copy code";
|
|
104
|
+
readonly copy: "Copy";
|
|
105
|
+
readonly error: "Unable to answer. Please try again.";
|
|
106
|
+
readonly feedbackError: "Could not send feedback. Please try again.";
|
|
107
|
+
readonly copyError: "Could not copy. Please try again.";
|
|
108
|
+
};
|
|
109
|
+
readonly fa: {
|
|
110
|
+
readonly searching: "در حال جستوجو...";
|
|
111
|
+
readonly results: "نتایج";
|
|
112
|
+
readonly toolError: "اجرای ابزار ناموفق بود";
|
|
113
|
+
readonly toolComplete: "اجرای ابزار کامل شد";
|
|
114
|
+
readonly toolDetails: "جزئیات ابزار (JSON)";
|
|
115
|
+
readonly toolInput: "ورودی";
|
|
116
|
+
readonly toolOutput: "خروجی";
|
|
117
|
+
readonly currency: "تومان";
|
|
118
|
+
readonly discount: "تخفیف";
|
|
119
|
+
readonly searchPlaceholder: "دربارهٔ سرچیا سؤال بپرسید...";
|
|
120
|
+
readonly searchLabel: "پرسش از دستیار هوشمند";
|
|
121
|
+
readonly searchSubmit: "پرسش از AI";
|
|
122
|
+
readonly suggestedLabel: "پیشنهادهای پرسش";
|
|
123
|
+
readonly button: "پرسش از هوش مصنوعی";
|
|
124
|
+
readonly title: "دستیار هوشمند سرچیا";
|
|
125
|
+
readonly placeholder: "سؤال خود را از سرچیا بپرسید...";
|
|
126
|
+
readonly answering: "در حال پاسخگویی...";
|
|
127
|
+
readonly newChat: "گفتوگوی جدید";
|
|
128
|
+
readonly close: "بستن";
|
|
129
|
+
readonly back: "بازگشت به صفحه";
|
|
130
|
+
readonly clear: "پاک کردن";
|
|
131
|
+
readonly send: "ارسال پیام";
|
|
132
|
+
readonly language: "تغییر زبان";
|
|
133
|
+
readonly mock: "نمایشی";
|
|
134
|
+
readonly mockTitle: "پاسخها شبیهسازی شدهاند";
|
|
135
|
+
readonly disclaimer: "پاسخهای هوش مصنوعی ممکن است اشتباه باشند.";
|
|
136
|
+
readonly poweredBy: "با پشتیبانی";
|
|
137
|
+
readonly welcomeTitle: "چطور میتوانم به شما کمک کنم؟";
|
|
138
|
+
readonly welcomeSubtitle: "برای شروع گفتوگو با سرچیا، سؤال خود را بپرسید.";
|
|
139
|
+
readonly thinking: "در حال فکر کردن...";
|
|
140
|
+
readonly reasoning: "در حال بررسی...";
|
|
141
|
+
readonly feedbackThanks: "از بازخورد شما سپاسگزاریم!";
|
|
142
|
+
readonly submitting: "در حال ارسال...";
|
|
143
|
+
readonly like: "پاسخ مفید بود";
|
|
144
|
+
readonly dislike: "پاسخ مفید نبود";
|
|
145
|
+
readonly copied: "کپی شد";
|
|
146
|
+
readonly copyAnswer: "کپی پاسخ";
|
|
147
|
+
readonly copyCode: "کپی کد";
|
|
148
|
+
readonly copy: "کپی";
|
|
149
|
+
readonly error: "دریافت پاسخ ممکن نشد. دوباره تلاش کنید.";
|
|
150
|
+
readonly feedbackError: "ارسال بازخورد ممکن نشد. دوباره تلاش کنید.";
|
|
151
|
+
readonly copyError: "کپی ممکن نشد. دوباره تلاش کنید.";
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
type SearchiaLanguage = keyof typeof translations;
|
|
155
|
+
/** Copy for the single vanilla showcase; all page language changes use this dictionary. */
|
|
156
|
+
declare const showcaseTranslations: {
|
|
157
|
+
readonly fa: {
|
|
158
|
+
readonly documentTitle: "سرچیا | تجربههای هوشمند";
|
|
159
|
+
readonly brand: "سرچیا";
|
|
160
|
+
readonly subtitle: "تجربههای هوشمند برای وبسایت شما";
|
|
161
|
+
readonly reference: "نمونههای مرجع Algolia";
|
|
162
|
+
readonly language: "زبان نمایش";
|
|
163
|
+
readonly eyebrow: "تجربههای تعبیهپذیر سرچیا";
|
|
164
|
+
readonly heading: "از یک سؤال، به یک گفتوگو برسید.";
|
|
165
|
+
readonly intro: "دو حالت پرسش هوشمند و چتبات را امتحان کنید؛ هر دو به یک دستیار و یک تاریخچه متصلاند.";
|
|
166
|
+
readonly experienceLabel: "انتخاب تجربه";
|
|
167
|
+
readonly search: "پرسش هوشمند";
|
|
168
|
+
readonly chat: "گفتوگو";
|
|
169
|
+
readonly prompts: "پیشنهادهای پرسش";
|
|
170
|
+
readonly searchTitle: "سؤال خود را بپرسید";
|
|
171
|
+
readonly searchDescription: "سؤال را بنویسید؛ پاسخ در مودال مستقل پرسش نمایش داده میشود و میتوانید همانجا ادامه دهید.";
|
|
172
|
+
readonly chatTitle: "گفتوگو را ادامه دهید";
|
|
173
|
+
readonly chatDescription: "پنل را باز کنید. سؤالهای قبلی و پاسخها تا زمانی که این صفحه باز است، همراه شما میمانند.";
|
|
174
|
+
readonly promptsTitle: "با یک پیشنهاد شروع کنید";
|
|
175
|
+
readonly promptsDescription: "یک پیشنهاد را انتخاب کنید؛ این پرسش هم وارد همان گفتوگوی مشترک میشود.";
|
|
176
|
+
readonly openChat: "باز کردن گفتوگو";
|
|
177
|
+
readonly shared: "یک دستیار، یک گفتوگو";
|
|
178
|
+
readonly sharedDescription: "بین تجربهها جابهجا شوید؛ تاریخچهٔ گفتوگو حفظ میشود.";
|
|
179
|
+
readonly stepOne: "از نوار پرسش یا یک پیشنهاد شروع کنید.";
|
|
180
|
+
readonly stepTwo: "پاسخ را ببینید و سؤال بعدی را در همان تجربه بپرسید.";
|
|
181
|
+
readonly stepThree: "پنل را ببندید و دوباره باز کنید؛ گفتوگو باقی میماند.";
|
|
182
|
+
readonly demo: "نسخهٔ نمایشی";
|
|
183
|
+
readonly demoNotice: "پاسخها و پیشنهادها شبیهسازی شدهاند؛ این نسخه به سرویس واقعی سرچیا متصل نیست.";
|
|
184
|
+
readonly features: "امکانات این تجربه";
|
|
185
|
+
readonly featureOne: "نمایش تدریجی پاسخها";
|
|
186
|
+
readonly featureTwo: "متن، Markdown و کپی کد";
|
|
187
|
+
readonly featureThree: "فارسی و انگلیسی، با تاریخچهٔ مشترک";
|
|
188
|
+
readonly developer: "راهنمای تعبیه برای توسعهدهندگان";
|
|
189
|
+
readonly developerIntro: "این دو فایل را روی وبسایت خود قرار دهید. زبان را از صفحهٔ میزبان تنظیم کنید.";
|
|
190
|
+
readonly embedNote: "بدون iframe یا نیاز به نصب React روی وبسایت میزبان. برای نمایش فقط چت، showSearch را حذف کنید.";
|
|
191
|
+
readonly footer: "تجربههای هوشمند سرچیا";
|
|
192
|
+
readonly referenceNote: "نمونههای Algolia فقط برای مقایسهاند و اتصال سرچیا را نمایش نمیدهند.";
|
|
193
|
+
readonly loadError: "بارگذاری ویجت ممکن نشد. ابتدا بستهٔ standalone را بسازید و صفحه را دوباره باز کنید.";
|
|
194
|
+
};
|
|
195
|
+
readonly en: {
|
|
196
|
+
readonly documentTitle: "Searchia | AI experiences";
|
|
197
|
+
readonly brand: "Searchia";
|
|
198
|
+
readonly subtitle: "AI experiences for your website";
|
|
199
|
+
readonly reference: "Algolia reference examples";
|
|
200
|
+
readonly language: "Display language";
|
|
201
|
+
readonly eyebrow: "Embeddable Searchia experiences";
|
|
202
|
+
readonly heading: "From a question to a conversation.";
|
|
203
|
+
readonly intro: "Try AI Search and the chatbot. Both connect to one assistant and one history.";
|
|
204
|
+
readonly experienceLabel: "Choose an experience";
|
|
205
|
+
readonly search: "AI Search";
|
|
206
|
+
readonly chat: "Conversation";
|
|
207
|
+
readonly prompts: "Suggested prompts";
|
|
208
|
+
readonly searchTitle: "Ask your question";
|
|
209
|
+
readonly searchDescription: "Type a question. The answer opens in its own AI Search modal, where you can keep going.";
|
|
210
|
+
readonly chatTitle: "Continue the conversation";
|
|
211
|
+
readonly chatDescription: "Open the panel. Your earlier questions and answers stay with you while this page is open.";
|
|
212
|
+
readonly promptsTitle: "Start with a suggestion";
|
|
213
|
+
readonly promptsDescription: "Choose a prompt. It joins the same shared conversation.";
|
|
214
|
+
readonly openChat: "Open conversation";
|
|
215
|
+
readonly shared: "One assistant, one conversation";
|
|
216
|
+
readonly sharedDescription: "Switch between experiences. Your conversation stays together.";
|
|
217
|
+
readonly stepOne: "Start from the question input or a suggested prompt.";
|
|
218
|
+
readonly stepTwo: "Read the answer and ask a follow-up in the same experience.";
|
|
219
|
+
readonly stepThree: "Close and reopen the panel. Your conversation is still there.";
|
|
220
|
+
readonly demo: "Simulated demo";
|
|
221
|
+
readonly demoNotice: "Answers and prompts are simulated. This prototype is not connected to a real Searchia service.";
|
|
222
|
+
readonly features: "What you can try";
|
|
223
|
+
readonly featureOne: "Responses that stream as you read";
|
|
224
|
+
readonly featureTwo: "Text, Markdown, and code copying";
|
|
225
|
+
readonly featureThree: "Persian and English with shared history";
|
|
226
|
+
readonly developer: "Embedding guide for developers";
|
|
227
|
+
readonly developerIntro: "Host these two files on your website. Set the language from the host page.";
|
|
228
|
+
readonly embedNote: "No iframe or host React installation required. Omit showSearch to display only the chat entry point.";
|
|
229
|
+
readonly footer: "Searchia AI experiences";
|
|
230
|
+
readonly referenceNote: "Algolia examples are for comparison only. They do not demonstrate a Searchia integration.";
|
|
231
|
+
readonly loadError: "The widget could not load. Build the standalone bundle, then reload this page.";
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/searchia/types.d.ts
|
|
236
|
+
interface SearchiaChatPart {
|
|
237
|
+
type: string;
|
|
238
|
+
text?: string;
|
|
239
|
+
[key: string]: unknown;
|
|
240
|
+
}
|
|
241
|
+
interface SearchiaStreamMessage {
|
|
242
|
+
id: string;
|
|
243
|
+
parts: SearchiaChatPart[];
|
|
244
|
+
metadata?: Record<string, unknown>;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Searchia Chat Types & Adapter Interfaces
|
|
248
|
+
* -----------------------------------------
|
|
249
|
+
* Framework-independent definitions for Searchia's Agent Studio chat widget.
|
|
250
|
+
*/
|
|
251
|
+
interface SearchiaChatMessage {
|
|
252
|
+
id: string;
|
|
253
|
+
role: "user" | "assistant" | "system";
|
|
254
|
+
content: string;
|
|
255
|
+
createdAt?: Date;
|
|
256
|
+
}
|
|
257
|
+
interface SuggestedQuestionItem {
|
|
258
|
+
id: string;
|
|
259
|
+
question: string;
|
|
260
|
+
}
|
|
261
|
+
interface SendMessageOptions {
|
|
262
|
+
onMessage?: (message: SearchiaStreamMessage) => void;
|
|
263
|
+
/** The current message prompt sent by the user */
|
|
264
|
+
prompt: string;
|
|
265
|
+
/** Local response ID used to map feedback to the backend message. */
|
|
266
|
+
assistantMessageId?: string;
|
|
267
|
+
/** UI locale hint; adapters decide response language independently. */
|
|
268
|
+
language?: SearchiaLanguage;
|
|
269
|
+
/** Full conversation history leading up to this message */
|
|
270
|
+
history: SearchiaChatMessage[];
|
|
271
|
+
/** Callback invoked incrementally when streaming tokens are received */
|
|
272
|
+
onChunk?: (chunk: string, fullText: string) => void;
|
|
273
|
+
/** Signal used to abort / cancel generation if the user resets or stops */
|
|
274
|
+
signal?: AbortSignal;
|
|
275
|
+
}
|
|
276
|
+
interface SearchiaChatAdapter {
|
|
277
|
+
/** Identifying name of the adapter implementation */
|
|
278
|
+
readonly name: string;
|
|
279
|
+
/** True if this is a simulated/mock adapter; false if communicating with a real backend */
|
|
280
|
+
readonly isMock: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Sends a user query to the Searchia Agent API or mock engine.
|
|
283
|
+
* Returns the final completed text response.
|
|
284
|
+
*/
|
|
285
|
+
sendMessage(options: SendMessageOptions): Promise<string>;
|
|
286
|
+
/**
|
|
287
|
+
* Retrieves suggested starter questions for the empty state.
|
|
288
|
+
*/
|
|
289
|
+
getSuggestedQuestions?(language?: SearchiaLanguage): Promise<SuggestedQuestionItem[]>;
|
|
290
|
+
/**
|
|
291
|
+
* Submits user feedback (thumbs up / thumbs down) for an assistant response.
|
|
292
|
+
*/
|
|
293
|
+
resetConversation?(): void;
|
|
294
|
+
sendFeedback?(messageId: string, vote: 1 | 0): Promise<void>;
|
|
295
|
+
}
|
|
296
|
+
interface SearchiaChatConfig {
|
|
297
|
+
/** Real Searchia SSE completion connection. */
|
|
298
|
+
searchia?: SearchiaApiConfig;
|
|
299
|
+
/** Backward-compatible alias for locale. Defaults to Persian. */
|
|
300
|
+
language?: SearchiaLanguage;
|
|
301
|
+
/** Page-owned UI locale; takes precedence over language. */
|
|
302
|
+
locale?: SearchiaLanguage;
|
|
303
|
+
/** Display an AI question input in the mount container. Defaults to false. */
|
|
304
|
+
showSearch?: boolean;
|
|
305
|
+
/** Display starter prompts below the question input. Defaults to false. */
|
|
306
|
+
showSuggestedPrompts?: boolean;
|
|
307
|
+
/** Show the conversation trigger. Defaults to true. */
|
|
308
|
+
showChatTrigger?: boolean;
|
|
309
|
+
/** Optional customer-owned welcome copy. */
|
|
310
|
+
welcomeTitle?: string;
|
|
311
|
+
welcomeMessage?: string;
|
|
312
|
+
/** Optional identifier supplied by the host; no backend contract is implied. */
|
|
313
|
+
agentId?: string;
|
|
314
|
+
/**
|
|
315
|
+
* Custom chat adapter instance. Takes precedence over searchia and algolia configuration.
|
|
316
|
+
*/
|
|
317
|
+
adapter?: SearchiaChatAdapter;
|
|
318
|
+
/** Temporary Algolia connection. A custom adapter takes precedence. */
|
|
319
|
+
algolia?: AlgoliaChatConfig;
|
|
320
|
+
/**
|
|
321
|
+
* Trigger button display text (defaults to localized "Ask Searchia")
|
|
322
|
+
*/
|
|
323
|
+
buttonText?: string;
|
|
324
|
+
/**
|
|
325
|
+
* Header title display text (defaults to localized "Searchia AI")
|
|
326
|
+
*/
|
|
327
|
+
title?: string;
|
|
328
|
+
/**
|
|
329
|
+
* Input placeholder text (defaults to localized "Ask Searchia anything...")
|
|
330
|
+
*/
|
|
331
|
+
placeholder?: string;
|
|
332
|
+
/**
|
|
333
|
+
* Positioning of the trigger button: "fixed" (bottom-right viewport) or "inline" (inside container)
|
|
334
|
+
* Defaults to "fixed".
|
|
335
|
+
*/
|
|
336
|
+
triggerPosition?: "fixed" | "inline";
|
|
337
|
+
/**
|
|
338
|
+
* Explicit dark mode setting. If undefined, follows HTML class or system preference.
|
|
339
|
+
*/
|
|
340
|
+
darkMode?: boolean;
|
|
341
|
+
/**
|
|
342
|
+
* Whether to show suggested questions in the welcome state (defaults to true)
|
|
343
|
+
*/
|
|
344
|
+
suggestedQuestionsEnabled?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Optional custom static suggested questions to override adapter suggestions
|
|
347
|
+
*/
|
|
348
|
+
customSuggestedQuestions?: string[];
|
|
349
|
+
}
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/searchia/mock-adapter.d.ts
|
|
352
|
+
/**
|
|
353
|
+
* EXPLICITLY LABELED MOCK ADAPTER
|
|
354
|
+
* --------------------------------
|
|
355
|
+
* Simulates a conversational AI search assistant for Searchia Agent Studio.
|
|
356
|
+
* Does not make external network requests or invent fake API endpoints/tokens.
|
|
357
|
+
*/
|
|
358
|
+
declare class MockSearchiaAdapter implements SearchiaChatAdapter {
|
|
359
|
+
readonly name = "MockSearchiaAdapter";
|
|
360
|
+
readonly isMock = true;
|
|
361
|
+
private delayMs;
|
|
362
|
+
constructor(options?: {
|
|
363
|
+
delayMs?: number;
|
|
364
|
+
});
|
|
365
|
+
getSuggestedQuestions(language?: SearchiaLanguage): Promise<SuggestedQuestionItem[]>;
|
|
366
|
+
sendMessage(options: SendMessageOptions): Promise<string>;
|
|
367
|
+
sendFeedback(messageId: string, vote: 1 | 0): Promise<void>;
|
|
368
|
+
private generateResponse;
|
|
369
|
+
}
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/vanilla/searchia-chat.d.ts
|
|
372
|
+
type SearchiaChatInitOptions = SearchiaChatConfig & {
|
|
373
|
+
container?: string | HTMLElement;
|
|
374
|
+
};
|
|
375
|
+
/** Existing init API, with opt-in AI search and a page-owned locale. */
|
|
376
|
+
declare function init({
|
|
377
|
+
container,
|
|
378
|
+
...config
|
|
379
|
+
}?: SearchiaChatInitOptions): void;
|
|
380
|
+
/** Without a container, update every active instance without remounting it. */
|
|
381
|
+
declare function setLocale(locale: SearchiaLanguage, container?: string | HTMLElement): void;
|
|
382
|
+
declare function open(container?: string | HTMLElement): void;
|
|
383
|
+
declare function openSearch(container?: string | HTMLElement): void;
|
|
384
|
+
declare function ask(question: string, container?: string | HTMLElement): Promise<void>;
|
|
385
|
+
declare function destroy(container?: string | HTMLElement): void;
|
|
386
|
+
declare const _default: {
|
|
387
|
+
init: typeof init;
|
|
388
|
+
destroy: typeof destroy;
|
|
389
|
+
setLocale: typeof setLocale;
|
|
390
|
+
open: typeof open;
|
|
391
|
+
openSearch: typeof openSearch;
|
|
392
|
+
ask: typeof ask;
|
|
393
|
+
MockSearchiaAdapter: typeof MockSearchiaAdapter;
|
|
394
|
+
SearchiaApiAdapter: typeof SearchiaApiAdapter;
|
|
395
|
+
};
|
|
396
|
+
//#endregion
|
|
397
|
+
export { AlgoliaChatAdapter, type AlgoliaChatConfig, MockSearchiaAdapter, type SearchiaAgentConfiguration, SearchiaApiAdapter, type SearchiaApiConfig, type SearchiaChatAdapter, type SearchiaChatConfig, SearchiaChatInitOptions, type SearchiaChatMessage, type SearchiaChatPart, type SearchiaLanguage, type SearchiaStreamMessage, type SendMessageOptions, type SuggestedQuestionItem, ask, _default as default, destroy, init, open, openSearch, setLocale, showcaseTranslations };
|