mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-05 16:02:19 +00:00
ignore: share version
This commit is contained in:
parent
e78d3b54bf
commit
f1f3f8d12c
2 changed files with 11 additions and 11 deletions
|
|
@ -801,7 +801,9 @@ export default function Share(props: {
|
||||||
<div data-stat-icon title="opencode">
|
<div data-stat-icon title="opencode">
|
||||||
<IconOpencode width={16} height={16} />
|
<IconOpencode width={16} height={16} />
|
||||||
</div>
|
</div>
|
||||||
|
<Show when={store.info?.version} fallback="v0.0.1">
|
||||||
<span>v${store.info?.version}</span>
|
<span>v${store.info?.version}</span>
|
||||||
|
</Show>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,12 @@ const { id } = Astro.params;
|
||||||
const res = await fetch(`${apiUrl}/share_data?id=${id}`);
|
const res = await fetch(`${apiUrl}/share_data?id=${id}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
let cost = 0;
|
|
||||||
const models: Set<string> = new Set();
|
const models: Set<string> = new Set();
|
||||||
const version = `v${data.info.version}`;
|
const version = data.info.version ? `v${data.info.version}` : "v0.0.1";
|
||||||
|
|
||||||
Object.values(data.messages).forEach((d) => {
|
Object.values(data.messages).forEach((d) => {
|
||||||
const assistant = d.metadata?.assistant;
|
const assistant = d.metadata?.assistant;
|
||||||
if (assistant) {
|
if (assistant) {
|
||||||
cost += assistant.cost;
|
|
||||||
models.add(assistant.modelID);
|
models.add(assistant.modelID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -31,9 +30,8 @@ const encodedTitle = encodeURIComponent(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const encodedCost = encodeURIComponent(`$${cost.toFixed(2)}`);
|
|
||||||
|
|
||||||
const ogImage = `https://social-cards.sst.dev/opencode-share/${encodedTitle}.png?cost=${encodedCost}&model=${Array.from(models).join(",")}&version=${version}&id=${id}`;
|
const ogImage = `https://social-cards.sst.dev/opencode-share/${encodedTitle}.png?model=${Array.from(models).join(",")}&version=${version}&id=${id}`;
|
||||||
|
|
||||||
---
|
---
|
||||||
<StarlightPage
|
<StarlightPage
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue