veryfront 0.1.60 → 0.1.62
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/esm/deno.js +1 -1
- package/esm/src/agent/chat-handler.js +4 -0
- package/esm/src/embedding/embedding.d.ts.map +1 -1
- package/esm/src/embedding/embedding.js +5 -1
- package/esm/src/embedding/rag-store.js +2 -0
- package/esm/src/embedding/vector-store.d.ts.map +1 -1
- package/esm/src/embedding/vector-store.js +2 -0
- package/esm/src/embedding/veryfront-cloud/rag-store.d.ts.map +1 -1
- package/esm/src/embedding/veryfront-cloud/rag-store.js +2 -0
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/agent/chat-handler.ts +5 -0
- package/src/src/embedding/embedding.ts +5 -1
- package/src/src/embedding/rag-store.ts +1 -0
- package/src/src/embedding/vector-store.ts +1 -0
- package/src/src/embedding/veryfront-cloud/rag-store.ts +1 -0
package/esm/deno.js
CHANGED
|
@@ -271,6 +271,10 @@ export function createChatHandler(agentIdOrConfig, options) {
|
|
|
271
271
|
model: DEFAULT_LOCAL_MODEL,
|
|
272
272
|
}, { status: 503 });
|
|
273
273
|
}
|
|
274
|
+
agentLogger.error("Chat handler error", {
|
|
275
|
+
error: error instanceof Error ? error.message : String(error),
|
|
276
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
277
|
+
});
|
|
274
278
|
return dntShim.Response.json({ error: "Internal server error" }, { status: 500 });
|
|
275
279
|
}
|
|
276
280
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../../src/src/embedding/embedding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAM7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../../src/src/embedding/embedding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAM7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAwC5D"}
|
|
@@ -30,7 +30,11 @@ export function embedding(config) {
|
|
|
30
30
|
return {
|
|
31
31
|
model: modelId,
|
|
32
32
|
async embed(text) {
|
|
33
|
-
const
|
|
33
|
+
const value = queryPrefix + text;
|
|
34
|
+
if (!value.trim()) {
|
|
35
|
+
throw new Error("Cannot embed an empty string");
|
|
36
|
+
}
|
|
37
|
+
const result = await embed({ model, value });
|
|
34
38
|
return result.embedding;
|
|
35
39
|
},
|
|
36
40
|
async embedMany(texts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-store.d.ts","sourceRoot":"","sources":["../../../src/src/embedding/vector-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,WAAW,EACX,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAQpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"vector-store.d.ts","sourceRoot":"","sources":["../../../src/src/embedding/vector-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,WAAW,EACX,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAQpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,CA8DlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rag-store.d.ts","sourceRoot":"","sources":["../../../../src/src/embedding/veryfront-cloud/rag-store.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAIV,QAAQ,EACR,cAAc,EACf,MAAM,aAAa,CAAC;AAyErB,KAAK,2BAA2B,GAAG,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAiYtE,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,2BAA2B,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"rag-store.d.ts","sourceRoot":"","sources":["../../../../src/src/embedding/veryfront-cloud/rag-store.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAIV,QAAQ,EACR,cAAc,EACf,MAAM,aAAa,CAAC;AAyErB,KAAK,2BAA2B,GAAG,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAiYtE,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,2BAA2B,GAAG,QAAQ,CA2H1F"}
|
|
@@ -273,6 +273,8 @@ export function createVeryfrontCloudRagStore(config) {
|
|
|
273
273
|
return ingestDocument(context, config, title, text, meta);
|
|
274
274
|
},
|
|
275
275
|
async search(query, options) {
|
|
276
|
+
if (!query.trim())
|
|
277
|
+
return [];
|
|
276
278
|
const context = getCloudStoreContext(config);
|
|
277
279
|
const queryEmbedder = createEmbedder(config);
|
|
278
280
|
const vector = await queryEmbedder.embed(query);
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
|
@@ -425,6 +425,11 @@ export function createChatHandler(
|
|
|
425
425
|
);
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
agentLogger.error("Chat handler error", {
|
|
429
|
+
error: error instanceof Error ? error.message : String(error),
|
|
430
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
431
|
+
});
|
|
432
|
+
|
|
428
433
|
return dntShim.Response.json(
|
|
429
434
|
{ error: "Internal server error" },
|
|
430
435
|
{ status: 500 },
|
|
@@ -35,7 +35,11 @@ export function embedding(config: EmbeddingConfig): Embedding {
|
|
|
35
35
|
model: modelId,
|
|
36
36
|
|
|
37
37
|
async embed(text: string): Promise<number[]> {
|
|
38
|
-
const
|
|
38
|
+
const value = queryPrefix + text;
|
|
39
|
+
if (!value.trim()) {
|
|
40
|
+
throw new Error("Cannot embed an empty string");
|
|
41
|
+
}
|
|
42
|
+
const result = await embed({ model, value });
|
|
39
43
|
return result.embedding;
|
|
40
44
|
},
|
|
41
45
|
|
|
@@ -321,6 +321,7 @@ function createLocalJsonRagStore(config: ResolvedRagStoreConfig): RagStore {
|
|
|
321
321
|
query: string,
|
|
322
322
|
options?: RagSearchOptions,
|
|
323
323
|
): Promise<RagSearchResult[]> {
|
|
324
|
+
if (!query.trim()) return [];
|
|
324
325
|
return withLock(async () => {
|
|
325
326
|
const data = await load();
|
|
326
327
|
if (data.chunks.length === 0) return [];
|
|
@@ -60,6 +60,7 @@ export function vectorStore(config: VectorStoreConfig): VectorStore {
|
|
|
60
60
|
},
|
|
61
61
|
|
|
62
62
|
async search(query: string, options?: SearchOptions): Promise<SearchResult[]> {
|
|
63
|
+
if (!query.trim()) return [];
|
|
63
64
|
if (entries.length === 0) return [];
|
|
64
65
|
|
|
65
66
|
const topK = options?.topK ?? 5;
|
|
@@ -492,6 +492,7 @@ export function createVeryfrontCloudRagStore(config: ResolvedCloudRagStoreConfig
|
|
|
492
492
|
query: string,
|
|
493
493
|
options?: RagSearchOptions,
|
|
494
494
|
): Promise<RagSearchResult[]> {
|
|
495
|
+
if (!query.trim()) return [];
|
|
495
496
|
const context = getCloudStoreContext(config);
|
|
496
497
|
const queryEmbedder = createEmbedder(config);
|
|
497
498
|
const vector = await queryEmbedder.embed(query);
|