feat: 用户添加模式失败时进行相应提示

This commit is contained in:
jiangwel
2025-08-28 14:55:04 +08:00
parent 441c0fa744
commit 217ec9934e
8 changed files with 23 additions and 14 deletions

View File

@@ -55,6 +55,7 @@ type GetProviderModelListReq struct {
type GetProviderModelListResp struct {
Models []ProviderModelListItem `json:"models"`
Error string `json:"error"`
}
type ProviderModelListItem struct {

View File

@@ -5,7 +5,7 @@ go 1.25.0
require (
entgo.io/ent v0.14.4
github.com/GoYoko/web v1.4.0
github.com/chaitin/ModelKit v1.6.2
github.com/chaitin/ModelKit v1.8.3
github.com/doquangtan/socket.io/v4 v4.0.8
github.com/golang-migrate/migrate/v4 v4.18.3
github.com/google/uuid v1.6.0

View File

@@ -54,8 +54,8 @@ github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFos
github.com/certifi/gocertifi v0.0.0-20190105021004-abcd57078448/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chaitin/ModelKit v1.6.2 h1:iw605mv1MCQwyud4nzblcgMe9pw8jvBG6Rv/UV40jzA=
github.com/chaitin/ModelKit v1.6.2/go.mod h1:IBeqs9T8+vxMXhoer8daV0yrSPb5uaoAwQQW2Tz2qAg=
github.com/chaitin/ModelKit v1.8.3 h1:qXhV4QYM7ZF2XZXlNQ2aaGd+9WU8K1xgThgWuP7MBNY=
github.com/chaitin/ModelKit v1.8.3/go.mod h1:IBeqs9T8+vxMXhoer8daV0yrSPb5uaoAwQQW2Tz2qAg=
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
github.com/cloudwego/eino v0.3.51 h1:emSaDu49v9EEJYOusL42Li/VL5QBSyBvhxO9ZcKPZvs=

View File

@@ -207,12 +207,16 @@ func (h *ModelHandler) GetProviderModelList(c *web.Context, req domain.GetProvid
APIHeader: req.APIHeader,
})
if err != nil {
return err
res := &domain.GetProviderModelListResp{
Error: err.Error(),
}
return c.Success(res)
}
// 将输出转化为monkeycode格式
res := &domain.GetProviderModelListResp{
Models: make([]domain.ProviderModelListItem, len(modelkitRes.Models)),
Error: modelkitRes.Error,
}
for i, model := range modelkitRes.Models {
res.Models[i] = domain.ProviderModelListItem{

View File

@@ -19,7 +19,7 @@
"@mui/icons-material": "^6.4.12",
"@mui/lab": "6.0.0-beta.19",
"@mui/material": "^6.4.12",
"@yokowu/modelkit-ui": "0.6.0",
"@yokowu/modelkit-ui": "0.7.1",
"ahooks": "^3.8.4",
"axios": "^1.9.0",
"dayjs": "^1.11.7",

10
ui/pnpm-lock.yaml generated
View File

@@ -33,8 +33,8 @@ importers:
specifier: ^6.4.12
version: 6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
'@yokowu/modelkit-ui':
specifier: 0.6.0
version: 0.6.0(8525073519bd78ecc27b6ab63a7efdab)
specifier: 0.7.1
version: 0.7.1(8525073519bd78ecc27b6ab63a7efdab)
ahooks:
specifier: ^3.8.4
version: 3.9.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
@@ -1111,8 +1111,8 @@ packages:
'@vue/shared@3.5.18':
resolution: {integrity: sha512-cZy8Dq+uuIXbxCZpuLd2GJdeSO/lIzIspC2WtkqIpje5QyFbvLaI5wZtdUjLHjGZrlVX6GilejatWwVYYRc8tA==}
'@yokowu/modelkit-ui@0.6.0':
resolution: {integrity: sha512-STKsF+4QXIgkZHRISxbhJEF5AdMkUvCIeIdwdYxQUkrlCENkLLyYijH63bxNSm6c/DVB+tYbSDHg8XdSFDI6KQ==}
'@yokowu/modelkit-ui@0.7.1':
resolution: {integrity: sha512-y83W1LLfKhw/gYurKox69HpCpyssZl1FetmEoQA8jy4VA/BhT7rzKBkso0VRa7XQ+x1sE43vxzIRh+aXETnJvQ==}
acorn-jsx@5.3.2:
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
@@ -3754,7 +3754,7 @@ snapshots:
'@vue/shared@3.5.18': {}
'@yokowu/modelkit-ui@0.6.0(8525073519bd78ecc27b6ab63a7efdab)':
'@yokowu/modelkit-ui@0.7.1(8525073519bd78ecc27b6ab63a7efdab)':
dependencies:
'@c-x/ui': 1.0.9(87983aa74373e7bdff176d7db35e2938)
'@mui/material': 6.5.0(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@emotion/styled@11.14.1(@emotion/react@11.14.0(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react@19.1.1))(@types/react@19.1.10)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)

View File

@@ -623,6 +623,7 @@ export interface DomainGetAndSaveReq {
export interface DomainGetProviderModelListResp {
models?: DomainProviderModelListItem[];
error?: string;
}
export interface DomainGrantGroupReq {

View File

@@ -141,11 +141,14 @@ export const modelService: IModelService = {
const localData = convertUIGetModelNameToLocal(data);
const result = await getGetProviderModelList(localData);
const models: UIModelListItem[] = result.models?.map(item => ({
model: item.model,
})) || [];
const models: UIModelListItem[] = result.models
? result.models.map(item => ({
model: item.model || '',
}))
: [];
const error: string = result.error || '';
return { models };
return { models, error };
},
async checkModel(data: UICheckModelData) {