From 772e1851c049f4f861632dacdee9cb1b3e0bda17 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 10 Jun 2025 15:50:40 -0400 Subject: Share: render url on frontend --- packages/function/src/api.ts | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'packages/function/src') diff --git a/packages/function/src/api.ts b/packages/function/src/api.ts index c2e166db7..a312b1280 100644 --- a/packages/function/src/api.ts +++ b/packages/function/src/api.ts @@ -1,6 +1,5 @@ import { DurableObject } from "cloudflare:workers" import { randomUUID } from "node:crypto" -import { Base64 } from "js-base64" type Env = { SYNC_SERVER: DurableObjectNamespace @@ -184,9 +183,6 @@ export default { let info const messages: Record = {} - let cost = 0 - const models: Set = new Set() - const version = "v0.1.1" data.forEach((d) => { const [root, type, ...splits] = d.key.split("/") if (root !== "session") return @@ -197,31 +193,13 @@ export default { if (type === "message") { const [, messageID] = splits messages[messageID] = d.content - - const assistant = d.content.metadata?.assistant - if (assistant) { - cost += assistant.cost - models.add(assistant.modelID) - } } }) - const encodedTitle = encodeURIComponent( - Base64.encode( - // Convert to ASCII - encodeURIComponent( - // Truncate to fit S3's max key size - info.title.substring(0, 700), - ), - ), - ) - const encodedCost = encodeURIComponent(`$${cost.toFixed(2)}`) - return new Response( JSON.stringify({ info, messages, - ogImage: `https://social-cards.sst.dev/opencode-share/${encodedTitle}.png?cost=${encodedCost}&model=${Array.from(models).join(",")}&version=${version}&id=${id}`, }), { headers: { "Content-Type": "application/json" }, -- cgit v1.2.3