summaryrefslogtreecommitdiffhomepage
path: root/packages/console/app/src/routes
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-10-14 16:51:15 -0400
committerFrank <[email protected]>2025-10-14 17:06:49 -0400
commitef9a1e911e147985cdf5b6bed7572c405cc79f7e (patch)
treeb8f883b056b8cb20b44ea9fbf5a7a17c36b775c1 /packages/console/app/src/routes
parent7eddaa806d91fdde5a4db0da928e059a9299a39a (diff)
downloadopencode-ef9a1e911e147985cdf5b6bed7572c405cc79f7e.tar.gz
opencode-ef9a1e911e147985cdf5b6bed7572c405cc79f7e.zip
wip: zen
Diffstat (limited to 'packages/console/app/src/routes')
-rw-r--r--packages/console/app/src/routes/workspace/[id]/model-section.tsx47
1 files changed, 45 insertions, 2 deletions
diff --git a/packages/console/app/src/routes/workspace/[id]/model-section.tsx b/packages/console/app/src/routes/workspace/[id]/model-section.tsx
index 1740c9d3c..6b8cc3254 100644
--- a/packages/console/app/src/routes/workspace/[id]/model-section.tsx
+++ b/packages/console/app/src/routes/workspace/[id]/model-section.tsx
@@ -5,6 +5,17 @@ import { withActor } from "~/context/auth.withActor"
import { ZenModel } from "@opencode-ai/console-core/model.js"
import styles from "./model-section.module.css"
import { querySessionInfo } from "../common"
+import { IconAlibaba, IconAnthropic, IconMoonshotAI, IconOpenAI, IconStealth, IconXai, IconZai } from "~/component/icon"
+
+const getModelLab = (modelId: string) => {
+ if (modelId.startsWith("claude")) return "Anthropic"
+ if (modelId.startsWith("gpt")) return "OpenAI"
+ if (modelId.startsWith("kimi")) return "Moonshot AI"
+ if (modelId.startsWith("glm")) return "Z.ai"
+ if (modelId.startsWith("qwen")) return "Alibaba"
+ if (modelId.startsWith("grok")) return "xAI"
+ return "Stealth"
+}
const getModelsInfo = query(async (workspaceID: string) => {
"use server"
@@ -42,6 +53,15 @@ export function ModelSection() {
const params = useParams()
const modelsInfo = createAsync(() => getModelsInfo(params.id))
const userInfo = createAsync(() => querySessionInfo(params.id))
+
+ const modelsWithLab = createMemo(() => {
+ const info = modelsInfo()
+ if (!info) return []
+ return info.all.map((model) => ({
+ ...model,
+ lab: getModelLab(model.id),
+ }))
+ })
return (
<section class={styles.root}>
<div data-slot="section-title">
@@ -57,17 +77,40 @@ export function ModelSection() {
<table data-slot="models-table-element">
<thead>
<tr>
+ <th></th>
<th>Model</th>
+ <th></th>
<th>Enabled</th>
</tr>
</thead>
<tbody>
- <For each={modelsInfo()!.all}>
- {({ id, name }) => {
+ <For each={modelsWithLab()}>
+ {({ id, name, lab }) => {
const isEnabled = createMemo(() => !modelsInfo()!.disabled.includes(id))
return (
<tr data-slot="model-row" data-disabled={!isEnabled()}>
+ <td data-slot="model-icon">
+ {(() => {
+ switch (lab) {
+ case "OpenAI":
+ return <IconOpenAI width={16} height={16} />
+ case "Anthropic":
+ return <IconAnthropic width={16} height={16} />
+ case "Moonshot AI":
+ return <IconMoonshotAI width={16} height={16} />
+ case "Z.ai":
+ return <IconZai width={16} height={16} />
+ case "Alibaba":
+ return <IconAlibaba width={16} height={16} />
+ case "xAI":
+ return <IconXai width={16} height={16} />
+ default:
+ return <IconStealth width={16} height={16} />
+ }
+ })()}
+ </td>
<td data-slot="model-name">{name}</td>
+ <td data-slot="model-lab">{lab}</td>
<td data-slot="model-toggle">
<form action={updateModel} method="post">
<input type="hidden" name="model" value={id} />