mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 10:14:22 +01:00
ignore: share version
This commit is contained in:
@@ -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>
|
||||||
<span>v${store.info?.version}</span>
|
<Show when={store.info?.version} fallback="v0.0.1">
|
||||||
|
<span>v${store.info?.version}</span>
|
||||||
|
</Show>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</Show>
|
</Show>
|
||||||
@@ -1261,9 +1263,9 @@ export default function Share(props: {
|
|||||||
const path = createMemo(() =>
|
const path = createMemo(() =>
|
||||||
toolData()?.args.path !== data().rootDir
|
toolData()?.args.path !== data().rootDir
|
||||||
? stripWorkingDirectory(
|
? stripWorkingDirectory(
|
||||||
toolData()?.args.path,
|
toolData()?.args.path,
|
||||||
data().rootDir,
|
data().rootDir,
|
||||||
)
|
)
|
||||||
: toolData()?.args.path,
|
: toolData()?.args.path,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1620,7 +1622,7 @@ export default function Share(props: {
|
|||||||
msg.role === "assistant" &&
|
msg.role === "assistant" &&
|
||||||
part.type === "tool-invocation" &&
|
part.type === "tool-invocation" &&
|
||||||
part.toolInvocation.toolName ===
|
part.toolInvocation.toolName ===
|
||||||
"todowrite" &&
|
"todowrite" &&
|
||||||
part
|
part
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -1686,7 +1688,7 @@ export default function Share(props: {
|
|||||||
msg.role === "assistant" &&
|
msg.role === "assistant" &&
|
||||||
part.type === "tool-invocation" &&
|
part.type === "tool-invocation" &&
|
||||||
part.toolInvocation.toolName ===
|
part.toolInvocation.toolName ===
|
||||||
"webfetch" &&
|
"webfetch" &&
|
||||||
part
|
part
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user