intellif-aihub 0.1.22__py3-none-any.whl → 0.1.23__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of intellif-aihub might be problematic. Click here for more details.
- aihub/__init__.py +1 -1
- aihub/cli/__init__.py +1 -0
- aihub/cli/__main__.py +8 -0
- aihub/cli/config.py +136 -0
- aihub/cli/main.py +295 -0
- aihub/cli/model_center.py +355 -0
- aihub/models/model_center.py +80 -111
- aihub/services/model_center.py +202 -54
- aihub/utils/s3.py +49 -6
- {intellif_aihub-0.1.22.dist-info → intellif_aihub-0.1.23.dist-info}/METADATA +2 -1
- {intellif_aihub-0.1.22.dist-info → intellif_aihub-0.1.23.dist-info}/RECORD +15 -9
- intellif_aihub-0.1.23.dist-info/entry_points.txt +2 -0
- {intellif_aihub-0.1.22.dist-info → intellif_aihub-0.1.23.dist-info}/WHEEL +0 -0
- {intellif_aihub-0.1.22.dist-info → intellif_aihub-0.1.23.dist-info}/licenses/LICENSE +0 -0
- {intellif_aihub-0.1.22.dist-info → intellif_aihub-0.1.23.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""模型中心 CLI 命令模块"""
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.progress import Progress, SpinnerColumn, TextColumn
|
|
10
|
+
from rich.table import Table
|
|
11
|
+
|
|
12
|
+
from ..models.model_center import (
|
|
13
|
+
ListModelsRequest,
|
|
14
|
+
CreateModelRequest,
|
|
15
|
+
EditModelRequest,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
console = Console()
|
|
19
|
+
|
|
20
|
+
# 创建模型中心子应用
|
|
21
|
+
model_app = typer.Typer(
|
|
22
|
+
name="model",
|
|
23
|
+
help="模型中心相关命令",
|
|
24
|
+
no_args_is_help=True,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@model_app.command("list")
|
|
29
|
+
def list_models(
|
|
30
|
+
page_size: int = typer.Option(20, "--page-size", "-s", help="每页显示数量"),
|
|
31
|
+
page_num: int = typer.Option(1, "--page", "-p", help="页码"),
|
|
32
|
+
name: Optional[str] = typer.Option(None, "--name", "-n", help="按名称过滤"),
|
|
33
|
+
tags: Optional[str] = typer.Option(None, "--tags", "-t", help="按标签过滤"),
|
|
34
|
+
model_ids: Optional[str] = typer.Option(None, "--ids", help="按模型ID过滤(逗号分隔)"),
|
|
35
|
+
):
|
|
36
|
+
"""列出模型"""
|
|
37
|
+
from .main import get_client
|
|
38
|
+
|
|
39
|
+
try:
|
|
40
|
+
client = get_client()
|
|
41
|
+
|
|
42
|
+
with Progress(
|
|
43
|
+
SpinnerColumn(),
|
|
44
|
+
TextColumn("[progress.description]{task.description}"),
|
|
45
|
+
console=console,
|
|
46
|
+
) as progress:
|
|
47
|
+
task = progress.add_task("正在获取模型列表...", total=None)
|
|
48
|
+
|
|
49
|
+
request = ListModelsRequest(
|
|
50
|
+
page_size=page_size,
|
|
51
|
+
page_num=page_num,
|
|
52
|
+
name=name,
|
|
53
|
+
tags=tags,
|
|
54
|
+
model_ids=model_ids,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
response = client.model_center.list_models(request)
|
|
58
|
+
progress.remove_task(task)
|
|
59
|
+
|
|
60
|
+
if not response.data:
|
|
61
|
+
console.print("📭 没有找到模型")
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
# 创建表格显示结果
|
|
65
|
+
table = Table(title=f"模型列表 (第 {page_num} 页,共 {response.total} 个)")
|
|
66
|
+
table.add_column("ID", style="cyan", no_wrap=True)
|
|
67
|
+
table.add_column("名称", style="magenta")
|
|
68
|
+
table.add_column("描述", style="green")
|
|
69
|
+
table.add_column("公开", style="blue")
|
|
70
|
+
|
|
71
|
+
for model in response.data:
|
|
72
|
+
table.add_row(
|
|
73
|
+
str(model.id),
|
|
74
|
+
model.name,
|
|
75
|
+
model.description or "-",
|
|
76
|
+
"是" if model.is_public else "否",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
console.print(table)
|
|
80
|
+
|
|
81
|
+
# 显示分页信息
|
|
82
|
+
total_pages = (response.total + page_size - 1) // page_size
|
|
83
|
+
console.print(f"\n📄 第 {page_num}/{total_pages} 页,共 {response.total} 个模型")
|
|
84
|
+
|
|
85
|
+
except Exception as e:
|
|
86
|
+
console.print(f"❌ 获取模型列表失败: {e}", style="red")
|
|
87
|
+
raise typer.Exit(1)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@model_app.command("get")
|
|
91
|
+
def get_model(
|
|
92
|
+
model_id: int = typer.Argument(..., help="模型ID"),
|
|
93
|
+
):
|
|
94
|
+
"""获取模型详情"""
|
|
95
|
+
from .main import get_client
|
|
96
|
+
|
|
97
|
+
try:
|
|
98
|
+
client = get_client()
|
|
99
|
+
|
|
100
|
+
with Progress(
|
|
101
|
+
SpinnerColumn(),
|
|
102
|
+
TextColumn("[progress.description]{task.description}"),
|
|
103
|
+
console=console,
|
|
104
|
+
) as progress:
|
|
105
|
+
task = progress.add_task(f"正在获取模型 {model_id} 详情...", total=None)
|
|
106
|
+
model = client.model_center.get_model(model_id)
|
|
107
|
+
progress.remove_task(task)
|
|
108
|
+
|
|
109
|
+
# 显示模型详情
|
|
110
|
+
console.print(f"\n🤖 [bold]模型详情[/bold]")
|
|
111
|
+
console.print(f"ID: {model.id}")
|
|
112
|
+
console.print(f"名称: {model.name}")
|
|
113
|
+
console.print(f"描述: {model.description or '无'}")
|
|
114
|
+
console.print(f"标签: {model.tags or '无'}")
|
|
115
|
+
console.print(f"公开: {'是' if model.is_public else '否'}")
|
|
116
|
+
console.print(f"创建时间: {'_' if model.created_at else '未知'}")
|
|
117
|
+
|
|
118
|
+
if model.readme_content:
|
|
119
|
+
console.print(f"\n📖 [bold]README:[/bold]")
|
|
120
|
+
console.print(model.readme_content[:500] + ("..." if len(model.readme_content) > 500 else ""))
|
|
121
|
+
|
|
122
|
+
except Exception as e:
|
|
123
|
+
console.print(f"❌ 获取模型详情失败: {e}", style="red")
|
|
124
|
+
raise typer.Exit(1)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@model_app.command("create")
|
|
128
|
+
def create_model(
|
|
129
|
+
name: str = typer.Argument(..., help="模型名称"),
|
|
130
|
+
description: Optional[str] = typer.Option(None, "--description", "-d", help="模型描述"),
|
|
131
|
+
tags: Optional[str] = typer.Option(None, "--tags", "-t", help="模型标签"),
|
|
132
|
+
public: bool = typer.Option(True, "--public/--private", help="是否公开"),
|
|
133
|
+
readme: Optional[str] = typer.Option(None, "--readme", "-r", help="README 内容"),
|
|
134
|
+
):
|
|
135
|
+
"""创建模型"""
|
|
136
|
+
from .main import get_client
|
|
137
|
+
|
|
138
|
+
try:
|
|
139
|
+
client = get_client()
|
|
140
|
+
|
|
141
|
+
with Progress(
|
|
142
|
+
SpinnerColumn(),
|
|
143
|
+
TextColumn("[progress.description]{task.description}"),
|
|
144
|
+
console=console,
|
|
145
|
+
) as progress:
|
|
146
|
+
task = progress.add_task(f"正在创建模型 '{name}'...", total=None)
|
|
147
|
+
|
|
148
|
+
request = CreateModelRequest(
|
|
149
|
+
name=name,
|
|
150
|
+
description=description,
|
|
151
|
+
tags=tags,
|
|
152
|
+
is_public=public,
|
|
153
|
+
readme_content=readme,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
model_id = client.model_center.create_model(request)
|
|
157
|
+
progress.remove_task(task)
|
|
158
|
+
|
|
159
|
+
console.print(f"✅ 模型创建成功!")
|
|
160
|
+
console.print(f"模型ID: {model_id}")
|
|
161
|
+
console.print(f"名称: {name}")
|
|
162
|
+
|
|
163
|
+
except Exception as e:
|
|
164
|
+
console.print(f"❌ 创建模型失败: {e}", style="red")
|
|
165
|
+
raise typer.Exit(1)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@model_app.command("edit")
|
|
169
|
+
def edit_model(
|
|
170
|
+
model_id: int = typer.Argument(..., help="模型ID"),
|
|
171
|
+
name: Optional[str] = typer.Option(None, "--name", "-n", help="新的模型名称"),
|
|
172
|
+
description: Optional[str] = typer.Option(None, "--description", "-d", help="新的模型描述"),
|
|
173
|
+
public: Optional[bool] = typer.Option(None, "--public/--private", help="是否公开"),
|
|
174
|
+
):
|
|
175
|
+
"""编辑模型信息"""
|
|
176
|
+
from .main import get_client
|
|
177
|
+
|
|
178
|
+
try:
|
|
179
|
+
client = get_client()
|
|
180
|
+
|
|
181
|
+
with Progress(
|
|
182
|
+
SpinnerColumn(),
|
|
183
|
+
TextColumn("[progress.description]{task.description}"),
|
|
184
|
+
console=console,
|
|
185
|
+
) as progress:
|
|
186
|
+
task = progress.add_task(f"正在编辑模型 {model_id}...", total=None)
|
|
187
|
+
|
|
188
|
+
request = EditModelRequest(
|
|
189
|
+
name=name,
|
|
190
|
+
description=description,
|
|
191
|
+
is_public=public,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
client.model_center.edit_model(model_id, request)
|
|
195
|
+
progress.remove_task(task)
|
|
196
|
+
|
|
197
|
+
console.print(f"✅ 模型 {model_id} 编辑成功!")
|
|
198
|
+
|
|
199
|
+
except Exception as e:
|
|
200
|
+
console.print(f"❌ 编辑模型失败: {e}", style="red")
|
|
201
|
+
raise typer.Exit(1)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
@model_app.command("delete")
|
|
205
|
+
def delete_model(
|
|
206
|
+
model_id: int = typer.Argument(..., help="模型ID"),
|
|
207
|
+
force: bool = typer.Option(False, "--force", "-f", help="强制删除,不询问确认"),
|
|
208
|
+
):
|
|
209
|
+
"""删除模型"""
|
|
210
|
+
from .main import get_client
|
|
211
|
+
|
|
212
|
+
if not force:
|
|
213
|
+
confirm = typer.confirm(f"确定要删除模型 {model_id} 吗?此操作不可撤销!")
|
|
214
|
+
if not confirm:
|
|
215
|
+
console.print("❌ 操作已取消")
|
|
216
|
+
return
|
|
217
|
+
|
|
218
|
+
try:
|
|
219
|
+
client = get_client()
|
|
220
|
+
|
|
221
|
+
with Progress(
|
|
222
|
+
SpinnerColumn(),
|
|
223
|
+
TextColumn("[progress.description]{task.description}"),
|
|
224
|
+
console=console,
|
|
225
|
+
) as progress:
|
|
226
|
+
task = progress.add_task(f"正在删除模型 {model_id}...", total=None)
|
|
227
|
+
client.model_center.delete_model(model_id)
|
|
228
|
+
progress.remove_task(task)
|
|
229
|
+
|
|
230
|
+
console.print(f"✅ 模型 {model_id} 删除成功!")
|
|
231
|
+
|
|
232
|
+
except Exception as e:
|
|
233
|
+
console.print(f"❌ 删除模型失败: {e}", style="red")
|
|
234
|
+
raise typer.Exit(1)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@model_app.command("upload")
|
|
238
|
+
def upload_model(
|
|
239
|
+
local_dir: str = typer.Argument(..., help="本地模型目录路径"),
|
|
240
|
+
model_id: Optional[int] = typer.Option(None, "--model-id", help="模型ID"),
|
|
241
|
+
model_name: Optional[str] = typer.Option(None, "--model-name", help="模型名称"),
|
|
242
|
+
timeout: int = typer.Option(3600, "--timeout", help="上传超时时间(秒)"),
|
|
243
|
+
):
|
|
244
|
+
"""上传模型文件"""
|
|
245
|
+
from .main import get_client
|
|
246
|
+
|
|
247
|
+
# 验证参数
|
|
248
|
+
if not model_id and not model_name:
|
|
249
|
+
console.print("❌ 必须提供 --model-id 或 --model-name 参数", style="red")
|
|
250
|
+
raise typer.Exit(1)
|
|
251
|
+
|
|
252
|
+
local_path = Path(local_dir)
|
|
253
|
+
if not local_path.exists():
|
|
254
|
+
console.print(f"❌ 本地目录不存在: {local_dir}", style="red")
|
|
255
|
+
raise typer.Exit(1)
|
|
256
|
+
|
|
257
|
+
try:
|
|
258
|
+
client = get_client()
|
|
259
|
+
|
|
260
|
+
console.print(f"🚀 开始上传模型...")
|
|
261
|
+
console.print(f"本地目录: {local_dir}")
|
|
262
|
+
if model_id:
|
|
263
|
+
console.print(f"目标模型ID: {model_id}")
|
|
264
|
+
if model_name:
|
|
265
|
+
console.print(f"目标模型名称: {model_name}")
|
|
266
|
+
|
|
267
|
+
client.model_center.upload(
|
|
268
|
+
local_dir=str(local_path),
|
|
269
|
+
model_id=model_id,
|
|
270
|
+
model_name=model_name,
|
|
271
|
+
timeout_seconds=timeout,
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
console.print("✅ 模型上传成功!")
|
|
275
|
+
|
|
276
|
+
except Exception as e:
|
|
277
|
+
console.print(f"❌ 上传模型失败: {e}", style="red")
|
|
278
|
+
raise typer.Exit(1)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
@model_app.command("download")
|
|
282
|
+
def download_model(
|
|
283
|
+
local_dir: str = typer.Argument(..., help="下载到的本地目录路径"),
|
|
284
|
+
model_id: Optional[int] = typer.Option(None, "--model-id", help="模型ID"),
|
|
285
|
+
model_name: Optional[str] = typer.Option(None, "--model-name", help="模型名称"),
|
|
286
|
+
):
|
|
287
|
+
"""下载模型文件"""
|
|
288
|
+
from .main import get_client
|
|
289
|
+
|
|
290
|
+
# 验证参数
|
|
291
|
+
if not model_id and not model_name:
|
|
292
|
+
console.print("❌ 必须提供 --model-id 或 --model-name 参数", style="red")
|
|
293
|
+
raise typer.Exit(1)
|
|
294
|
+
|
|
295
|
+
try:
|
|
296
|
+
client = get_client()
|
|
297
|
+
|
|
298
|
+
console.print(f"📥 开始下载模型...")
|
|
299
|
+
if model_id:
|
|
300
|
+
console.print(f"模型ID: {model_id}")
|
|
301
|
+
if model_name:
|
|
302
|
+
console.print(f"模型名称: {model_name}")
|
|
303
|
+
console.print(f"下载目录: {local_dir}")
|
|
304
|
+
|
|
305
|
+
client.model_center.download(
|
|
306
|
+
local_dir=local_dir,
|
|
307
|
+
model_id=model_id,
|
|
308
|
+
model_name=model_name,
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
console.print("✅ 模型下载成功!")
|
|
312
|
+
|
|
313
|
+
except Exception as e:
|
|
314
|
+
console.print(f"❌ 下载模型失败: {e}", style="red")
|
|
315
|
+
raise typer.Exit(1)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
@model_app.command("info")
|
|
319
|
+
def model_info(
|
|
320
|
+
model_id: Optional[int] = typer.Option(None, "--model-id", help="模型ID"),
|
|
321
|
+
model_name: Optional[str] = typer.Option(None, "--model-name", help="模型名称"),
|
|
322
|
+
):
|
|
323
|
+
"""获取模型数据库信息"""
|
|
324
|
+
from .main import get_client
|
|
325
|
+
|
|
326
|
+
# 验证参数
|
|
327
|
+
if not model_id and not model_name:
|
|
328
|
+
console.print("❌ 必须提供 --model-id 或 --model-name 参数", style="red")
|
|
329
|
+
raise typer.Exit(1)
|
|
330
|
+
|
|
331
|
+
try:
|
|
332
|
+
client = get_client()
|
|
333
|
+
|
|
334
|
+
with Progress(
|
|
335
|
+
SpinnerColumn(),
|
|
336
|
+
TextColumn("[progress.description]{task.description}"),
|
|
337
|
+
console=console,
|
|
338
|
+
) as progress:
|
|
339
|
+
task = progress.add_task("正在获取模型信息...", total=None)
|
|
340
|
+
model_db = client.model_center.get_model_db(id=model_id, name=model_name)
|
|
341
|
+
progress.remove_task(task)
|
|
342
|
+
|
|
343
|
+
# 显示模型数据库信息
|
|
344
|
+
console.print(f"\n🗄️ [bold]模型数据库信息[/bold]")
|
|
345
|
+
console.print(f"ID: {model_db.id}")
|
|
346
|
+
console.print(f"名称: {model_db.name}")
|
|
347
|
+
console.print(f"状态: {model_db.status}")
|
|
348
|
+
console.print(f"对象存储路径: {model_db.object_storage_path or '无'}")
|
|
349
|
+
console.print(f"CSV文件路径: {model_db.csv_file_path or '无'}")
|
|
350
|
+
console.print(f"Parquet索引路径: {model_db.parquet_index_path or '无'}")
|
|
351
|
+
console.print(f"任务状态S3路径: {model_db.task_status_s3_path or '无'}")
|
|
352
|
+
|
|
353
|
+
except Exception as e:
|
|
354
|
+
console.print(f"❌ 获取模型信息失败: {e}", style="red")
|
|
355
|
+
raise typer.Exit(1)
|
aihub/models/model_center.py
CHANGED
|
@@ -1,112 +1,74 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from enum import IntEnum
|
|
4
3
|
from typing import List, Optional
|
|
5
4
|
|
|
6
|
-
from pydantic import BaseModel, Field, ConfigDict
|
|
5
|
+
from pydantic import BaseModel, Field, ConfigDict, field_validator
|
|
7
6
|
|
|
8
7
|
|
|
9
|
-
class
|
|
10
|
-
"""
|
|
8
|
+
class ListModelCard(BaseModel):
|
|
9
|
+
"""模型卡片"""
|
|
11
10
|
|
|
12
|
-
id: int = Field(description="
|
|
13
|
-
name: str = Field(description="
|
|
11
|
+
id: int = Field(alias="id", description="模型ID")
|
|
12
|
+
name: str = Field(alias="name", description="名称")
|
|
13
|
+
description: str = Field(alias="description", description="描述")
|
|
14
|
+
creator_id: int = Field(alias="creator_id", description="创建人ID")
|
|
15
|
+
creator_name: str = Field(alias="creator_name", description="创建人名称")
|
|
16
|
+
created_at: int = Field(alias="created_at", description="创建时间戳")
|
|
17
|
+
updated_at: int = Field(alias="updated_at", description="更新时间戳")
|
|
18
|
+
tags: List[int] = Field(default_factory=list, alias="tags", description="标签ID集合")
|
|
19
|
+
status: str = Field(alias="status", description="状态")
|
|
20
|
+
is_public: bool = Field(alias="is_public", description="是否公开")
|
|
14
21
|
|
|
22
|
+
@field_validator("tags", mode="before")
|
|
23
|
+
@classmethod
|
|
24
|
+
def _none_to_empty_list(cls, v):
|
|
25
|
+
return [] if v is None else v
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
"""模型类型"""
|
|
18
|
-
|
|
19
|
-
id: int = Field(description="类型ID")
|
|
20
|
-
name: str = Field(description="类型名称")
|
|
27
|
+
model_config = ConfigDict(protected_namespaces=())
|
|
21
28
|
|
|
22
29
|
|
|
23
|
-
class
|
|
24
|
-
"""
|
|
30
|
+
class ModelTreeNode(BaseModel):
|
|
31
|
+
"""模型树节点"""
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
name: str = Field(description="
|
|
33
|
+
model_id: int = Field(alias="model_id", description="模型ID")
|
|
34
|
+
name: str = Field(alias="name", description="名称")
|
|
35
|
+
relationship: str = Field(alias="relationship", description="与基模型关系")
|
|
28
36
|
|
|
37
|
+
model_config = ConfigDict(protected_namespaces=())
|
|
29
38
|
|
|
30
|
-
class QuantLevel(BaseModel):
|
|
31
|
-
"""量化等级"""
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
class ModelCardDetail(ListModelCard):
|
|
41
|
+
"""模型卡片详情"""
|
|
35
42
|
|
|
43
|
+
readme_content: str = Field(alias="readme_content", description="README 内容")
|
|
44
|
+
model_tree: Optional[List[ModelTreeNode]] = Field(default=None, alias="model_tree", description="模型树")
|
|
45
|
+
base_model: Optional[ModelTreeNode] = Field(default=None, alias="base_model", description="基模型")
|
|
46
|
+
file_storage_path: Optional[str] = Field(alias="file_storage_path", description="文件存储路径")
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
"""模型状态:1-Waiting;2-Creating;3-Success;4-Fail"""
|
|
39
|
-
Waiting = 1
|
|
40
|
-
Creating = 2
|
|
41
|
-
Success = 3
|
|
42
|
-
Fail = 4
|
|
48
|
+
model_config = ConfigDict(protected_namespaces=())
|
|
43
49
|
|
|
44
50
|
|
|
45
|
-
class
|
|
46
|
-
"""
|
|
51
|
+
class ModelDb(BaseModel):
|
|
52
|
+
"""模型"""
|
|
47
53
|
|
|
48
|
-
id: int = Field(description="
|
|
49
|
-
name: str = Field(description="
|
|
54
|
+
id: int = Field(description="ID")
|
|
55
|
+
name: str = Field(description="名称")
|
|
50
56
|
description: str = Field(description="描述")
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
page_size: int = Field(999, alias="page_size", description="每页数量")
|
|
68
|
-
page_num: int = Field(1, alias="page_num", description="当前页码")
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
class ListModelTypesResponse(BaseModel):
|
|
72
|
-
"""查询模型类型列表返回"""
|
|
73
|
-
|
|
74
|
-
total: int = Field(description="总条数")
|
|
75
|
-
page_size: int = Field(alias="page_size", description="每页数量")
|
|
76
|
-
page_num: int = Field(alias="page_num", description="当前页码")
|
|
77
|
-
data: List[ModelType] = Field(default_factory=list, description="类型列表")
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class ListDeployPlatformsRequest(BaseModel):
|
|
81
|
-
"""查询部署平台列表请求"""
|
|
82
|
-
|
|
83
|
-
page_size: int = Field(999, alias="page_size", description="每页数量")
|
|
84
|
-
page_num: int = Field(1, alias="page_num", description="当前页码")
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class ListDeployPlatformsResponse(BaseModel):
|
|
88
|
-
"""查询部署平台列表返回"""
|
|
89
|
-
|
|
90
|
-
total: int = Field(description="总条数")
|
|
91
|
-
page_size: int = Field(alias="page_size", description="每页数量")
|
|
92
|
-
page_num: int = Field(alias="page_num", description="当前页码")
|
|
93
|
-
data: List[DeployPlatform] = Field(default_factory=list, description="平台列表")
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
class ListQuantLevelsRequest(BaseModel):
|
|
97
|
-
"""查询量化等级列表请求"""
|
|
98
|
-
|
|
99
|
-
page_size: int = Field(999, alias="page_size", description="每页数量")
|
|
100
|
-
page_num: int = Field(1, alias="page_num", description="当前页码")
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
class ListQuantLevelsResponse(BaseModel):
|
|
104
|
-
"""查询量化等级列表返回"""
|
|
105
|
-
|
|
106
|
-
total: int = Field(description="总条数")
|
|
107
|
-
page_size: int = Field(alias="page_size", description="每页数量")
|
|
108
|
-
page_num: int = Field(alias="page_num", description="当前页码")
|
|
109
|
-
data: List[QuantLevel] = Field(default_factory=list, description="量化等级列表")
|
|
57
|
+
readme_content: str = Field(alias="readme_content", description="README")
|
|
58
|
+
user_id: int = Field(alias="user_id", description="创建人ID")
|
|
59
|
+
status: str = Field(description="状态")
|
|
60
|
+
is_public: bool = Field(alias="is_public", description="是否公开")
|
|
61
|
+
base_model_id: int = Field(alias="base_model_id", description="基模型ID")
|
|
62
|
+
relation: str = Field(description="与基模型关系")
|
|
63
|
+
object_cnt: int = Field(alias="object_cnt", description="对象数量")
|
|
64
|
+
data_size: int = Field(alias="data_size", description="数据大小")
|
|
65
|
+
object_storage_path: str = Field(alias="object_storage_path", description="对象存储路径")
|
|
66
|
+
file_storage_path: str = Field(alias="file_storage_path", description="文件存储路径")
|
|
67
|
+
parquet_index_path: str = Field(alias="parquet_index_path", description="Parquet 索引路径")
|
|
68
|
+
csv_file_path: str = Field(alias="csv_file_path", description="CSV 文件路径")
|
|
69
|
+
task_status_s3_path: str = Field(alias="task_status_s3_path", description="任务状态S3路径")
|
|
70
|
+
created_at: int = Field(alias="created_at", description="创建时间戳")
|
|
71
|
+
updated_at: int = Field(alias="updated_at", description="更新时间戳")
|
|
110
72
|
|
|
111
73
|
|
|
112
74
|
class ListModelsRequest(BaseModel):
|
|
@@ -114,46 +76,53 @@ class ListModelsRequest(BaseModel):
|
|
|
114
76
|
|
|
115
77
|
page_size: int = Field(20, alias="page_size", description="每页数量")
|
|
116
78
|
page_num: int = Field(1, alias="page_num", description="当前页码")
|
|
117
|
-
name: Optional[str] = Field(None, description="名称过滤")
|
|
79
|
+
name: Optional[str] = Field(default=None, alias="name", description="名称过滤")
|
|
80
|
+
tags: Optional[str] = Field(default=None, alias="tags", description="标签过滤")
|
|
81
|
+
model_ids: Optional[str] = Field(default=None, alias="model_ids", description="模型ID过滤")
|
|
82
|
+
|
|
83
|
+
model_config = ConfigDict(protected_namespaces=())
|
|
118
84
|
|
|
119
85
|
|
|
120
86
|
class ListModelsResponse(BaseModel):
|
|
121
87
|
"""查询模型列表返回"""
|
|
122
88
|
|
|
123
|
-
total: int = Field(description="总条数")
|
|
89
|
+
total: int = Field(alias="total", description="总条数")
|
|
124
90
|
page_size: int = Field(alias="page_size", description="每页数量")
|
|
125
91
|
page_num: int = Field(alias="page_num", description="当前页码")
|
|
126
|
-
data: List[
|
|
92
|
+
data: List[ListModelCard] = Field(default_factory=list, alias="data", description="模型卡片列表")
|
|
93
|
+
|
|
94
|
+
model_config = ConfigDict(protected_namespaces=())
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class GetModelRequest(BaseModel):
|
|
98
|
+
"""查询模型详情请求"""
|
|
99
|
+
|
|
100
|
+
id: int = Field(alias="id", description="模型ID")
|
|
127
101
|
|
|
128
102
|
|
|
129
103
|
class CreateModelRequest(BaseModel):
|
|
130
104
|
"""创建模型请求"""
|
|
131
105
|
|
|
132
|
-
name: str = Field(description="
|
|
133
|
-
description: Optional[str] = Field(None, description="描述")
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
param_cnt: Optional[str] = Field(None, alias="param_cnt", description="参数量")
|
|
138
|
-
quant_level_id: Optional[int] = Field(None, alias="quant_level_id", description="量化等级ID")
|
|
139
|
-
model_config = ConfigDict(protected_namespaces=())
|
|
106
|
+
name: str = Field(alias="name", description="名称")
|
|
107
|
+
description: Optional[str] = Field(default=None, alias="description", description="描述")
|
|
108
|
+
tags: Optional[str] = Field(default=None, alias="tags", description="标签")
|
|
109
|
+
is_public: bool = Field(alias="is_public", description="是否公开")
|
|
110
|
+
readme_content: Optional[str] = Field(default=None, description="README 文本内容")
|
|
140
111
|
|
|
141
112
|
|
|
142
113
|
class CreateModelResponse(BaseModel):
|
|
143
|
-
"""
|
|
144
|
-
|
|
145
|
-
id: int = Field(description="模型ID")
|
|
114
|
+
id: int = Field(alias="id", description="模型ID")
|
|
146
115
|
|
|
147
116
|
|
|
148
117
|
class EditModelRequest(BaseModel):
|
|
149
118
|
"""编辑模型请求"""
|
|
150
119
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
120
|
+
name: Optional[str] = Field(default=None, alias="name", description="名称")
|
|
121
|
+
description: Optional[str] = Field(default=None, alias="description", description="描述")
|
|
122
|
+
is_public: Optional[bool] = Field(default=None, alias="is_public", description="是否公开")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class EditModelResponse(BaseModel):
|
|
126
|
+
"""编辑模型返回"""
|
|
127
|
+
|
|
128
|
+
pass
|