mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-02-05 16:24:11 +08:00
feat(model): 模型支持高级配置
This commit is contained in:
40
ui/src/api/Cli.ts
Normal file
40
ui/src/api/Cli.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
||||
* ## ##
|
||||
* ## AUTHOR: acacode ##
|
||||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import request, { ContentType, RequestParams } from "./httpClient";
|
||||
import { DomainCodeFiles, DomainIndexResult, V1CliCreateParams } from "./types";
|
||||
|
||||
/**
|
||||
* @description 运行monkeycode-cli命令
|
||||
*
|
||||
* @tags CLI
|
||||
* @name V1CliCreate
|
||||
* @summary 运行monkeycode-cli命令
|
||||
* @request POST:/api/v1/cli/{command}
|
||||
* @response `200` `(DomainIndexResult)[]` 输出结果
|
||||
* @response `500` `WebResp` 内部错误
|
||||
*/
|
||||
|
||||
export const v1CliCreate = (
|
||||
{ command, ...query }: V1CliCreateParams,
|
||||
codeFiles: DomainCodeFiles,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<DomainIndexResult[]>({
|
||||
path: `/api/v1/cli/${command}`,
|
||||
method: "POST",
|
||||
query: query,
|
||||
body: codeFiles,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
312
ui/src/api/WorkspaceFile.ts
Normal file
312
ui/src/api/WorkspaceFile.ts
Normal file
@@ -0,0 +1,312 @@
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
||||
* ## ##
|
||||
* ## AUTHOR: acacode ##
|
||||
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import request, { ContentType, RequestParams } from "./httpClient";
|
||||
import {
|
||||
DomainBatchCreateWorkspaceFileReq,
|
||||
DomainBatchUpdateWorkspaceFileReq,
|
||||
DomainCreateWorkspaceFileReq,
|
||||
DomainGetAndSaveReq,
|
||||
DomainListWorkspaceFileResp,
|
||||
DomainSyncWorkspaceFileReq,
|
||||
DomainSyncWorkspaceFileResp,
|
||||
DomainUpdateWorkspaceFileReq,
|
||||
DomainWorkspaceFile,
|
||||
GetGetWorkspaceFileByPathParams,
|
||||
GetListWorkspaceFilesParams,
|
||||
WebResp,
|
||||
} from "./types";
|
||||
|
||||
/**
|
||||
* @description 分页获取工作区文件列表
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name GetListWorkspaceFiles
|
||||
* @summary 获取工作区文件列表
|
||||
* @request GET:/api/v1/workspace/files
|
||||
* @response `200` `(WebResp & {
|
||||
data?: DomainListWorkspaceFileResp,
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const getListWorkspaceFiles = (
|
||||
query: GetListWorkspaceFilesParams,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainListWorkspaceFileResp;
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/workspace/files`,
|
||||
method: "GET",
|
||||
query: query,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 创建一个新的工作区文件
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name PostCreateWorkspaceFile
|
||||
* @summary 创建工作区文件
|
||||
* @request POST:/api/v1/workspace/files
|
||||
* @response `200` `(WebResp & {
|
||||
data?: DomainWorkspaceFile,
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const postCreateWorkspaceFile = (
|
||||
file: DomainCreateWorkspaceFileReq,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainWorkspaceFile;
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/workspace/files`,
|
||||
method: "POST",
|
||||
body: file,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 批量更新多个工作区文件
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name PutBatchUpdateWorkspaceFiles
|
||||
* @summary 批量更新工作区文件
|
||||
* @request PUT:/api/v1/workspace/files/batch
|
||||
* @response `200` `(WebResp & {
|
||||
data?: (DomainWorkspaceFile)[],
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const putBatchUpdateWorkspaceFiles = (
|
||||
files: DomainBatchUpdateWorkspaceFileReq,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainWorkspaceFile[];
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/workspace/files/batch`,
|
||||
method: "PUT",
|
||||
body: files,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 批量创建多个工作区文件
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name PostBatchCreateWorkspaceFiles
|
||||
* @summary 批量创建工作区文件
|
||||
* @request POST:/api/v1/workspace/files/batch
|
||||
* @response `200` `(WebResp & {
|
||||
data?: (DomainWorkspaceFile)[],
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const postBatchCreateWorkspaceFiles = (
|
||||
files: DomainBatchCreateWorkspaceFileReq,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainWorkspaceFile[];
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/workspace/files/batch`,
|
||||
method: "POST",
|
||||
body: files,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 根据用户ID、项目ID和文件路径获取工作区文件
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name GetGetWorkspaceFileByPath
|
||||
* @summary 根据路径获取工作区文件
|
||||
* @request GET:/api/v1/workspace/files/by-path
|
||||
* @response `200` `(WebResp & {
|
||||
data?: DomainWorkspaceFile,
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const getGetWorkspaceFileByPath = (
|
||||
query: GetGetWorkspaceFileByPathParams,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainWorkspaceFile;
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/workspace/files/by-path`,
|
||||
method: "GET",
|
||||
query: query,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* No description
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name V1WorkspaceFilesGetAndSaveCreate
|
||||
* @summary 获取并保存工作区文件
|
||||
* @request POST:/api/v1/workspace/files/get-and-save
|
||||
* @response `200` `WebResp` OK
|
||||
*/
|
||||
|
||||
export const v1WorkspaceFilesGetAndSaveCreate = (
|
||||
req: DomainGetAndSaveReq,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<WebResp>({
|
||||
path: `/api/v1/workspace/files/get-and-save`,
|
||||
method: "POST",
|
||||
body: req,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 同步本地文件到工作区,智能检测新增、修改和删除
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name PostSyncWorkspaceFiles
|
||||
* @summary 同步工作区文件
|
||||
* @request POST:/api/v1/workspace/files/sync
|
||||
* @response `200` `(WebResp & {
|
||||
data?: DomainSyncWorkspaceFileResp,
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const postSyncWorkspaceFiles = (
|
||||
sync: DomainSyncWorkspaceFileReq,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainSyncWorkspaceFileResp;
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/workspace/files/sync`,
|
||||
method: "POST",
|
||||
body: sync,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 根据文件ID获取工作区文件详情
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name GetGetWorkspaceFileById
|
||||
* @summary 根据ID获取工作区文件
|
||||
* @request GET:/api/v1/workspace/files/{id}
|
||||
* @response `200` `(WebResp & {
|
||||
data?: DomainWorkspaceFile,
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const getGetWorkspaceFileById = (
|
||||
id: string,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainWorkspaceFile;
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/workspace/files/${id}`,
|
||||
method: "GET",
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 更新指定的工作区文件
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name PutUpdateWorkspaceFile
|
||||
* @summary 更新工作区文件
|
||||
* @request PUT:/api/v1/workspace/files/{id}
|
||||
* @response `200` `(WebResp & {
|
||||
data?: DomainWorkspaceFile,
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const putUpdateWorkspaceFile = (
|
||||
id: string,
|
||||
file: DomainUpdateWorkspaceFileReq,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainWorkspaceFile;
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/workspace/files/${id}`,
|
||||
method: "PUT",
|
||||
body: file,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 删除指定的工作区文件
|
||||
*
|
||||
* @tags WorkspaceFile
|
||||
* @name DeleteDeleteWorkspaceFile
|
||||
* @summary 删除工作区文件
|
||||
* @request DELETE:/api/v1/workspace/files/{id}
|
||||
* @response `200` `WebResp` OK
|
||||
*/
|
||||
|
||||
export const deleteDeleteWorkspaceFile = (
|
||||
id: string,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<WebResp>({
|
||||
path: `/api/v1/workspace/files/${id}`,
|
||||
method: "DELETE",
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
export * from './Admin'
|
||||
export * from './Billing'
|
||||
export * from './Cli'
|
||||
export * from './Dashboard'
|
||||
export * from './Model'
|
||||
export * from './OpenAiv1'
|
||||
@@ -7,5 +8,6 @@ export * from './User'
|
||||
export * from './UserDashboard'
|
||||
export * from './UserManage'
|
||||
export * from './UserRecord'
|
||||
export * from './WorkspaceFile'
|
||||
export * from './types'
|
||||
|
||||
|
||||
@@ -10,6 +10,24 @@
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
export enum DomainCodeLanguageType {
|
||||
CodeLanguageTypeGo = "go",
|
||||
CodeLanguageTypePython = "python",
|
||||
CodeLanguageTypeJava = "java",
|
||||
CodeLanguageTypeJavaScript = "javascript",
|
||||
CodeLanguageTypeTypeScript = "typescript",
|
||||
CodeLanguageTypeJSX = "jsx",
|
||||
CodeLanguageTypeTSX = "tsx",
|
||||
CodeLanguageTypeHTML = "html",
|
||||
CodeLanguageTypeCSS = "css",
|
||||
CodeLanguageTypePHP = "php",
|
||||
CodeLanguageTypeRust = "rust",
|
||||
CodeLanguageTypeSwift = "swift",
|
||||
CodeLanguageTypeKotlin = "kotlin",
|
||||
CodeLanguageTypeC = "c",
|
||||
CodeLanguageTypeCpp = "cpp",
|
||||
}
|
||||
|
||||
export enum ConstsUserStatus {
|
||||
UserStatusActive = "active",
|
||||
UserStatusInactive = "inactive",
|
||||
@@ -27,6 +45,9 @@ export enum ConstsReportAction {
|
||||
ReportActionSuggest = "suggest",
|
||||
ReportActionFileWritten = "file_written",
|
||||
ReportActionReject = "reject",
|
||||
ReportActionNewTask = "new_task",
|
||||
ReportActionFeedbackTask = "feedback_task",
|
||||
ReportActionAbortTask = "abort_task",
|
||||
}
|
||||
|
||||
export enum ConstsModelType {
|
||||
@@ -109,6 +130,20 @@ export interface DomainAllModelResp {
|
||||
providers?: DomainProviderModel[];
|
||||
}
|
||||
|
||||
export interface DomainBatchCreateWorkspaceFileReq {
|
||||
/** 文件列表 */
|
||||
files: DomainCreateWorkspaceFileReq[];
|
||||
/** 用户ID */
|
||||
user_id: string;
|
||||
/** 工作区ID */
|
||||
workspace_id: string;
|
||||
}
|
||||
|
||||
export interface DomainBatchUpdateWorkspaceFileReq {
|
||||
/** 文件列表 */
|
||||
files: DomainUpdateWorkspaceFileReq[];
|
||||
}
|
||||
|
||||
export interface DomainCategoryPoint {
|
||||
/** 分类 */
|
||||
category?: string;
|
||||
@@ -127,7 +162,7 @@ export interface DomainChatContent {
|
||||
/** 内容 */
|
||||
content?: string;
|
||||
created_at?: number;
|
||||
/** 角色,如user: 用户的提问 assistant: 机器人回复 */
|
||||
/** 角色,如user: 用户的提问 assistant: 机器人回复 system: 系统消息 */
|
||||
role?: ConstsChatRole;
|
||||
}
|
||||
|
||||
@@ -170,6 +205,10 @@ export interface DomainCheckModelReq {
|
||||
type: "llm" | "coder" | "embedding" | "rerank";
|
||||
}
|
||||
|
||||
export interface DomainCodeFiles {
|
||||
files?: DomainFileMeta[];
|
||||
}
|
||||
|
||||
export interface DomainCompletionData {
|
||||
/** 代码行数 */
|
||||
code_lines?: number;
|
||||
@@ -255,6 +294,8 @@ export interface DomainCreateModelReq {
|
||||
model_name: string;
|
||||
/** 模型类型 llm:对话模型 coder:代码模型 */
|
||||
model_type?: ConstsModelType;
|
||||
/** 高级参数 */
|
||||
param?: DomainModelParam;
|
||||
/** 提供商 */
|
||||
provider:
|
||||
| "SiliconFlow"
|
||||
@@ -272,6 +313,23 @@ export interface DomainCreateModelReq {
|
||||
show_name?: string;
|
||||
}
|
||||
|
||||
export interface DomainCreateWorkspaceFileReq {
|
||||
/** 文件内容 */
|
||||
content?: string;
|
||||
/** 文件哈希 */
|
||||
hash: string;
|
||||
/** 编程语言 */
|
||||
language?: string;
|
||||
/** 文件路径 */
|
||||
path: string;
|
||||
/** 文件大小 */
|
||||
size?: number;
|
||||
/** 用户ID */
|
||||
user_id: string;
|
||||
/** 工作区ID */
|
||||
workspace_id: string;
|
||||
}
|
||||
|
||||
export interface DomainCustomOAuth {
|
||||
/** 自定义OAuth访问令牌URL */
|
||||
access_token_url?: string;
|
||||
@@ -347,6 +405,26 @@ export interface DomainExportCompletionDataResp {
|
||||
total_count?: number;
|
||||
}
|
||||
|
||||
export interface DomainFileMeta {
|
||||
/** 文件内容(可选) */
|
||||
content?: string;
|
||||
fileExtension?: string;
|
||||
/** 文件哈希(可选) */
|
||||
fileHash?: string;
|
||||
filePath?: string;
|
||||
/** 语言类型(可选) */
|
||||
language?: DomainCodeLanguageType;
|
||||
}
|
||||
|
||||
export interface DomainGetAndSaveReq {
|
||||
/** 代码文件信息 */
|
||||
code_files: DomainFileMeta[];
|
||||
/** 用户ID */
|
||||
user_id: string;
|
||||
/** 项目ID */
|
||||
workspace_id: string;
|
||||
}
|
||||
|
||||
export interface DomainGetProviderModelListResp {
|
||||
models?: DomainProviderModelListItem[];
|
||||
}
|
||||
@@ -366,6 +444,26 @@ export interface DomainIPInfo {
|
||||
province?: string;
|
||||
}
|
||||
|
||||
export interface DomainIndexResult {
|
||||
definition?: {
|
||||
name?: string;
|
||||
returnType?: string;
|
||||
type?: string;
|
||||
};
|
||||
definitionText?: string;
|
||||
endLine?: number;
|
||||
fileHash?: string;
|
||||
filePath?: string;
|
||||
implementText?: string;
|
||||
language?: string;
|
||||
name?: string;
|
||||
rangeText?: string;
|
||||
scope?: Record<string, any>[];
|
||||
signature?: string;
|
||||
startLine?: number;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface DomainInviteResp {
|
||||
/** 邀请码 */
|
||||
code?: string;
|
||||
@@ -413,6 +511,13 @@ export interface DomainListUserResp {
|
||||
users?: DomainUser[];
|
||||
}
|
||||
|
||||
export interface DomainListWorkspaceFileResp {
|
||||
files?: DomainWorkspaceFile[];
|
||||
has_next_page?: boolean;
|
||||
next_token?: string;
|
||||
total_count?: number;
|
||||
}
|
||||
|
||||
export interface DomainLoginReq {
|
||||
/** 密码 */
|
||||
password?: string;
|
||||
@@ -459,6 +564,8 @@ export interface DomainModel {
|
||||
model_type?: ConstsModelType;
|
||||
/** 输出token数 */
|
||||
output?: number;
|
||||
/** 高级参数 */
|
||||
param?: DomainModelParam;
|
||||
/** 提供商 */
|
||||
provider?: ConstsModelProvider;
|
||||
/** 模型显示名称 */
|
||||
@@ -506,6 +613,15 @@ export interface DomainModelListResp {
|
||||
object?: string;
|
||||
}
|
||||
|
||||
export interface DomainModelParam {
|
||||
context_window?: number;
|
||||
max_tokens?: number;
|
||||
r1_enabled?: boolean;
|
||||
support_computer_use?: boolean;
|
||||
support_images?: boolean;
|
||||
support_prompt_cache?: boolean;
|
||||
}
|
||||
|
||||
export interface DomainModelTokenUsage {
|
||||
/** 时间戳 */
|
||||
timestamp?: number;
|
||||
@@ -569,6 +685,8 @@ export interface DomainReportReq {
|
||||
cursor_position?: Record<string, any>;
|
||||
/** task_id or resp_id */
|
||||
id?: string;
|
||||
/** 模式 */
|
||||
mode?: string;
|
||||
/** 当前文件的原文(用于reject action) */
|
||||
source_code?: string;
|
||||
/** 工具 */
|
||||
@@ -603,6 +721,26 @@ export interface DomainStatistics {
|
||||
total_users?: number;
|
||||
}
|
||||
|
||||
export interface DomainSyncWorkspaceFileReq {
|
||||
/** 要同步的文件列表 */
|
||||
files: DomainCreateWorkspaceFileReq[];
|
||||
/** 用户ID */
|
||||
user_id: string;
|
||||
/** 工作区ID */
|
||||
workspace_id: string;
|
||||
}
|
||||
|
||||
export interface DomainSyncWorkspaceFileResp {
|
||||
/** 新创建的文件 */
|
||||
created?: DomainWorkspaceFile[];
|
||||
/** 删除的文件ID */
|
||||
deleted?: string[];
|
||||
/** 处理的文件总数 */
|
||||
total?: number;
|
||||
/** 更新的文件 */
|
||||
updated?: DomainWorkspaceFile[];
|
||||
}
|
||||
|
||||
export interface DomainTimeStat {
|
||||
/** 接受率统计 */
|
||||
accepted_per?: {
|
||||
@@ -669,6 +807,8 @@ export interface DomainUpdateModelReq {
|
||||
id?: string;
|
||||
/** 模型名称 */
|
||||
model_name?: string;
|
||||
/** 高级参数 */
|
||||
param?: DomainModelParam;
|
||||
/** 提供商 */
|
||||
provider:
|
||||
| "SiliconFlow"
|
||||
@@ -712,6 +852,19 @@ export interface DomainUpdateUserReq {
|
||||
status?: ConstsUserStatus;
|
||||
}
|
||||
|
||||
export interface DomainUpdateWorkspaceFileReq {
|
||||
/** 文件内容 */
|
||||
content?: string;
|
||||
/** 文件哈希 */
|
||||
hash?: string;
|
||||
/** 文件ID */
|
||||
id: string;
|
||||
/** 编程语言 */
|
||||
language?: string;
|
||||
/** 文件大小 */
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface DomainUser {
|
||||
/** 头像URL */
|
||||
avatar_url?: string;
|
||||
@@ -819,6 +972,29 @@ export interface DomainUserStat {
|
||||
work_mode?: DomainCategoryPoint[];
|
||||
}
|
||||
|
||||
export interface DomainWorkspaceFile {
|
||||
/** 文件内容 */
|
||||
content?: string;
|
||||
/** 创建时间 */
|
||||
created_at?: number;
|
||||
/** 文件哈希 */
|
||||
hash?: string;
|
||||
/** 文件ID */
|
||||
id?: string;
|
||||
/** 编程语言 */
|
||||
language?: string;
|
||||
/** 文件路径 */
|
||||
path?: string;
|
||||
/** 文件大小 */
|
||||
size?: number;
|
||||
/** 更新时间 */
|
||||
updated_at?: number;
|
||||
/** 用户ID */
|
||||
user_id?: string;
|
||||
/** 工作区ID */
|
||||
workspace_id?: string;
|
||||
}
|
||||
|
||||
export interface WebResp {
|
||||
code?: number;
|
||||
data?: unknown;
|
||||
@@ -833,18 +1009,34 @@ export interface DeleteDeleteAdminParams {
|
||||
export interface GetListAdminUserParams {
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/** 分页 */
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 每页多少条记录 */
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface GetAdminLoginHistoryParams {
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/** 分页 */
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 每页多少条记录 */
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
}
|
||||
|
||||
@@ -862,9 +1054,17 @@ export interface GetListChatRecordParams {
|
||||
language?: string;
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/** 分页 */
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 每页多少条记录 */
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
/** 工作模式 */
|
||||
work_mode?: string;
|
||||
@@ -884,14 +1084,29 @@ export interface GetListCompletionRecordParams {
|
||||
language?: string;
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/** 分页 */
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 每页多少条记录 */
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
/** 工作模式 */
|
||||
work_mode?: string;
|
||||
}
|
||||
|
||||
export interface V1CliCreateParams {
|
||||
/** 标志 */
|
||||
flag?: string;
|
||||
/** 命令 */
|
||||
command: string;
|
||||
}
|
||||
|
||||
export interface GetCategoryStatDashboardParams {
|
||||
/**
|
||||
* 持续时间 (小时或天数)`
|
||||
@@ -1029,9 +1244,17 @@ export interface GetUserListChatRecordParams {
|
||||
language?: string;
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/** 分页 */
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 每页多少条记录 */
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
/** 工作模式 */
|
||||
work_mode?: string;
|
||||
@@ -1051,9 +1274,17 @@ export interface GetUserListCompletionRecordParams {
|
||||
language?: string;
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/** 分页 */
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 每页多少条记录 */
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
/** 工作模式 */
|
||||
work_mode?: string;
|
||||
@@ -1101,18 +1332,34 @@ export interface DeleteDeleteUserParams {
|
||||
export interface GetListUserParams {
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/** 分页 */
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 每页多少条记录 */
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface GetLoginHistoryParams {
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/** 分页 */
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 每页多少条记录 */
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
}
|
||||
|
||||
@@ -1136,3 +1383,37 @@ export interface GetUserOauthSignupOrInParams {
|
||||
*/
|
||||
source: "plugin" | "browser";
|
||||
}
|
||||
|
||||
export interface GetListWorkspaceFilesParams {
|
||||
/** 编程语言筛选 */
|
||||
language?: string;
|
||||
/** 下一页标识 */
|
||||
next_token?: string;
|
||||
/**
|
||||
* 分页
|
||||
* @min 1
|
||||
* @default 1
|
||||
*/
|
||||
page?: number;
|
||||
/** 搜索关键词(文件路径) */
|
||||
search?: string;
|
||||
/**
|
||||
* 每页多少条记录
|
||||
* @min 1
|
||||
* @default 10
|
||||
*/
|
||||
size?: number;
|
||||
/** 用户ID */
|
||||
user_id?: string;
|
||||
/** 工作区ID */
|
||||
workspace_id?: string;
|
||||
}
|
||||
|
||||
export interface GetGetWorkspaceFileByPathParams {
|
||||
/** 用户ID */
|
||||
user_id?: string;
|
||||
/** 项目ID */
|
||||
project_id: string;
|
||||
/** 文件路径 */
|
||||
path: string;
|
||||
}
|
||||
|
||||
@@ -15,10 +15,16 @@ import {
|
||||
TextField,
|
||||
useTheme,
|
||||
alpha as addOpacityToColor,
|
||||
Accordion,
|
||||
AccordionSummary,
|
||||
AccordionDetails,
|
||||
Checkbox,
|
||||
FormControlLabel,
|
||||
} from '@mui/material';
|
||||
import { Icon, message, Modal } from '@c-x/ui';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||
interface AddModelProps {
|
||||
open: boolean;
|
||||
data: DomainModel | null;
|
||||
@@ -37,6 +43,13 @@ interface AddModelForm {
|
||||
api_header_value: string;
|
||||
type: ConstsModelType;
|
||||
show_name: string;
|
||||
// 高级设置字段
|
||||
context_window_size: number;
|
||||
max_output_tokens: number;
|
||||
enable_r1_params: boolean;
|
||||
support_image: boolean;
|
||||
support_compute: boolean;
|
||||
support_prompt_caching: boolean;
|
||||
}
|
||||
|
||||
const titleMap = {
|
||||
@@ -76,6 +89,13 @@ const ModelAdd = ({
|
||||
api_header_key: '',
|
||||
api_header_value: '',
|
||||
show_name: '',
|
||||
// 高级设置默认值
|
||||
context_window_size: 64000,
|
||||
max_output_tokens: 8192,
|
||||
enable_r1_params: false,
|
||||
support_image: false,
|
||||
support_compute: false,
|
||||
support_prompt_caching: false,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -87,6 +107,7 @@ const ModelAdd = ({
|
||||
const [modelLoading, setModelLoading] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
const [success, setSuccess] = useState(false);
|
||||
const [expandAdvanced, setExpandAdvanced] = useState(false);
|
||||
|
||||
const handleReset = () => {
|
||||
onClose();
|
||||
@@ -99,12 +120,21 @@ const ModelAdd = ({
|
||||
api_version: '',
|
||||
api_header_key: '',
|
||||
api_header_value: '',
|
||||
// 重置高级设置
|
||||
context_window_size: 64000,
|
||||
max_output_tokens: 8192,
|
||||
enable_r1_params: false,
|
||||
support_image: false,
|
||||
support_compute: false,
|
||||
support_prompt_caching: false,
|
||||
});
|
||||
setModelUserList([]);
|
||||
setSuccess(false);
|
||||
setLoading(false);
|
||||
setModelLoading(false);
|
||||
setError('');
|
||||
// 重置高级设置的展开状态
|
||||
setExpandAdvanced(false);
|
||||
refresh();
|
||||
};
|
||||
|
||||
@@ -171,6 +201,15 @@ const ModelAdd = ({
|
||||
id: data.id,
|
||||
provider: value.provider as Exclude<typeof value.provider, 'Other'>,
|
||||
show_name: value.show_name,
|
||||
// 添加高级设置字段到 param 对象中
|
||||
param: {
|
||||
context_window: value.context_window_size,
|
||||
max_tokens: value.max_output_tokens,
|
||||
r1_enabled: value.enable_r1_params,
|
||||
support_images: value.support_image,
|
||||
support_computer_use: value.support_compute,
|
||||
support_prompt_cache: value.support_prompt_caching,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
message.success('修改成功');
|
||||
@@ -188,6 +227,15 @@ const ModelAdd = ({
|
||||
api_header: header,
|
||||
provider: value.provider as Exclude<typeof value.provider, 'Other'>,
|
||||
show_name: value.show_name,
|
||||
// 添加高级设置字段到 param 对象中
|
||||
param: {
|
||||
context_window: value.context_window_size,
|
||||
max_tokens: value.max_output_tokens,
|
||||
r1_enabled: value.enable_r1_params,
|
||||
support_images: value.support_image,
|
||||
support_computer_use: value.support_compute,
|
||||
support_prompt_cache: value.support_prompt_caching,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
message.success('添加成功');
|
||||
@@ -216,6 +264,12 @@ const ModelAdd = ({
|
||||
api_header_value: value.api_header?.split('=')[1] || '',
|
||||
type,
|
||||
show_name: value.show_name || '',
|
||||
context_window_size: 64000,
|
||||
max_output_tokens: 8192,
|
||||
enable_r1_params: false,
|
||||
support_image: false,
|
||||
support_compute: false,
|
||||
support_prompt_caching: false
|
||||
});
|
||||
}
|
||||
reset({
|
||||
@@ -228,6 +282,12 @@ const ModelAdd = ({
|
||||
api_header_key: value.api_header?.split('=')[0] || '',
|
||||
api_header_value: value.api_header?.split('=')[1] || '',
|
||||
show_name: value.show_name || '',
|
||||
context_window_size: value.param?.context_window || 64000,
|
||||
max_output_tokens: value.param?.max_tokens || 8192,
|
||||
enable_r1_params: value.param?.r1_enabled || false,
|
||||
support_image: value.param?.support_images || false,
|
||||
support_compute: value.param?.support_computer_use || false,
|
||||
support_prompt_caching: value.param?.support_prompt_cache || false
|
||||
});
|
||||
};
|
||||
|
||||
@@ -247,8 +307,17 @@ const ModelAdd = ({
|
||||
api_header_key: '',
|
||||
api_header_value: '',
|
||||
show_name: '',
|
||||
// 高级设置默认值
|
||||
context_window_size: 64000,
|
||||
max_output_tokens: 8192,
|
||||
enable_r1_params: false,
|
||||
support_image: false,
|
||||
support_compute: false,
|
||||
support_prompt_caching: false,
|
||||
});
|
||||
}
|
||||
// 确保每次打开时高级设置都是折叠的
|
||||
setExpandAdvanced(false);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [data, open]);
|
||||
@@ -322,6 +391,13 @@ const ModelAdd = ({
|
||||
api_header_key: '',
|
||||
api_header_value: '',
|
||||
show_name: '',
|
||||
// 重置高级设置
|
||||
context_window_size: 64000,
|
||||
max_output_tokens: 8192,
|
||||
enable_r1_params: false,
|
||||
support_image: false,
|
||||
support_compute: false,
|
||||
support_prompt_caching: false,
|
||||
});
|
||||
}
|
||||
}}
|
||||
@@ -589,6 +665,219 @@ const ModelAdd = ({
|
||||
</Stack>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 高级设置部分 */}
|
||||
<Box sx={{ mt: 2 }}>
|
||||
<Accordion
|
||||
sx={{
|
||||
boxShadow: 'none',
|
||||
bgcolor: 'transparent',
|
||||
'&:before': {
|
||||
display: 'none',
|
||||
},
|
||||
'& .MuiAccordionSummary-root': {
|
||||
padding: 0,
|
||||
minHeight: 'auto',
|
||||
'& .MuiAccordionSummary-content': {
|
||||
margin: 0,
|
||||
},
|
||||
},
|
||||
'& .MuiAccordionDetails-root': {
|
||||
padding: 0,
|
||||
paddingTop: 1.5,
|
||||
},
|
||||
}}
|
||||
expanded={expandAdvanced}
|
||||
onChange={() => setExpandAdvanced(!expandAdvanced)}
|
||||
>
|
||||
<AccordionSummary
|
||||
sx={{
|
||||
fontSize: 14,
|
||||
fontWeight: 500,
|
||||
lineHeight: '32px',
|
||||
color: 'blue',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
cursor: 'pointer',
|
||||
'&:hover': {
|
||||
opacity: 0.8,
|
||||
},
|
||||
}}
|
||||
>
|
||||
高级设置
|
||||
</AccordionSummary>
|
||||
<AccordionDetails>
|
||||
<Stack spacing={2}>
|
||||
<Box>
|
||||
<Box sx={{ fontSize: 14, lineHeight: '32px' }}>
|
||||
上下文窗口大小
|
||||
</Box>
|
||||
<Controller
|
||||
control={control}
|
||||
name='context_window_size'
|
||||
render={({ field }) => (
|
||||
<>
|
||||
<TextField
|
||||
{...field}
|
||||
fullWidth
|
||||
size='small'
|
||||
placeholder='例如:16000'
|
||||
type='number'
|
||||
/>
|
||||
<Box sx={{ mt: 1, display: 'flex', gap: 1, alignItems: 'center' }}>
|
||||
{[
|
||||
{ label: '128k', value: 128000 },
|
||||
{ label: '256k', value: 256000 },
|
||||
{ label: '512k', value: 512000 },
|
||||
{ label: '1m', value: 1_000_000 }
|
||||
].map((option) => (
|
||||
<Box
|
||||
key={option.label}
|
||||
sx={{
|
||||
fontSize: 12,
|
||||
color: 'blue',
|
||||
cursor: 'pointer',
|
||||
padding: '2px 4px',
|
||||
'&:hover': {
|
||||
textDecoration: 'underline'
|
||||
}
|
||||
}}
|
||||
onClick={() => field.onChange(option.value)}
|
||||
>
|
||||
{option.label}
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Box sx={{ fontSize: 14, lineHeight: '32px' }}>
|
||||
最大输出 Token
|
||||
</Box>
|
||||
<Controller
|
||||
control={control}
|
||||
name='max_output_tokens'
|
||||
render={({ field }) => (
|
||||
<TextField
|
||||
{...field}
|
||||
fullWidth
|
||||
size='small'
|
||||
placeholder='例如:4000'
|
||||
type='number'
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* 复选框组 - 使用更紧凑的布局 */}
|
||||
<Stack spacing={0}>
|
||||
<Controller
|
||||
control={control}
|
||||
name='enable_r1_params'
|
||||
render={({ field }) => (
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={field.value}
|
||||
onChange={(e) => field.onChange(e.target.checked)}
|
||||
size='small'
|
||||
/>
|
||||
}
|
||||
label={
|
||||
<Box sx={{ fontSize: 12 }}>
|
||||
启用 R1 模型参数
|
||||
<Box component="span" sx={{ ml: 1, color: 'text.secondary', fontSize: 11 }}>
|
||||
(使用 QWQ 等 R1 系列模型时必须启用,避免出现 400 错误)
|
||||
</Box>
|
||||
</Box>
|
||||
}
|
||||
sx={{ margin: 0 }}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
control={control}
|
||||
name='support_image'
|
||||
render={({ field }) => (
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={field.value}
|
||||
onChange={(e) => field.onChange(e.target.checked)}
|
||||
size='small'
|
||||
/>
|
||||
}
|
||||
label={
|
||||
<Box sx={{ fontSize: 12 }}>
|
||||
图像支持
|
||||
<Box component="span" sx={{ ml: 1, color: 'text.secondary', fontSize: 11 }}>
|
||||
(此模型是否能够处理和理解图像?)
|
||||
</Box>
|
||||
</Box>
|
||||
}
|
||||
sx={{ margin: 0 }}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
control={control}
|
||||
name='support_compute'
|
||||
render={({ field }) => (
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={field.value}
|
||||
onChange={(e) => field.onChange(e.target.checked)}
|
||||
size='small'
|
||||
/>
|
||||
}
|
||||
label={
|
||||
<Box sx={{ fontSize: 12 }}>
|
||||
计算机功能调用
|
||||
<Box component="span" sx={{ ml: 1, color: 'text.secondary', fontSize: 11 }}>
|
||||
(此模型是否能够与浏览器交互?)
|
||||
</Box>
|
||||
</Box>
|
||||
}
|
||||
sx={{ margin: 0 }}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
control={control}
|
||||
name='support_prompt_caching'
|
||||
render={({ field }) => (
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={field.value}
|
||||
onChange={(e) => field.onChange(e.target.checked)}
|
||||
size='small'
|
||||
/>
|
||||
}
|
||||
label={
|
||||
<Box sx={{ fontSize: 12 }}>
|
||||
提示缓存
|
||||
<Box component="span" sx={{ ml: 1, color: 'text.secondary', fontSize: 11 }}>
|
||||
(此模型是否能够缓存提示?)
|
||||
</Box>
|
||||
</Box>
|
||||
}
|
||||
sx={{ margin: 0 }}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
{error && (
|
||||
|
||||
Reference in New Issue
Block a user