Skip to content

Commit ca90c4c

Browse files
authored
Merge pull request #28 from chaitin/develop/jw
feat(ModelModal): 添加模型类型支持并更新依赖
2 parents e887508 + ce1ebfa commit ca90c4c

File tree

6 files changed

+173
-8
lines changed

6 files changed

+173
-8
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ require (
1414
github.com/cloudwego/eino-ext/components/model/openai v0.0.0-20250710065240-482d48888f25
1515
github.com/google/generative-ai-go v0.20.1
1616
github.com/google/uuid v1.6.0
17+
github.com/labstack/echo/v4 v4.13.4
1718
github.com/ollama/ollama v0.6.5
1819
github.com/yuin/goldmark v1.7.11
1920
google.golang.org/api v0.239.0
@@ -57,7 +58,6 @@ require (
5758
github.com/josharian/intern v1.0.0 // indirect
5859
github.com/json-iterator/go v1.1.12 // indirect
5960
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
60-
github.com/labstack/echo/v4 v4.13.4 // indirect
6161
github.com/labstack/gommon v0.4.2 // indirect
6262
github.com/leodido/go-urn v1.4.0 // indirect
6363
github.com/mailru/easyjson v0.9.0 // indirect

test/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,8 @@ func main() {
9797

9898
NewModelKit(echo, nil, false)
9999

100-
echo.Start(":8080")
100+
err := echo.Start(":8080")
101+
if err != nil {
102+
fmt.Println("err:", err)
103+
}
101104
}

ui/ModelModal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@yokowu/modelkit-ui",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "A reusable AI model configuration modal component for React applications",
55
"private": false,
66
"type": "module",

ui/ModelModal/src/ModelModal.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,22 @@ export const ModelModal: React.FC<ModelModalProps> = ({
376376
<Stack gap={1}>
377377
{Object.values(providers)
378378
.filter((it) => {
379-
// 当model_type为chat或llm时显示所有供应商
380-
if (model_type === 'chat' || model_type === 'llm' || model_type === 'code' || model_type === 'coder') {
381-
return true;
379+
// 根据model_type和provider配置决定是否显示
380+
switch (model_type) {
381+
case 'chat':
382+
case 'llm':
383+
return it.chat;
384+
case 'code':
385+
case 'coder':
386+
return it.code;
387+
case 'embedding':
388+
return it.embedding;
389+
case 'rerank':
390+
case 'reranker':
391+
return it.rerank;
392+
default:
393+
return it.label === 'BaiZhiCloud' || it.label === 'Other';
382394
}
383-
// 其他情况只显示百智云和其它
384-
return it.label === 'BaiZhiCloud' || it.label === 'Other';
385395
})
386396
.map((it) => (
387397
<Stack

0 commit comments

Comments
 (0)