diff options
Diffstat (limited to 'pirc.js')
| -rw-r--r-- | pirc.js | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1,4 +1,4 @@ -// PiRC extension 0.1.9-dev+1d13db331154. Third-party code in this file: @bufbuild/protobuf@2.16.0, ws@8.22.0; see NOTICE. +// PiRC extension 0.1.9-dev+a5452e4033f5. Third-party code in this file: @bufbuild/protobuf@2.16.0, ws@8.22.0; see NOTICE. import { createRequire as __pircCreateRequire } from "node:module"; const require = __pircCreateRequire(import.meta.url); var __create = Object.create; @@ -8045,7 +8045,7 @@ var Live = class { if (!SHOWN.has(m.role)) return; const p = { message: m, since: Date.now() }; if (m.role === "user") { - p.requestId = this.matchPrompt(textOf(m.content)); + p.requestId = this.matchPrompt(textOf(m.content), Array.isArray(m.content) && m.content.some((c) => c.type === "image")); if (p.requestId) this.confirm((u) => u.requestId === p.requestId); } if (m.role === "assistant") p.messageId = this.assistantId; @@ -8119,11 +8119,12 @@ var Live = class { this.prompts = this.prompts.filter((p) => now - p.at < PROMPT_ECHO_MS); } // The request a user message echoes: the same text, or failing that the - // oldest prompt it starts with (pi appends notes to a prompt with images). - matchPrompt(text) { + // oldest prompt it starts with, since pi appends notes to a prompt with + // images ("[image resized]"), also to one with no text. + matchPrompt(text, images) { this.prunePrompts(); let i = this.prompts.findIndex((p) => p.text === text); - if (i < 0) i = this.prompts.findIndex((p) => p.text !== "" && text.startsWith(p.text)); + if (i < 0) i = this.prompts.findIndex((p) => p.text === "" ? p.images && images : text.startsWith(p.text)); if (i < 0) return void 0; return this.prompts.splice(i, 1)[0].requestId; } @@ -8211,7 +8212,7 @@ var Live = class { ]; const deliverAs = delivery === 1 /* STEER */ ? "steer" : "followUp"; this.prunePrompts(); - if (!command) this.prompts.push({ requestId, text, at: Date.now() }); + if (!command) this.prompts.push({ requestId, text, images: images.length > 0, at: Date.now() }); this.pi.sendUserMessage(content, { deliverAs, expandPromptTemplates: true }); if (command || !idle) return respond(accepted(requestId)); const u = { requestId, text, respond, timer: void 0 }; @@ -8898,7 +8899,7 @@ var Host = class _Host { }; // extension/src/index.ts -var EXTENSION_VERSION = true ? "0.1.9-dev+1d13db331154" : "dev"; +var EXTENSION_VERSION = true ? "0.1.9-dev+a5452e4033f5" : "dev"; function piVersion() { try { let dir = dirname3(realpathSync(process.argv[1])); @@ -8913,7 +8914,7 @@ function piVersion() { } return "unknown"; } -var LOAD = true ? "0.1.9-dev+1d13db331154" : `dev ${randomBytes3(4).toString("hex")}`; +var LOAD = true ? "0.1.9-dev+a5452e4033f5" : `dev ${randomBytes3(4).toString("hex")}`; var KEY = /* @__PURE__ */ Symbol.for("pirc.extension"); var proc = globalThis[KEY] ??= {}; if (!proc.host || proc.load !== LOAD) { |
