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 CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -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,CAoC5D"}
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 result = await embed({ model, value: queryPrefix + text });
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) {
@@ -256,6 +256,8 @@ function createLocalJsonRagStore(config) {
256
256
  });
257
257
  },
258
258
  async search(query, options) {
259
+ if (!query.trim())
260
+ return [];
259
261
  return withLock(async () => {
260
262
  const data = await load();
261
263
  if (data.chunks.length === 0)
@@ -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,CA6DlE"}
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"}
@@ -44,6 +44,8 @@ export function vectorStore(config) {
44
44
  }
45
45
  },
46
46
  async search(query, options) {
47
+ if (!query.trim())
48
+ return [];
47
49
  if (entries.length === 0)
48
50
  return [];
49
51
  const topK = options?.topK ?? 5;
@@ -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,CA0H1F"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -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 result = await embed({ model, value: queryPrefix + text });
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);