opencode-rag-plugin 1.20.0 → 1.20.1

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 CHANGED
@@ -53,9 +53,9 @@ opencode-rag query "authentication middleware"
53
53
 
54
54
  ## Web UI
55
55
 
56
- A browser-based dashboard for exploring the indexed vector database - browse and inspect chunks and evaluate the OpenCode sessions in terms of retrieved chunks, consumed tokens and more.
56
+ A browser-based dashboard for exploring the indexed vector database - browse, visualize and inspect chunks and evaluate the OpenCode sessions in terms of retrieved chunks, consumed tokens and more.
57
57
 
58
- ![OpenCodeRAG Web UI](doc/assets/webui-dashboard.png)
58
+ ![OpenCodeRAG Web UI](doc/assets/webui-3d.png)
59
59
 
60
60
  Launch with `opencode-rag ui`. See [Web UI documentation](doc/webui.md) for details.
61
61
 
@@ -1,3 +1,4 @@
1
+ import { normalizeKeepAlive } from "../core/ollama.js";
1
2
  import { postJson } from "../embedder/http.js";
2
3
  import { uuid } from "./uuid.js";
3
4
  const MAX_CHUNK_CHARS = 4000;
@@ -67,7 +68,7 @@ class OllamaImageVisionProvider {
67
68
  options: { num_ctx: this.numCtx },
68
69
  };
69
70
  if (this.keepAlive) {
70
- body.keep_alive = this.keepAlive;
71
+ body.keep_alive = normalizeKeepAlive(this.keepAlive);
71
72
  }
72
73
  let lastError;
73
74
  for (let attempt = 0; attempt <= VISION_RETRY_MAX; attempt++) {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @fileoverview Shared Ollama request-body helpers.
3
+ */
4
+ /**
5
+ * Ollama's `keep_alive` field accepts either a duration string with a unit
6
+ * (e.g. "30m", "24h") or a bare integer (e.g. -1 for keep-in-memory forever,
7
+ * 0 to unload immediately). A bare integer passed as a string (e.g. "-1")
8
+ * fails server-side with `time: missing unit in duration "-1"`.
9
+ *
10
+ * Returns the numeric form for bare integers and passes other strings through
11
+ * unchanged.
12
+ */
13
+ export declare function normalizeKeepAlive(keepAlive?: string): string | number | undefined;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @fileoverview Shared Ollama request-body helpers.
3
+ */
4
+ /**
5
+ * Ollama's `keep_alive` field accepts either a duration string with a unit
6
+ * (e.g. "30m", "24h") or a bare integer (e.g. -1 for keep-in-memory forever,
7
+ * 0 to unload immediately). A bare integer passed as a string (e.g. "-1")
8
+ * fails server-side with `time: missing unit in duration "-1"`.
9
+ *
10
+ * Returns the numeric form for bare integers and passes other strings through
11
+ * unchanged.
12
+ */
13
+ export function normalizeKeepAlive(keepAlive) {
14
+ if (keepAlive === undefined || keepAlive === "") {
15
+ return undefined;
16
+ }
17
+ if (/^-?\d+$/.test(keepAlive)) {
18
+ return Number(keepAlive);
19
+ }
20
+ return keepAlive;
21
+ }
22
+ //# sourceMappingURL=ollama.js.map
@@ -1,3 +1,4 @@
1
+ import { normalizeKeepAlive } from "../core/ollama.js";
1
2
  import { postJson } from "../embedder/http.js";
2
3
  import { buildUserMessage, buildBatchUserMessage, parseBatchDescriptions, sleep } from "./shared.js";
3
4
  import pLimit from "p-limit";
@@ -178,7 +179,7 @@ export class LlmDescriptionProvider {
178
179
  ? `${baseUrl}/chat`
179
180
  : `${baseUrl}${baseUrl.endsWith("/v1") ? "" : "/v1"}/chat/completions`;
180
181
  const body = isOllama
181
- ? { model: this.config.model, messages, stream: false, think: this.config.think ?? false, options: { num_ctx: this.config.numCtx }, keep_alive: this.config.keepAlive }
182
+ ? { model: this.config.model, messages, stream: false, think: this.config.think ?? false, options: { num_ctx: this.config.numCtx }, keep_alive: normalizeKeepAlive(this.config.keepAlive) }
182
183
  : { model: this.config.model, messages };
183
184
  const headers = {};
184
185
  if (this.config.apiKey) {
@@ -1,3 +1,4 @@
1
+ import { normalizeKeepAlive } from "../core/ollama.js";
1
2
  import { postJson } from "./http.js";
2
3
  import path from "node:path";
3
4
  import { appendDebugLog } from "../core/fileLogger.js";
@@ -51,8 +52,9 @@ export class OllamaProvider {
51
52
  model: this.model,
52
53
  input: texts.length === 1 ? texts[0] : texts,
53
54
  };
54
- if (this.keepAlive) {
55
- body.keep_alive = this.keepAlive;
55
+ const keepAlive = normalizeKeepAlive(this.keepAlive);
56
+ if (keepAlive !== undefined) {
57
+ body.keep_alive = keepAlive;
56
58
  }
57
59
  const response = await postJson(`${this.baseUrl}/embed`, body, headers, this.timeoutMs, this.proxy);
58
60
  if (!response.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-rag-plugin",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "description": "OpenCode plugin for local-first RAG-based semantic code search",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin-entry.js",