feat(datasource): Database connection Renewal (#2359)

Co-authored-by: aries_ckt <916701291@qq.com>
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
Co-authored-by: ‘yanzhiyonggit config --global user.email git config --global user.name ‘yanzhiyong <zhiyong.yan@clife.cn>
This commit is contained in:
云锋
2025-02-22 18:44:21 +08:00
committed by GitHub
parent e4b329ee21
commit 94b51284e0
132 changed files with 689 additions and 501 deletions

23
web/types/common.ts Normal file
View File

@@ -0,0 +1,23 @@
interface ExtMetadata {
tags: string;
order: number;
[key: string]: string | number | boolean;
}
type NestedField = {
[key: string]: ConfigurableParams;
};
export type ConfigurableParams = {
param_class: string;
param_name: string;
param_type: string;
default_value: string | boolean | number;
description: string;
required: boolean;
valid_values: null | string[];
ext_metadata: ExtMetadata;
is_array: boolean;
label: string;
nested_fields: NestedField | null;
};

View File

@@ -1,3 +1,5 @@
import { ConfigurableParams } from '@/types/common';
export type DBOption = {
label: string;
value: DBType;
@@ -5,6 +7,7 @@ export type DBOption = {
isFileDb?: boolean;
icon: string;
desc?: string;
parameters?: ConfigurableParams[];
};
export type DBType =
@@ -27,6 +30,13 @@ export type DBType =
| (string & {});
export type IChatDbSchema = {
type: string;
id: string;
name: string;
label: string;
description: string;
params: any[];
parameters: any[];
comment: string;
db_host: string;
db_name: string;
@@ -38,10 +48,14 @@ export type IChatDbSchema = {
};
export type DbListResponse = IChatDbSchema[];
export type IChatDbSupportTypeSchema = {
db_type: DBType;
is_file_db: boolean;
name: string;
params: ConfigurableParams;
types: any[];
label: string;
description: string;
parameters: any[];
};
export type DbSupportTypeResponse = IChatDbSupportTypeSchema[];
@@ -58,19 +72,6 @@ export type ChatFeedBackSchema = {
messages: string;
};
export type PromptProps = {
id: number;
chat_scene: string;
sub_chat_scene: string;
prompt_type: string;
content: string;
user_name: string;
prompt_name: string;
gmt_created: string;
gmt_modified: string;
};
export type PostDbRefreshParams = {
db_name: string;
db_type: DBType;
id: number | string;
};

View File

@@ -1,3 +1,5 @@
import { ConfigurableParams } from '@/types/common';
export type IModelData = {
chat_scene: string;
model_name: string;
@@ -23,15 +25,6 @@ export type BaseModelParams = {
params: any;
};
// export type ModelParams = {
// model_name: string;
// model_path: string;
// proxy_api_key: string;
// proxy_server_url: string;
// model_type: string;
// max_context_size: number;
// };
//
export type ModelParams = {
[key: string]: string | number | boolean;
};
@@ -43,31 +36,6 @@ export type StartModelParams = {
worker_type: string;
params: ModelParams;
};
interface ExtMetadata {
tags: string;
order: number;
[key: string]: string | number | boolean;
}
type NestedField = {
[key: string]: SupportModelParams;
};
export type SupportModelParams = {
param_class: string;
param_name: string;
param_type: string;
default_value: string | boolean | number;
description: string;
required: boolean;
valid_values: null | string[];
ext_metadata: ExtMetadata;
is_array: boolean;
label: string;
nested_fields: NestedField | null;
};
export type SupportModel = {
model: string;
path: string;
@@ -77,7 +45,7 @@ export type SupportModel = {
enabled: boolean;
host: string;
port: number;
params: SupportModelParams;
params: ConfigurableParams;
provider: string;
description: string;
};