yuanjing/src/types/model.ts
2026-04-01 11:05:03 +08:00

230 lines
4.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

interface Data {
value: string;
text: string;
};
interface Input_field {
name: string;
required?: boolean;
uitype: string;
label?: string;
defaultvalue?: number;
data?: Array< Data >;
lable?: string;
};
interface ModelData {
id: string;
name: string;
model: string;
description: string;
llmcatelogid: string;
iconid: string;
upappid: string;
apiname: string;
providerid: string;
ownerid: string;
enabled_date: string;
expired_date: string;
query_apiname: string;
query_period: number;
ppid: string;
input_fields: Array< Input_field >;
};
export interface ModelResult{
status: string;
data: Array< ModelData >;
};
export interface Model {
type: string;
}
/**
* 模型配置字段
*/
export interface InputField {
name: string; // 字段名
label: string; // 显示标签
uitype: string; // 控件类型: code, text, int, audio 等
required?: boolean; // 是否必填
defaultvalue?: string | number | boolean | null; // 默认值
data?: Array<{ value: string; text?: string }>; // 下拉选项
max?: number; // 最大值int 类型)
textField?: string; // 下拉选项显示字段
}
/**
* 模型对象
*/
export interface Model {
id: string;
name: string;
model: string;
description: string;
llmcatelogid: string;
iconid: string;
upappid: string;
apiname: string;
providerid: string;
ownerid: string;
enabled_date: string;
expired_date: string;
query_apiname: string;
query_period: number;
ppid: string;
input_fields: InputField[];
}
/**
* 获取模型列表响应
*/
export interface AllModelResponse {
status: string
data: Model[];
}
/**
* 价格查询请求参数
*/
export interface PriceQueryParams {
product_type: 'llm';
product_id: string;
config_data: {
action: string;
[key: string]: unknown;
};
}
/**
* 价格查询响应
*/
export interface PriceQueryResponse {
status: string
data: {
amount: number; // 价格
original_amount?: number | null;
};
}
/**
* 文生视频请求参数
*/
export interface TextVideoParams {
llmid: string;
prompt: string;
duration?: number;
ratio?: string;
resolution?: string;
audio?: boolean;
[key: string]: unknown;
}
/**
* 文生视频响应
*/
export interface TextVideoResponse {
taskid: string | undefined;
status: string;
message?: string;
data?: { taskid: string } | null;
}
/**
* 任务列表响应 - 后端实际返回类型
*/
export interface TaskResult {
status: string;
data: ItemData;
}
export interface ItemData {
tasks: Array<Tasks>;
}
export interface Tasks {
id: string;
llmid: string;
use_date: string;
use_time: string;
userid: string;
usages: null;
ioinfo: Ioinfo;
transno: string;
responsed_seconds: number;
finish_seconds: number;
status: string;
taskid: string;
amount: number;
cost: number;
userorgid: string;
ownerid: null;
accounting_status: string;
}
export interface Ioinfo {
input: Input;
output: Array<Output>;
}
export interface Input {
llmid: string;
prompt: string;
duration: number;
ratio: string;
resolution: string;
audio: boolean;
transno: string;
model: string;
callbackurl: string;
}
export interface Usage {
action: string;
credits: number;
type: string;
model: string;
resolution: string;
off_peak: boolean;
duration: number;
}
export interface Output {
taskid?: string;
status: string;
credits?: number;
usage?: Usage;
type?: string;
image?: string;
video?: string;
}
/**
* 任务列表响应 - 前端使用的简化类型(保持向后兼容)
*/
export interface TaskListResponse {
status: string;
data: TaskItem[];
}
/**
* 任务项 - 前端显示用的简化格式
*/
export interface TaskItem {
taskid: string;
status: string;
llmid?: string;
prompt?: string;
created_at?: string;
updated_at?: string;
video_url?: string;
cover_url?: string;
duration?: number;
resolution?: string;
error_msg?: string;
model?: string;
use_time?: string;
action?: string;
}