mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-23 10:44:21 +01:00
wip: zen
This commit is contained in:
@@ -10,9 +10,10 @@ const getModelsInfo = query(async (workspaceID: string) => {
|
|||||||
"use server"
|
"use server"
|
||||||
return withActor(async () => {
|
return withActor(async () => {
|
||||||
return {
|
return {
|
||||||
all: Object.keys(ZenModel.list())
|
all: Object.entries(ZenModel.list())
|
||||||
.filter((model) => !["claude-3-5-haiku", "qwen3-max"].includes(model))
|
.filter(([id, _model]) => !["claude-3-5-haiku", "qwen3-max"].includes(id))
|
||||||
.sort(([a], [b]) => a.localeCompare(b)),
|
.sort(([_idA, modelA], [_idB, modelB]) => modelA.name.localeCompare(modelB.name))
|
||||||
|
.map(([id, model]) => ({ id, name: model.name })),
|
||||||
disabled: await Model.listDisabled(),
|
disabled: await Model.listDisabled(),
|
||||||
}
|
}
|
||||||
}, workspaceID)
|
}, workspaceID)
|
||||||
@@ -62,14 +63,14 @@ export function ModelSection() {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<For each={modelsInfo()!.all}>
|
<For each={modelsInfo()!.all}>
|
||||||
{(modelId) => {
|
{({ id, name }) => {
|
||||||
const isEnabled = createMemo(() => !modelsInfo()!.disabled.includes(modelId))
|
const isEnabled = createMemo(() => !modelsInfo()!.disabled.includes(id))
|
||||||
return (
|
return (
|
||||||
<tr data-slot="model-row" data-disabled={!isEnabled()}>
|
<tr data-slot="model-row" data-disabled={!isEnabled()}>
|
||||||
<td data-slot="model-name">{ZenModel.list()[modelId].name}</td>
|
<td data-slot="model-name">{name}</td>
|
||||||
<td data-slot="model-toggle">
|
<td data-slot="model-toggle">
|
||||||
<form action={updateModel} method="post">
|
<form action={updateModel} method="post">
|
||||||
<input type="hidden" name="model" value={modelId} />
|
<input type="hidden" name="model" value={id} />
|
||||||
<input type="hidden" name="workspaceID" value={params.id} />
|
<input type="hidden" name="workspaceID" value={params.id} />
|
||||||
<input type="hidden" name="enabled" value={isEnabled().toString()} />
|
<input type="hidden" name="enabled" value={isEnabled().toString()} />
|
||||||
<label data-slot="model-toggle-label">
|
<label data-slot="model-toggle-label">
|
||||||
|
|||||||
Reference in New Issue
Block a user