research-agent-ui 0.1.293 → 0.1.295
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/README.md +42 -1
- package/dist/ArticleExtractPanel-BPNXuezE.js +389 -0
- package/dist/ArticleExtractPanel-DAPLUpyx.cjs +2 -0
- package/dist/ChatConversationThread-D1RR0Bcx.cjs +17 -0
- package/dist/ChatConversationThread-DMPdu2sr.js +1428 -0
- package/dist/DownloadsDialog-CCPj0hA8.cjs +1 -0
- package/dist/{DownloadsDialog-bTEDe2DI.js → DownloadsDialog-DvS23Dh-.js} +8 -9
- package/dist/api/handlers/autocomplete.d.ts +6 -9
- package/dist/api/handlers/openai-transcription.d.ts +53 -0
- package/dist/api/handlers/transcript.d.ts +33 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api.cjs +10 -10
- package/dist/api.mjs +373 -182
- package/dist/app/index.d.ts +1 -1
- package/dist/app/useChunkErrorReload.d.ts +13 -2
- package/dist/components/ArticleReader/ArticleReaderMount.d.ts +5 -0
- package/dist/components/ArticleReader/ExtractPanelContext.d.ts +17 -1
- package/dist/components/ChatConversation/MessageBubble/AssistantMessageActions.d.ts +2 -1
- package/dist/components/ChatConversation/background-art.d.ts +3 -1
- package/dist/components/ChatConversation/background-cache.d.ts +41 -0
- package/dist/components/Footer.d.ts +5 -4
- package/dist/components/Footer.stories.d.ts +3 -3
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.mjs +4 -3
- package/dist/dialog-7GDz0sWx.cjs +1 -0
- package/dist/dialog-Cufn2u50.js +80 -0
- package/dist/hooks/voice/useKokoroTTS.d.ts +2 -0
- package/dist/hooks/voice/useTextToVoice.d.ts +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +4 -2
- package/dist/lib/file-sources.d.ts +8 -0
- package/dist/lib/google-drive-source.d.ts +100 -0
- package/dist/lib/kokoro.d.ts +14 -2
- package/dist/lib/qwksearch-connect.d.ts +79 -0
- package/dist/settings/index.d.ts +15 -0
- package/dist/src-BqV2Vwpv.js +6375 -0
- package/dist/src-Ckb1ciEL.cjs +34 -0
- package/dist/tooltip-Bl3IdX-I.js +179 -0
- package/dist/tooltip-DmUO6ZUz.cjs +1 -0
- package/dist/types/fileSource.d.ts +9 -0
- package/dist/workspace/QwkSearchWorkspaceApp.d.ts +9 -2
- package/dist/workspace/ResearchWorkspaceView.d.ts +18 -4
- package/dist/workspace.cjs +1 -1
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.mjs +234 -91
- package/package.json +53 -50
- package/src/app/useChunkErrorReload.ts +92 -0
- package/src/settings/index.ts +23 -0
- package/src/settings/search.json +19 -1
- package/dist/DownloadsDialog-Ca6aRRcP.cjs +0 -1
- package/dist/src-HL9JjPc-.js +0 -8218
- package/dist/src-r4BsCIB4.cjs +0 -51
package/dist/api.mjs
CHANGED
|
@@ -3,15 +3,14 @@ import t from "chat-agent-toolkit/models/registry";
|
|
|
3
3
|
import { and as n, count as r, eq as i, inArray as a, like as o, max as s, or as c, sql as l } from "drizzle-orm";
|
|
4
4
|
import u from "chat-agent-toolkit/tools/search/titleGeneratorAgent";
|
|
5
5
|
import { searchSearxng as d, searchWeb as f } from "search-web-api/search/public-searxng";
|
|
6
|
-
import
|
|
7
|
-
import m from "
|
|
8
|
-
import
|
|
9
|
-
import g from "
|
|
10
|
-
import _ from "chat-agent-toolkit/
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function b(n) {
|
|
6
|
+
import p from "fuse.js";
|
|
7
|
+
import { parse as m } from "tldts";
|
|
8
|
+
import h from "domain-rank/data/domain-rank-merged.json";
|
|
9
|
+
import g from "chat-agent-toolkit/tools/search/suggestionGeneratorAgent";
|
|
10
|
+
import { testProviderModels as _ } from "chat-agent-toolkit/config/model-tester";
|
|
11
|
+
import { LANGUAGE_MODELS as v } from "chat-agent-toolkit/config/language-models-database";
|
|
12
|
+
// src/api/handlers/article-followups.ts
|
|
13
|
+
function y(n) {
|
|
15
14
|
return async (n) => {
|
|
16
15
|
try {
|
|
17
16
|
let { article: r, chatHistory: i = [], maxQuestions: a = 5, chatModel: o } = await n.json();
|
|
@@ -31,13 +30,8 @@ ${l}
|
|
|
31
30
|
|
|
32
31
|
Generate ${a} follow-up questions that would help readers dive deeper into this article.`, { text: f } = await e({
|
|
33
32
|
model: c,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
content: u
|
|
37
|
-
}, {
|
|
38
|
-
role: "user",
|
|
39
|
-
content: d
|
|
40
|
-
}]
|
|
33
|
+
instructions: u,
|
|
34
|
+
prompt: d
|
|
41
35
|
}), p = f.split("\n").map((e) => e.trim()).filter((e) => e.length > 0).map((e) => e.replace(/^[\d\-\*\.\)]+\s*/, "").trim()).filter((e) => e.length > 10).slice(0, a);
|
|
42
36
|
return Response.json({
|
|
43
37
|
extract: p,
|
|
@@ -51,9 +45,8 @@ Generate ${a} follow-up questions that would help readers dive deeper into this
|
|
|
51
45
|
}
|
|
52
46
|
};
|
|
53
47
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function x(n) {
|
|
48
|
+
// src/api/handlers/page-tips.ts
|
|
49
|
+
function b(n) {
|
|
57
50
|
return async (n) => {
|
|
58
51
|
try {
|
|
59
52
|
let { title: r = "", content: i, maxTips: a = 4, chatModel: o } = await n.json();
|
|
@@ -73,13 +66,8 @@ ${i.slice(0, 15e3)}
|
|
|
73
66
|
|
|
74
67
|
Generate ${a} short tips about this page.`, { text: d } = await e({
|
|
75
68
|
model: c,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
content: l
|
|
79
|
-
}, {
|
|
80
|
-
role: "user",
|
|
81
|
-
content: u
|
|
82
|
-
}]
|
|
69
|
+
instructions: l,
|
|
70
|
+
prompt: u
|
|
83
71
|
}), f = d.split("\n").map((e) => e.trim()).filter((e) => e.length > 0).map((e) => e.replace(/^[\d\-\*\.\)]+\s*/, "").trim()).filter((e) => e.length > 10).slice(0, a);
|
|
84
72
|
return Response.json({
|
|
85
73
|
tips: f,
|
|
@@ -93,9 +81,8 @@ Generate ${a} short tips about this page.`, { text: d } = await e({
|
|
|
93
81
|
}
|
|
94
82
|
};
|
|
95
83
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
function S(n) {
|
|
84
|
+
// src/api/handlers/topic-searches.ts
|
|
85
|
+
function x(n) {
|
|
99
86
|
return async (n) => {
|
|
100
87
|
try {
|
|
101
88
|
let { title: r = "", content: i, maxTopics: a = 4, chatModel: o } = await n.json();
|
|
@@ -115,13 +102,8 @@ ${i.slice(0, 15e3)}
|
|
|
115
102
|
|
|
116
103
|
Generate ${a} short related search queries for this page.`, { text: d } = await e({
|
|
117
104
|
model: c,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
content: l
|
|
121
|
-
}, {
|
|
122
|
-
role: "user",
|
|
123
|
-
content: u
|
|
124
|
-
}]
|
|
105
|
+
instructions: l,
|
|
106
|
+
prompt: u
|
|
125
107
|
}), f = d.split("\n").map((e) => e.trim()).filter((e) => e.length > 0).map((e) => e.replace(/^[\d\-\*\.\)]+\s*/, "").trim()).filter((e) => e.length > 2).slice(0, a);
|
|
126
108
|
return Response.json({
|
|
127
109
|
topics: f,
|
|
@@ -135,9 +117,8 @@ Generate ${a} short related search queries for this page.`, { text: d } = await
|
|
|
135
117
|
}
|
|
136
118
|
};
|
|
137
119
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
function C(n) {
|
|
120
|
+
// src/api/handlers/article-qa.ts
|
|
121
|
+
function ee(n) {
|
|
141
122
|
return async (n) => {
|
|
142
123
|
try {
|
|
143
124
|
let { article: r, question: i, chatHistory: a = [], chatModel: o } = await n.json();
|
|
@@ -157,13 +138,8 @@ User question: ${i}
|
|
|
157
138
|
|
|
158
139
|
Please provide a helpful answer based on the article content above.`, { text: d } = await e({
|
|
159
140
|
model: c,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
content: "You are a helpful AI assistant that answers questions about articles.\nProvide clear, concise, and accurate answers based on the article content provided.\nIf the answer is not in the article, say so."
|
|
163
|
-
}, {
|
|
164
|
-
role: "user",
|
|
165
|
-
content: u
|
|
166
|
-
}]
|
|
141
|
+
instructions: "You are a helpful AI assistant that answers questions about articles.\nProvide clear, concise, and accurate answers based on the article content provided.\nIf the answer is not in the article, say so.",
|
|
142
|
+
prompt: u
|
|
167
143
|
});
|
|
168
144
|
return Response.json({
|
|
169
145
|
content: d,
|
|
@@ -177,9 +153,8 @@ Please provide a helpful answer based on the article content above.`, { text: d
|
|
|
177
153
|
}
|
|
178
154
|
};
|
|
179
155
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
function w(e) {
|
|
156
|
+
// src/api/handlers/chats.ts
|
|
157
|
+
function te(e) {
|
|
183
158
|
let { chats: t, messages: o } = e.schema;
|
|
184
159
|
return {
|
|
185
160
|
GET: async (a) => {
|
|
@@ -216,7 +191,7 @@ function w(e) {
|
|
|
216
191
|
}
|
|
217
192
|
};
|
|
218
193
|
}
|
|
219
|
-
function
|
|
194
|
+
function ne(e) {
|
|
220
195
|
let { chats: t, messages: r } = e.schema;
|
|
221
196
|
return {
|
|
222
197
|
GET: async (n, { params: a }) => {
|
|
@@ -249,7 +224,7 @@ function ee(e) {
|
|
|
249
224
|
}
|
|
250
225
|
};
|
|
251
226
|
}
|
|
252
|
-
function
|
|
227
|
+
function re(e) {
|
|
253
228
|
let { chats: t, messages: r } = e.schema;
|
|
254
229
|
return { GET: async (a) => {
|
|
255
230
|
try {
|
|
@@ -282,7 +257,7 @@ function te(e) {
|
|
|
282
257
|
}
|
|
283
258
|
} };
|
|
284
259
|
}
|
|
285
|
-
function
|
|
260
|
+
function ie(e) {
|
|
286
261
|
let { chats: t } = e.schema;
|
|
287
262
|
return { POST: async (n) => {
|
|
288
263
|
try {
|
|
@@ -320,9 +295,8 @@ function ne(e) {
|
|
|
320
295
|
}
|
|
321
296
|
} };
|
|
322
297
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
function T(e) {
|
|
298
|
+
// src/api/handlers/chat-title.ts
|
|
299
|
+
function ae(e) {
|
|
326
300
|
let { chats: n } = e.schema;
|
|
327
301
|
return { POST: async (r) => {
|
|
328
302
|
try {
|
|
@@ -346,24 +320,23 @@ function T(e) {
|
|
|
346
320
|
}
|
|
347
321
|
} };
|
|
348
322
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
var E = [
|
|
323
|
+
// src/api/handlers/messages.ts
|
|
324
|
+
var oe = [
|
|
352
325
|
"assistant",
|
|
353
326
|
"user",
|
|
354
327
|
"source",
|
|
355
328
|
"suggestion"
|
|
356
329
|
];
|
|
357
|
-
function
|
|
330
|
+
function S(e) {
|
|
358
331
|
let t = [], n = e;
|
|
359
332
|
for (let e = 0; n != null && e < 5; e++) t.push(n instanceof Error ? n.message : String(n)), n = n instanceof Error ? n.cause : void 0;
|
|
360
333
|
return t.join(" <- caused by: ");
|
|
361
334
|
}
|
|
362
|
-
function
|
|
335
|
+
function se(e) {
|
|
363
336
|
return { POST: async (t) => {
|
|
364
337
|
try {
|
|
365
338
|
let n = e.getDB(), r = await e.requireUserId(), { chatId: i, messageId: a, role: o, suggestions: s, content: c, sources: l } = await t.json();
|
|
366
|
-
return !i || !a || !o ? Response.json({ message: "Missing required fields" }, { status: 400 }) :
|
|
339
|
+
return !i || !a || !o ? Response.json({ message: "Missing required fields" }, { status: 400 }) : oe.includes(o) ? (await n.insert(e.messagesSchema).values({
|
|
367
340
|
chatId: i,
|
|
368
341
|
userId: r,
|
|
369
342
|
messageId: a,
|
|
@@ -374,13 +347,12 @@ function O(e) {
|
|
|
374
347
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
375
348
|
}), Response.json({ message: "Message saved successfully" }, { status: 200 })) : Response.json({ message: `Invalid role: ${o}` }, { status: 400 });
|
|
376
349
|
} catch (e) {
|
|
377
|
-
return console.error("Error saving message:",
|
|
350
|
+
return console.error("Error saving message:", S(e)), Response.json({ message: "Failed to save message" }, { status: 500 });
|
|
378
351
|
}
|
|
379
352
|
} };
|
|
380
353
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
function k(e) {
|
|
354
|
+
// src/api/handlers/providers.ts
|
|
355
|
+
function ce(e) {
|
|
384
356
|
return {
|
|
385
357
|
GET: async (n) => {
|
|
386
358
|
try {
|
|
@@ -410,7 +382,7 @@ function k(e) {
|
|
|
410
382
|
}
|
|
411
383
|
};
|
|
412
384
|
}
|
|
413
|
-
function
|
|
385
|
+
function C() {
|
|
414
386
|
return {
|
|
415
387
|
DELETE: async (e, { params: n }) => {
|
|
416
388
|
try {
|
|
@@ -432,7 +404,7 @@ function A() {
|
|
|
432
404
|
}
|
|
433
405
|
};
|
|
434
406
|
}
|
|
435
|
-
function
|
|
407
|
+
function le() {
|
|
436
408
|
return {
|
|
437
409
|
POST: async (e, { params: n }) => {
|
|
438
410
|
try {
|
|
@@ -452,9 +424,8 @@ function j() {
|
|
|
452
424
|
}
|
|
453
425
|
};
|
|
454
426
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
function M(e) {
|
|
427
|
+
// src/api/handlers/mcpservers.ts
|
|
428
|
+
function ue(e) {
|
|
458
429
|
return {
|
|
459
430
|
GET: async (t) => {
|
|
460
431
|
try {
|
|
@@ -476,7 +447,7 @@ function M(e) {
|
|
|
476
447
|
}
|
|
477
448
|
};
|
|
478
449
|
}
|
|
479
|
-
function
|
|
450
|
+
function de(e) {
|
|
480
451
|
return {
|
|
481
452
|
DELETE: async (t, { params: n }) => {
|
|
482
453
|
try {
|
|
@@ -498,7 +469,7 @@ function N(e) {
|
|
|
498
469
|
}
|
|
499
470
|
};
|
|
500
471
|
}
|
|
501
|
-
function
|
|
472
|
+
function fe(e) {
|
|
502
473
|
return { POST: async (t, { params: n }) => {
|
|
503
474
|
try {
|
|
504
475
|
let { enabled: r } = await t.json(), { id: i } = await n;
|
|
@@ -510,9 +481,8 @@ function P(e) {
|
|
|
510
481
|
}
|
|
511
482
|
} };
|
|
512
483
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
var F = {
|
|
484
|
+
// src/api/handlers/search.ts
|
|
485
|
+
var pe = {
|
|
516
486
|
tech: {
|
|
517
487
|
query: [
|
|
518
488
|
"technology news",
|
|
@@ -578,7 +548,7 @@ var F = {
|
|
|
578
548
|
]
|
|
579
549
|
}
|
|
580
550
|
};
|
|
581
|
-
function
|
|
551
|
+
function me(e = {}) {
|
|
582
552
|
let t = e.searxngDomain ?? "https://search.qwksearch.com";
|
|
583
553
|
return { GET: async (e) => {
|
|
584
554
|
let n = new URL(e.url).searchParams, r = n.get("q"), i = n.get("cat") || "general", a = parseInt(n.get("page") || "1", 10), o = Number.isFinite(a) && a > 0 ? a : 1, s = n.get("lang") || "en-US", c = n.get("safesearch") === "true", l = n.get("recency") || void 0, u = n.get("publicInstances") === "true";
|
|
@@ -626,10 +596,10 @@ function I(e = {}) {
|
|
|
626
596
|
}
|
|
627
597
|
} };
|
|
628
598
|
}
|
|
629
|
-
function
|
|
599
|
+
function he() {
|
|
630
600
|
return { GET: async (e) => {
|
|
631
601
|
try {
|
|
632
|
-
let t = new URL(e.url).searchParams, n = t.get("mode") || "normal", r =
|
|
602
|
+
let t = new URL(e.url).searchParams, n = t.get("mode") || "normal", r = pe[t.get("topic") || "tech"], i = [];
|
|
633
603
|
if (n === "normal") {
|
|
634
604
|
let e = /* @__PURE__ */ new Set();
|
|
635
605
|
i = (await Promise.all(r.links.flatMap((e) => r.query.map(async (t) => (await d(`site:${e} ${t}`, {
|
|
@@ -651,33 +621,200 @@ function L() {
|
|
|
651
621
|
}
|
|
652
622
|
} };
|
|
653
623
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
"
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
624
|
+
// ../search-autocomplete/dist/index.mjs
|
|
625
|
+
async function w(e, t, n = {}) {
|
|
626
|
+
let r = t.fetch ?? fetch, i = new AbortController(), a = setTimeout(() => i.abort(/* @__PURE__ */ Error(`Timed out after ${t.timeoutMs ?? 3e3}ms`)), t.timeoutMs ?? 3e3), o = () => i.abort(t.signal?.reason);
|
|
627
|
+
t.signal?.aborted && o(), t.signal?.addEventListener("abort", o, { once: !0 });
|
|
628
|
+
try {
|
|
629
|
+
let t = await r(e, {
|
|
630
|
+
headers: {
|
|
631
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
|
|
632
|
+
...n
|
|
633
|
+
},
|
|
634
|
+
signal: i.signal
|
|
635
|
+
});
|
|
636
|
+
if (!t.ok) throw Error(`HTTP ${t.status} from ${new URL(e).hostname}`);
|
|
637
|
+
return await t.text();
|
|
638
|
+
} finally {
|
|
639
|
+
clearTimeout(a), t.signal?.removeEventListener("abort", o);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
function T(e) {
|
|
643
|
+
let t = JSON.parse(e);
|
|
644
|
+
return Array.isArray(t) && Array.isArray(t[1]) ? t[1].filter((e) => typeof e == "string") : [];
|
|
645
|
+
}
|
|
646
|
+
var ge = {
|
|
647
|
+
amp: "&",
|
|
648
|
+
lt: "<",
|
|
649
|
+
gt: ">",
|
|
650
|
+
quot: "\"",
|
|
651
|
+
apos: "'",
|
|
652
|
+
nbsp: " "
|
|
653
|
+
};
|
|
654
|
+
function _e(e) {
|
|
655
|
+
return e.replace(/<[^>]*>/g, "").replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (e, t) => {
|
|
656
|
+
if (t[0] === "#") {
|
|
657
|
+
let n = t[1] === "x" || t[1] === "X" ? parseInt(t.slice(2), 16) : parseInt(t.slice(1), 10);
|
|
658
|
+
return Number.isFinite(n) ? String.fromCodePoint(n) : e;
|
|
659
|
+
}
|
|
660
|
+
return ge[t.toLowerCase()] ?? e;
|
|
661
|
+
}).trim();
|
|
662
|
+
}
|
|
663
|
+
function E(e = "en-US") {
|
|
664
|
+
return e.split(/[-_]/)[0].toLowerCase();
|
|
665
|
+
}
|
|
666
|
+
var D = async (e, t = {}) => {
|
|
667
|
+
let n = new URLSearchParams({
|
|
668
|
+
ie: "utf-8",
|
|
669
|
+
json: "1",
|
|
670
|
+
prod: "pc",
|
|
671
|
+
wd: e
|
|
672
|
+
}), r = JSON.parse(await w(`https://www.baidu.com/sugrec?${n}`, t));
|
|
673
|
+
return Array.isArray(r?.g) ? r.g.map((e) => e.q) : [];
|
|
674
|
+
}, O = async (e, t = {}) => T(await w(`https://api.bing.com/osjson.aspx?${new URLSearchParams({
|
|
675
|
+
query: e,
|
|
676
|
+
mkt: t.locale ?? "en-US"
|
|
677
|
+
})}`, t)), k = async (e, t = {}) => T(await w(`https://search.brave.com/api/suggest?${new URLSearchParams({ q: e })}`, t, { Cookie: "country=all" })), A = async (e, t = {}) => {
|
|
678
|
+
let n = (t.locale ?? "en-US").toLowerCase().split(/[-_]/).reverse().join("-");
|
|
679
|
+
return T(await w(`https://duckduckgo.com/ac/?type=list&${new URLSearchParams({
|
|
680
|
+
q: e,
|
|
681
|
+
kl: n
|
|
682
|
+
})}`, t));
|
|
683
|
+
}, j = {
|
|
684
|
+
de: "google.de",
|
|
685
|
+
fr: "google.fr",
|
|
686
|
+
es: "google.es",
|
|
687
|
+
it: "google.it",
|
|
688
|
+
nl: "google.nl",
|
|
689
|
+
pt: "google.pt",
|
|
690
|
+
ru: "google.ru",
|
|
691
|
+
ja: "google.co.jp",
|
|
692
|
+
zh: "google.com.hk",
|
|
693
|
+
ko: "google.co.kr"
|
|
694
|
+
}, M = async (e, t = {}) => {
|
|
695
|
+
let n = E(t.locale), r = new URLSearchParams({
|
|
696
|
+
q: e,
|
|
697
|
+
client: "gws-wiz",
|
|
698
|
+
hl: n
|
|
699
|
+
}), i = await w(`https://${j[n] ?? "google.com"}/complete/search?${r}`, t), a = i.indexOf("["), o = i.lastIndexOf("]") + 1;
|
|
700
|
+
if (a < 0 || o <= a) return [];
|
|
701
|
+
let s = JSON.parse(i.slice(a, o));
|
|
702
|
+
return Array.isArray(s?.[0]) ? s[0].map((e) => typeof e?.[0] == "string" ? _e(e[0]) : "").filter(Boolean) : [];
|
|
703
|
+
}, N = async (e, t = {}) => {
|
|
704
|
+
let n = new URLSearchParams({
|
|
705
|
+
q: e,
|
|
706
|
+
locale: (t.locale ?? "en-US").replace("-", "_"),
|
|
707
|
+
version: "2"
|
|
708
|
+
}), r = JSON.parse(await w(`https://api.qwant.com/v3/suggest?${n}`, t));
|
|
709
|
+
return r?.status === "success" && Array.isArray(r?.data?.items) ? r.data.items.map((e) => e.value) : [];
|
|
710
|
+
}, P = {
|
|
711
|
+
da: "dansk",
|
|
712
|
+
de: "deutsch",
|
|
713
|
+
en: "english",
|
|
714
|
+
es: "espanol",
|
|
715
|
+
fr: "francais",
|
|
716
|
+
nb: "norsk",
|
|
717
|
+
nl: "nederlands",
|
|
718
|
+
pl: "polski",
|
|
719
|
+
pt: "portugues",
|
|
720
|
+
sv: "svenska"
|
|
721
|
+
}, F = async (e, t = {}) => T(await w(`https://www.startpage.com/suggestions?${new URLSearchParams({
|
|
722
|
+
q: e,
|
|
723
|
+
format: "opensearch",
|
|
724
|
+
segment: "startpage.defaultffx",
|
|
725
|
+
lui: P[E(t.locale)] ?? "english"
|
|
726
|
+
})}`, t)), I = /* @__PURE__ */ new Set([
|
|
727
|
+
"en",
|
|
728
|
+
"de",
|
|
729
|
+
"fr",
|
|
730
|
+
"es",
|
|
731
|
+
"it",
|
|
732
|
+
"nl",
|
|
733
|
+
"pt",
|
|
734
|
+
"ru",
|
|
735
|
+
"ja",
|
|
736
|
+
"zh",
|
|
737
|
+
"ar",
|
|
738
|
+
"ko"
|
|
739
|
+
]), L = {
|
|
740
|
+
baidu: D,
|
|
741
|
+
bing: O,
|
|
742
|
+
brave: k,
|
|
743
|
+
duckduckgo: A,
|
|
744
|
+
google: M,
|
|
745
|
+
qwant: N,
|
|
746
|
+
startpage: F,
|
|
747
|
+
wikipedia: async (e, t = {}) => {
|
|
748
|
+
let n = E(t.locale), r = new URLSearchParams({
|
|
749
|
+
action: "opensearch",
|
|
750
|
+
format: "json",
|
|
751
|
+
formatversion: "2",
|
|
752
|
+
search: e,
|
|
753
|
+
namespace: "0",
|
|
754
|
+
limit: "10"
|
|
755
|
+
});
|
|
756
|
+
return T(await w(`https://${`${I.has(n) ? n : "en"}.wikipedia.org`}/w/api.php?${r}`, t));
|
|
757
|
+
},
|
|
758
|
+
yandex: async (e, t = {}) => T(await w(`https://suggest.yandex.com/suggest-ff.cgi?${new URLSearchParams({ part: e })}`, t))
|
|
759
|
+
};
|
|
760
|
+
Object.keys(L);
|
|
761
|
+
function ve(e) {
|
|
762
|
+
return Object.prototype.hasOwnProperty.call(L, e);
|
|
763
|
+
}
|
|
764
|
+
var ye = "google", be = 3;
|
|
765
|
+
function R(e) {
|
|
766
|
+
let t = e?.trim().toLowerCase();
|
|
767
|
+
return t === "ddg" ? "duckduckgo" : t && ve(t) ? t : ye;
|
|
768
|
+
}
|
|
769
|
+
async function z(e, t = {}) {
|
|
770
|
+
let n = R(t.engine);
|
|
771
|
+
try {
|
|
772
|
+
return await L[n](e, t);
|
|
773
|
+
} catch (e) {
|
|
774
|
+
return t.signal?.aborted || console.error(`Autocomplete engine '${n}' failed:`, e), [];
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
async function xe(e, t = {}) {
|
|
778
|
+
let n = (e) => Array.from(new Set(e)), r = await z(e, t);
|
|
779
|
+
if (r.length > 0) return n(r);
|
|
780
|
+
let i = e.split(/\s+/).filter(Boolean), a = Math.min(be, i.length - 1);
|
|
781
|
+
for (let n = a; n >= 1; n--) {
|
|
782
|
+
if (t.signal?.aborted) return [];
|
|
783
|
+
let r = i.slice(-n).join(" "), a = i.slice(0, -n).join(" "), o = await z(r, t), s = /* @__PURE__ */ new Set();
|
|
784
|
+
for (let t of o) {
|
|
785
|
+
let n = a ? `${a} ${t}` : t;
|
|
786
|
+
n.toLowerCase() !== e.toLowerCase() && s.add(n);
|
|
787
|
+
}
|
|
788
|
+
if (s.size > 0) return Array.from(s);
|
|
789
|
+
}
|
|
790
|
+
return [];
|
|
791
|
+
}
|
|
792
|
+
// ../search-autocomplete/dist/server.mjs
|
|
793
|
+
var Se = 3, B = null;
|
|
794
|
+
function Ce() {
|
|
795
|
+
if (!B) {
|
|
796
|
+
let e = Object.entries(h).map(([e, t]) => ({
|
|
797
|
+
domain: e,
|
|
798
|
+
name: typeof t?.[0] == "string" ? t[0] : "",
|
|
799
|
+
rank: typeof t?.[1] == "number" ? t[1] : 2 ** 53 - 1
|
|
800
|
+
}));
|
|
801
|
+
B = new p(e, {
|
|
802
|
+
keys: [{
|
|
803
|
+
name: "name",
|
|
804
|
+
weight: .6
|
|
805
|
+
}, {
|
|
806
|
+
name: "domain",
|
|
807
|
+
weight: .4
|
|
808
|
+
}],
|
|
809
|
+
threshold: .1,
|
|
810
|
+
ignoreLocation: !0,
|
|
811
|
+
includeScore: !0,
|
|
812
|
+
minMatchCharLength: 3
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
return B;
|
|
816
|
+
}
|
|
817
|
+
function V(e, t, n) {
|
|
681
818
|
return {
|
|
682
819
|
domain: e,
|
|
683
820
|
name: t,
|
|
@@ -685,46 +822,32 @@ function U(e, t, n) {
|
|
|
685
822
|
rank: n
|
|
686
823
|
};
|
|
687
824
|
}
|
|
688
|
-
function
|
|
689
|
-
let t =
|
|
825
|
+
function we(e) {
|
|
826
|
+
let t = m(e);
|
|
690
827
|
return t.domain && t.isIcann ? t.hostname : null;
|
|
691
828
|
}
|
|
692
|
-
function
|
|
829
|
+
function Te(e) {
|
|
693
830
|
let t = e.split(/\s+/).filter(Boolean), n = t[t.length - 1] || "";
|
|
694
831
|
if (n.length < 3) return [];
|
|
695
|
-
let r =
|
|
696
|
-
return i && !r.some((e) => e.domain === i) && r.unshift(
|
|
697
|
-
}
|
|
698
|
-
async function K(e, t, n) {
|
|
699
|
-
let r = await p(e, t, n);
|
|
700
|
-
if (r.length > 0) return r;
|
|
701
|
-
let i = t.split(/\s+/).filter(Boolean), a = Math.min(z, i.length - 1);
|
|
702
|
-
for (let r = a; r >= 1; r--) {
|
|
703
|
-
let a = i.slice(-r).join(" "), o = i.slice(0, -r).join(" "), s = await p(e, a, n);
|
|
704
|
-
if (s.length > 0) {
|
|
705
|
-
let e = /* @__PURE__ */ new Set();
|
|
706
|
-
for (let n of s) {
|
|
707
|
-
let r = o ? `${o} ${n}` : n;
|
|
708
|
-
r.toLowerCase() !== t.toLowerCase() && e.add(r);
|
|
709
|
-
}
|
|
710
|
-
if (e.size > 0) return Array.from(e);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
return [];
|
|
832
|
+
let r = Ce().search(n, { limit: 12 }).sort((e, t) => Math.round((e.score ?? 1) * 10) - Math.round((t.score ?? 1) * 10) || e.item.rank - t.item.rank).map(({ item: e }) => V(e.domain, e.name, e.rank)), i = we(n);
|
|
833
|
+
return i && !r.some((e) => e.domain === i) && r.unshift(V(i, "", 2 ** 53 - 1)), r.slice(0, Se);
|
|
714
834
|
}
|
|
715
|
-
function
|
|
716
|
-
return { GET: async (
|
|
717
|
-
let { searchParams:
|
|
718
|
-
if (!
|
|
835
|
+
function Ee(e = {}) {
|
|
836
|
+
return { GET: async (t) => {
|
|
837
|
+
let { searchParams: n } = new URL(t.url), r = n.get("q")?.trim(), i = n.get("locale") || "en-US", a = parseInt(n.get("limit") || String(e.defaultLimit ?? 8), 10), o = n.get("engine") || n.get("backends")?.split(",")[0] || e.engine;
|
|
838
|
+
if (!r) return Response.json({
|
|
719
839
|
suggestions: [],
|
|
720
840
|
domains: []
|
|
721
841
|
});
|
|
722
|
-
let o = i ? i.split(",").map((e) => e.trim()).filter(Boolean) : R;
|
|
723
842
|
try {
|
|
724
|
-
let e = await
|
|
843
|
+
let e = await xe(r, {
|
|
844
|
+
engine: R(o),
|
|
845
|
+
locale: i,
|
|
846
|
+
signal: t.signal
|
|
847
|
+
}), n = Te(r);
|
|
725
848
|
return Response.json({
|
|
726
849
|
suggestions: e.slice(0, a),
|
|
727
|
-
domains:
|
|
850
|
+
domains: n
|
|
728
851
|
});
|
|
729
852
|
} catch (e) {
|
|
730
853
|
return console.error("Autocomplete error:", e), Response.json({
|
|
@@ -734,14 +857,13 @@ function q() {
|
|
|
734
857
|
}
|
|
735
858
|
} };
|
|
736
859
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
function J() {
|
|
860
|
+
// src/api/handlers/suggestions.ts
|
|
861
|
+
function De() {
|
|
740
862
|
return { POST: async (e) => {
|
|
741
863
|
let n = await e.json(), r = n.chatHistory.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
742
864
|
role: e.role,
|
|
743
865
|
content: String(e.content ?? "")
|
|
744
|
-
})), i = await new t().loadChatModel(n.chatModel.providerId, n.chatModel.key), a = (await
|
|
866
|
+
})), i = await new t().loadChatModel(n.chatModel.providerId, n.chatModel.key), a = (await g({
|
|
745
867
|
chat_history: r,
|
|
746
868
|
maxQuestions: n.maxQuestions,
|
|
747
869
|
promptTemplate: n.promptTemplate
|
|
@@ -749,9 +871,8 @@ function J() {
|
|
|
749
871
|
return Response.json({ suggestions: a }, { status: 200 });
|
|
750
872
|
} };
|
|
751
873
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
function Y(e) {
|
|
874
|
+
// src/api/handlers/agents.ts
|
|
875
|
+
function Oe(e) {
|
|
755
876
|
return { POST: async (t) => {
|
|
756
877
|
let n;
|
|
757
878
|
try {
|
|
@@ -764,38 +885,37 @@ function Y(e) {
|
|
|
764
885
|
return a && (o = await r.query.user.findFirst({ where: i(e.userSchema.id, a) })), o && (n.apiKey = o.settings?.providerApiKeys?.find((e) => e.provider == n.provider)?.key), n.apiKey || (n.apiKey = n.provider == "groq" && e.getEnv("GROQ_API_KEY")), n.apiKey ? Response.json({ error: "Language generation endpoint is deprecated. Please use /api/agent/chat instead." }, { status: 501 }) : Response.json({ error: "API key is required" }, { status: 500 });
|
|
765
886
|
} };
|
|
766
887
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
function Z(e) {
|
|
888
|
+
// src/api/handlers/rewrite.ts
|
|
889
|
+
var ke = "llama-3.3-70b-versatile";
|
|
890
|
+
function H(e) {
|
|
771
891
|
return e instanceof Error ? e.message : typeof e == "string" ? e : String(e);
|
|
772
892
|
}
|
|
773
|
-
async function
|
|
893
|
+
async function Ae(e, t) {
|
|
774
894
|
let n = [];
|
|
775
895
|
if (t && e.loadChatModel) try {
|
|
776
896
|
return await e.loadChatModel(t);
|
|
777
897
|
} catch (e) {
|
|
778
|
-
n.push(
|
|
898
|
+
n.push(H(e));
|
|
779
899
|
}
|
|
780
900
|
let r = e.getEnv("GROQ_API_KEY");
|
|
781
|
-
if (r) return e.createGroq({ apiKey: r })(
|
|
901
|
+
if (r) return e.createGroq({ apiKey: r })(ke);
|
|
782
902
|
if (e.loadChatModel) try {
|
|
783
903
|
return await e.loadChatModel();
|
|
784
904
|
} catch (e) {
|
|
785
|
-
n.push(
|
|
905
|
+
n.push(H(e));
|
|
786
906
|
}
|
|
787
907
|
throw Error(n.length ? `AI service is not configured: ${n.join("; ")}` : "AI service is not configured. Please contact the administrator.");
|
|
788
908
|
}
|
|
789
|
-
function
|
|
909
|
+
function je(e) {
|
|
790
910
|
return { POST: async (t) => {
|
|
791
911
|
try {
|
|
792
912
|
let { text: n, prompt: r, stream: i, chatModel: a } = await t.json();
|
|
793
913
|
if (!n || typeof n != "string") return Response.json({ error: "Text is required and must be a string" }, { status: 400 });
|
|
794
914
|
let o;
|
|
795
915
|
try {
|
|
796
|
-
o = await
|
|
916
|
+
o = await Ae(e, a);
|
|
797
917
|
} catch (e) {
|
|
798
|
-
let t =
|
|
918
|
+
let t = H(e);
|
|
799
919
|
return console.error("AI rewrite has no usable model:", t), Response.json({ error: t }, { status: 500 });
|
|
800
920
|
}
|
|
801
921
|
let s = r || `Rewrite the following text to improve clarity, grammar, and style while maintaining the original meaning and tone. Only return the rewritten text without any explanation or additional commentary:
|
|
@@ -832,7 +952,7 @@ ${n}`;
|
|
|
832
952
|
})).text.trim();
|
|
833
953
|
return Response.json({ rewrittenText: c });
|
|
834
954
|
} catch (e) {
|
|
835
|
-
let t =
|
|
955
|
+
let t = H(e);
|
|
836
956
|
return console.error("AI rewrite error:", e), Response.json({
|
|
837
957
|
error: `Failed to process AI request: ${t}`,
|
|
838
958
|
details: t
|
|
@@ -840,9 +960,8 @@ ${n}`;
|
|
|
840
960
|
}
|
|
841
961
|
} };
|
|
842
962
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
function oe(e) {
|
|
963
|
+
// src/api/handlers/voice.ts
|
|
964
|
+
function Me(e) {
|
|
846
965
|
return { POST: async (t) => {
|
|
847
966
|
let n, r, i;
|
|
848
967
|
try {
|
|
@@ -875,42 +994,116 @@ function oe(e) {
|
|
|
875
994
|
}
|
|
876
995
|
} };
|
|
877
996
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
997
|
+
// src/api/handlers/transcript.ts
|
|
998
|
+
var U = [
|
|
999
|
+
"small",
|
|
1000
|
+
"fast",
|
|
1001
|
+
"medium",
|
|
1002
|
+
"turbo",
|
|
1003
|
+
"large"
|
|
1004
|
+
], W = "turbo";
|
|
1005
|
+
function G(e) {
|
|
1006
|
+
return typeof e == "string" && U.includes(e);
|
|
1007
|
+
}
|
|
1008
|
+
function K(e) {
|
|
881
1009
|
return e === "small" || e === "fast" ? "@cf/openai/whisper-tiny-en" : e === "medium" || e === "turbo" ? "@cf/openai/whisper-large-v3-turbo" : e === "large" ? "@cf/openai/whisper-large-v3" : "@cf/openai/whisper-large-v3-turbo";
|
|
882
1010
|
}
|
|
883
|
-
function
|
|
1011
|
+
async function q(e, t, n) {
|
|
1012
|
+
let r = K(n), i;
|
|
1013
|
+
try {
|
|
1014
|
+
i = e.getCloudflareContext().env?.AI;
|
|
1015
|
+
} catch {}
|
|
1016
|
+
if (!i) return {
|
|
1017
|
+
ok: !1,
|
|
1018
|
+
reason: "ai_unavailable"
|
|
1019
|
+
};
|
|
1020
|
+
let a = await t.arrayBuffer(), { text: o } = await i.run(r, { audio: [...new Uint8Array(a)] });
|
|
1021
|
+
return {
|
|
1022
|
+
ok: !0,
|
|
1023
|
+
text: o,
|
|
1024
|
+
model: r
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
function Ne(e) {
|
|
884
1028
|
return { POST: async (t) => {
|
|
885
1029
|
try {
|
|
886
1030
|
let n = await t.formData(), r = n.get("file");
|
|
887
1031
|
if (!r || !(r instanceof File)) return Response.json({ error: "file is required" }, { status: 400 });
|
|
888
|
-
let i =
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
let o = await r.arrayBuffer(), { text: s } = await a.run(i, { audio: [...new Uint8Array(o)] });
|
|
894
|
-
return Response.json({
|
|
895
|
-
text: s,
|
|
896
|
-
model: i
|
|
897
|
-
});
|
|
1032
|
+
let i = await q(e, r, n.get("model"));
|
|
1033
|
+
return i.ok ? Response.json({
|
|
1034
|
+
text: i.text,
|
|
1035
|
+
model: i.model
|
|
1036
|
+
}) : Response.json({ error: "Cloudflare AI binding not available" }, { status: 503 });
|
|
898
1037
|
} catch (e) {
|
|
899
1038
|
return console.error("Transcript error:", e), Response.json({ error: "Failed to transcribe audio" }, { status: 500 });
|
|
900
1039
|
}
|
|
901
1040
|
} };
|
|
902
1041
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
function
|
|
1042
|
+
// src/api/handlers/openai-transcription.ts
|
|
1043
|
+
var J = ["json"];
|
|
1044
|
+
function Y(e, t, n, r = null, i = null) {
|
|
1045
|
+
return Response.json({ error: {
|
|
1046
|
+
message: t,
|
|
1047
|
+
type: n,
|
|
1048
|
+
param: r,
|
|
1049
|
+
code: i
|
|
1050
|
+
} }, { status: e });
|
|
1051
|
+
}
|
|
1052
|
+
async function X(e, t) {
|
|
1053
|
+
let n = await e.authorize(t);
|
|
1054
|
+
if (n.authorized) return null;
|
|
1055
|
+
let { status: r, message: i } = n;
|
|
1056
|
+
return Y(r ?? 401, i, "authentication_error", null, "invalid_api_key");
|
|
1057
|
+
}
|
|
1058
|
+
function Z() {
|
|
1059
|
+
return {
|
|
1060
|
+
object: "list",
|
|
1061
|
+
data: U.map((e) => ({
|
|
1062
|
+
id: e,
|
|
1063
|
+
object: "model",
|
|
1064
|
+
created: 0,
|
|
1065
|
+
owned_by: "qwksearch"
|
|
1066
|
+
}))
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
function Pe(e) {
|
|
1070
|
+
return { GET: async (t) => await X(e, t) || Response.json(Z()) };
|
|
1071
|
+
}
|
|
1072
|
+
function Q(e) {
|
|
1073
|
+
return { POST: async (t) => {
|
|
1074
|
+
let n = await X(e, t);
|
|
1075
|
+
if (n) return n;
|
|
1076
|
+
let r;
|
|
1077
|
+
try {
|
|
1078
|
+
r = await t.formData();
|
|
1079
|
+
} catch {
|
|
1080
|
+
return Y(400, "Request body must be multipart/form-data with a `file` field.", "invalid_request_error", null, "invalid_body");
|
|
1081
|
+
}
|
|
1082
|
+
let i = r.get("file");
|
|
1083
|
+
if (!i || !(i instanceof File)) return Y(400, "`file` is required.", "invalid_request_error", "file", "missing_file");
|
|
1084
|
+
if (i.size === 0) return Y(400, "`file` is empty.", "invalid_request_error", "file", "empty_file");
|
|
1085
|
+
let a = r.get("model"), o = a === null || a === "" ? W : a;
|
|
1086
|
+
if (!G(o)) return Y(400, `Unsupported model. Use one of: ${U.join(", ")}.`, "invalid_request_error", "model", "model_not_found");
|
|
1087
|
+
let s = r.get("response_format");
|
|
1088
|
+
if (s !== null && s !== "" && s !== "json") return Y(400, `Unsupported response_format. Only ${J.join(", ")} is supported.`, "invalid_request_error", "response_format", "unsupported_response_format");
|
|
1089
|
+
try {
|
|
1090
|
+
let t = await q(e, i, o);
|
|
1091
|
+
return t.ok ? Response.json({ text: t.text }) : Y(503, "Transcription is not available right now.", "server_error", null, "ai_unavailable");
|
|
1092
|
+
} catch (e) {
|
|
1093
|
+
return console.error("[v1/audio/transcriptions] Workers AI failed:", e instanceof Error ? e.name : typeof e), Y(500, "Failed to transcribe audio.", "server_error", null, "transcription_failed");
|
|
1094
|
+
}
|
|
1095
|
+
} };
|
|
1096
|
+
}
|
|
1097
|
+
// src/api/handlers/test-models.ts
|
|
1098
|
+
function Fe() {
|
|
906
1099
|
return { POST: async (e) => {
|
|
907
1100
|
try {
|
|
908
1101
|
let { providerType: t, apiKey: n, onlyFree: r = !0 } = await e.json();
|
|
909
1102
|
if (!t) return Response.json({ error: "Provider type is required" }, { status: 400 });
|
|
910
1103
|
if (!n) return Response.json({ error: "API key is required" }, { status: 400 });
|
|
911
|
-
let i =
|
|
1104
|
+
let i = v.find((e) => e.provider.toLowerCase() === t.toLowerCase());
|
|
912
1105
|
if (!i) return Response.json({ error: `Provider ${t} not found` }, { status: 404 });
|
|
913
|
-
let a = await
|
|
1106
|
+
let a = await _(t, n, i.models, {
|
|
914
1107
|
onlyFree: r,
|
|
915
1108
|
concurrency: 3,
|
|
916
1109
|
timeout: 15e3
|
|
@@ -921,15 +1114,14 @@ function ce() {
|
|
|
921
1114
|
}
|
|
922
1115
|
} };
|
|
923
1116
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
function ue(e) {
|
|
1117
|
+
// src/api/handlers/validate-openrouter.ts
|
|
1118
|
+
var Ie = 864e5, $ = null;
|
|
1119
|
+
function Le(e) {
|
|
928
1120
|
return {
|
|
929
1121
|
GET: async (t) => {
|
|
930
1122
|
try {
|
|
931
1123
|
let t = Date.now();
|
|
932
|
-
if ($ && t - $.timestamp <
|
|
1124
|
+
if ($ && t - $.timestamp < Ie) return Response.json({
|
|
933
1125
|
...$.result,
|
|
934
1126
|
cached: !0,
|
|
935
1127
|
cacheAge: t - $.timestamp
|
|
@@ -962,5 +1154,4 @@ function ue(e) {
|
|
|
962
1154
|
}
|
|
963
1155
|
};
|
|
964
1156
|
}
|
|
965
|
-
|
|
966
|
-
export { Y as createAgentsHandler, b as createArticleFollowupsHandler, C as createArticleQAHandler, q as createAutocompleteHandler, ee as createChatByIdHandler, T as createChatTitleHandler, w as createChatsHandler, te as createChatsSearchHandler, ne as createChatsShareHandler, L as createDiscoverHandler, N as createMCPServerByIdHandler, P as createMCPServerToggleHandler, M as createMCPServersHandler, O as createMessagesHandler, x as createPageTipsHandler, A as createProviderByIdHandler, j as createProviderModelsHandler, k as createProvidersHandler, ae as createRewriteHandler, I as createSearchHandler, J as createSuggestionsHandler, ce as createTestModelsHandler, S as createTopicSearchesHandler, Q as createTranscriptHandler, ue as createValidateOpenRouterHandler, oe as createVoiceHandler, D as describeError };
|
|
1157
|
+
export { W as DEFAULT_TRANSCRIPTION_MODEL, J as SUPPORTED_RESPONSE_FORMATS, U as TRANSCRIPTION_MODELS, Oe as createAgentsHandler, y as createArticleFollowupsHandler, ee as createArticleQAHandler, Ee as createAutocompleteHandler, ne as createChatByIdHandler, ae as createChatTitleHandler, te as createChatsHandler, re as createChatsSearchHandler, ie as createChatsShareHandler, he as createDiscoverHandler, de as createMCPServerByIdHandler, fe as createMCPServerToggleHandler, ue as createMCPServersHandler, se as createMessagesHandler, Pe as createOpenAIModelsHandler, Q as createOpenAITranscriptionHandler, b as createPageTipsHandler, C as createProviderByIdHandler, le as createProviderModelsHandler, ce as createProvidersHandler, je as createRewriteHandler, me as createSearchHandler, De as createSuggestionsHandler, Fe as createTestModelsHandler, x as createTopicSearchesHandler, Ne as createTranscriptHandler, Le as createValidateOpenRouterHandler, Me as createVoiceHandler, S as describeError, K as getWhisperModel, G as isTranscriptionModel, Z as listTranscriptionModels, Y as openAIError, q as transcribeAudio };
|