feat(model): add model management module (#2303)

This commit is contained in:
Ryo
2025-10-21 16:44:29 +08:00
committed by GitHub
parent 6e02c861c7
commit 2b021a3d41
185 changed files with 27862 additions and 8142 deletions

View File

@ -0,0 +1,24 @@
-- Modify "app_conversation_template_draft" table
ALTER TABLE `opencoze`.`app_conversation_template_draft` COMMENT "app_conversation_template_draft";
-- Modify "app_conversation_template_online" table
ALTER TABLE `opencoze`.`app_conversation_template_online` COMMENT "app_conversation_template_online";
-- Modify "app_dynamic_conversation_draft" table
ALTER TABLE `opencoze`.`app_dynamic_conversation_draft` COMMENT "app_dynamic_conversation_draft";
-- Modify "app_dynamic_conversation_online" table
ALTER TABLE `opencoze`.`app_dynamic_conversation_online` COMMENT "app_dynamic_conversation_online";
-- Modify "chat_flow_role_config" table
ALTER TABLE `opencoze`.`chat_flow_role_config` COMMENT "chat_flow_role_config", MODIFY COLUMN `description` mediumtext NULL COMMENT "role description", MODIFY COLUMN `version` varchar(256) NULL COMMENT "version", MODIFY COLUMN `background_image_info` mediumtext NULL COMMENT "background image information, object structure", MODIFY COLUMN `onboarding_info` mediumtext NULL COMMENT "intro information, object structure", MODIFY COLUMN `suggest_reply_info` mediumtext NULL COMMENT "user suggestions, object structure", MODIFY COLUMN `audio_config` mediumtext NULL COMMENT "agent audio config, object structure";
-- Modify "conversation" table
ALTER TABLE `opencoze`.`conversation` MODIFY COLUMN `name` varchar(255) NULL DEFAULT "" COMMENT "conversation name";
-- Modify "node_execution" table
ALTER TABLE `opencoze`.`node_execution` COLLATE utf8mb4_unicode_ci;
-- Modify "prompt_resource" table
ALTER TABLE `opencoze`.`prompt_resource` COLLATE utf8mb4_unicode_ci;
-- Modify "variable_instance" table
ALTER TABLE `opencoze`.`variable_instance` COLLATE utf8mb4_unicode_ci;
-- Modify "variables_meta" table
ALTER TABLE `opencoze`.`variables_meta` COLLATE utf8mb4_unicode_ci;
-- Create "kv_entries" table
CREATE TABLE `opencoze`.`kv_entries` (`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", `namespace` varchar(255) NOT NULL COMMENT "namespace", `key_data` varchar(255) NOT NULL COMMENT "key_data", `value_data` longblob NULL COMMENT "value_data", PRIMARY KEY (`id`), UNIQUE INDEX `uniq_namespace_key` (`namespace`, `key_data`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci COMMENT "kv data";
-- Create "model_instance" table
CREATE TABLE `opencoze`.`model_instance` (`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT "id", `type` tinyint NOT NULL COMMENT "Model Type 0-LLM 1-TextEmbedding 2-Rerank ", `provider` json NOT NULL COMMENT "Provider Information", `display_info` json NOT NULL COMMENT "Display Information", `connection` json NOT NULL COMMENT "Connection Information", `capability` json NOT NULL COMMENT "Model Capability", `parameters` json NOT NULL COMMENT "Model Parameters", `extra` json NULL COMMENT "Extra Information", `created_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Create Time in Milliseconds", `updated_at` bigint unsigned NOT NULL DEFAULT 0 COMMENT "Update Time in Milliseconds", `deleted_at` datetime(3) NULL COMMENT "Delete Time", PRIMARY KEY (`id`)) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT "Model Instance Management Table";

View File

@ -1,4 +1,4 @@
h1:pI33vf1vp/2PZugeIpA8ZzR8pQQf1t91dmG2Yf9V1ro=
h1:UZoP+mSeNiF9zPDKHSSY7rlgmeipCGNRrwYdlEZ3Ens=
20250703095335_initial.sql h1:/joaeUTMhXqAEc0KwsSve5+bYM0qPOp+9OizJtsRc+U=
20250703115304_update.sql h1:cbYo6Q6Lh96hB4hu5KW2Nn/Mr0VDpg7a1WPgpIb1SOc=
20250704040445_update.sql h1:QWmoPY//oQ+GFZwET9w/oAWa8mM0KVaD5G8Yiu9bMqY=
@ -12,4 +12,5 @@ h1:pI33vf1vp/2PZugeIpA8ZzR8pQQf1t91dmG2Yf9V1ro=
20250812093734_update.sql h1:27fQaPt0LYi1dA7MABvERthVR4pj4MRWFgdRVR3cd6w=
20250813081543_update.sql h1:HyBPu1LVs8oiyABbZDU3fFW0n6MeC7qOpzcHWVkwNVc=
20250822060516_update.sql h1:KoL8FPXw5/JMsJMtJsoGFIc4wYHlngBudeYSz5o4iKU=
20251015103940_update.sql h1:F5/wEP+Gjtnd3nYgUFiKaPdKpgedMqtnhSWpfUsf1c4=
20251015103940_update.sql h1:ivE+qtF4q3bMFroid1yMSO465s5Oiey/5VvQ7GWnBlY=
20251016034721_update.sql h1:BLXpKpa3LBVyiuMDGSwud6WwM+34jQQvn11ytYZCbrw=

View File

@ -354,7 +354,8 @@ table "app_connector_release_ref" {
}
}
table "app_conversation_template_draft" {
schema = schema.opencoze
schema = schema.opencoze
comment = "app_conversation_template_draft"
column "id" {
null = false
type = bigint
@ -415,7 +416,8 @@ table "app_conversation_template_draft" {
}
}
table "app_conversation_template_online" {
schema = schema.opencoze
schema = schema.opencoze
comment = "app_conversation_template_online"
column "id" {
null = false
type = bigint
@ -534,7 +536,8 @@ table "app_draft" {
}
}
table "app_dynamic_conversation_draft" {
schema = schema.opencoze
schema = schema.opencoze
comment = "app_dynamic_conversation_draft"
column "id" {
null = false
type = bigint
@ -592,7 +595,8 @@ table "app_dynamic_conversation_draft" {
}
}
table "app_dynamic_conversation_online" {
schema = schema.opencoze
schema = schema.opencoze
comment = "app_dynamic_conversation_online"
column "id" {
null = false
type = bigint
@ -852,7 +856,8 @@ table "app_static_conversation_online" {
}
}
table "chat_flow_role_config" {
schema = schema.opencoze
schema = schema.opencoze
comment = "chat_flow_role_config"
column "id" {
null = false
type = bigint
@ -877,12 +882,12 @@ table "chat_flow_role_config" {
comment = "role name"
}
column "description" {
null = false
null = true
type = mediumtext
comment = "role description"
}
column "version" {
null = false
null = true
type = varchar(256)
comment = "version"
}
@ -892,22 +897,22 @@ table "chat_flow_role_config" {
comment = "avatar uri"
}
column "background_image_info" {
null = false
null = true
type = mediumtext
comment = "background image information, object structure"
}
column "onboarding_info" {
null = false
null = true
type = mediumtext
comment = "intro information, object structure"
}
column "suggest_reply_info" {
null = false
null = true
type = mediumtext
comment = "user suggestions, object structure"
}
column "audio_config" {
null = false
null = true
type = mediumtext
comment = "agent audio config, object structure"
}
@ -1805,6 +1810,40 @@ table "knowledge_document_slice" {
columns = [column.sequence]
}
}
table "kv_entries" {
schema = schema.opencoze
comment = "kv data"
collate = "utf8mb4_general_ci"
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
auto_increment = true
}
column "namespace" {
null = false
type = varchar(255)
comment = "namespace"
}
column "key_data" {
null = false
type = varchar(255)
comment = "key_data"
}
column "value_data" {
null = true
type = longblob
comment = "value_data"
}
primary_key {
columns = [column.id]
}
index "uniq_namespace_key" {
unique = true
columns = [column.namespace, column.key_data]
}
}
table "message" {
schema = schema.opencoze
comment = "message record"
@ -2007,6 +2046,74 @@ table "model_entity" {
columns = [column.status]
}
}
table "model_instance" {
schema = schema.opencoze
comment = "Model Instance Management Table"
column "id" {
null = false
type = bigint
unsigned = true
comment = "id"
auto_increment = true
}
column "type" {
null = false
type = tinyint
comment = "Model Type 0-LLM 1-TextEmbedding 2-Rerank "
}
column "provider" {
null = false
type = json
comment = "Provider Information"
}
column "display_info" {
null = false
type = json
comment = "Display Information"
}
column "connection" {
null = false
type = json
comment = "Connection Information"
}
column "capability" {
null = false
type = json
comment = "Model Capability"
}
column "parameters" {
null = false
type = json
comment = "Model Parameters"
}
column "extra" {
null = true
type = json
comment = "Extra Information"
}
column "created_at" {
null = false
type = bigint
default = 0
unsigned = true
comment = "Create Time in Milliseconds"
}
column "updated_at" {
null = false
type = bigint
default = 0
unsigned = true
comment = "Update Time in Milliseconds"
}
column "deleted_at" {
null = true
type = datetime(3)
comment = "Delete Time"
}
primary_key {
columns = [column.id]
}
}
table "model_meta" {
schema = schema.opencoze
comment = "Model metadata"
@ -2090,7 +2197,6 @@ table "model_meta" {
table "node_execution" {
schema = schema.opencoze
comment = "Node run record, used to record the status information of each node during each workflow execution"
collate = "utf8mb4_0900_ai_ci"
column "id" {
null = false
type = bigint
@ -2107,19 +2213,16 @@ table "node_execution" {
null = false
type = varchar(128)
comment = "node key"
collate = "utf8mb4_unicode_ci"
}
column "node_name" {
null = false
type = varchar(128)
comment = "name of the node"
collate = "utf8mb4_unicode_ci"
}
column "node_type" {
null = false
type = varchar(128)
comment = "the type of the node, in string"
collate = "utf8mb4_unicode_ci"
}
column "created_at" {
null = false
@ -2143,31 +2246,26 @@ table "node_execution" {
null = true
type = mediumtext
comment = "actual input of the node"
collate = "utf8mb4_unicode_ci"
}
column "output" {
null = true
type = mediumtext
comment = "actual output of the node"
collate = "utf8mb4_unicode_ci"
}
column "raw_output" {
null = true
type = mediumtext
comment = "the original output of the node"
collate = "utf8mb4_unicode_ci"
}
column "error_info" {
null = true
type = mediumtext
comment = "error info"
collate = "utf8mb4_unicode_ci"
}
column "error_level" {
null = true
type = varchar(32)
comment = "level of the error"
collate = "utf8mb4_unicode_ci"
}
column "input_tokens" {
null = true
@ -2197,13 +2295,11 @@ table "node_execution" {
null = true
type = mediumtext
comment = "the items extracted from parent composite node for this index"
collate = "utf8mb4_unicode_ci"
}
column "parent_node_id" {
null = true
type = varchar(128)
comment = "when as inner node for loop or batch, this is the parent node_s key"
collate = "utf8mb4_unicode_ci"
}
column "sub_execute_id" {
null = true
@ -2215,7 +2311,6 @@ table "node_execution" {
null = true
type = mediumtext
comment = "extra info"
collate = "utf8mb4_unicode_ci"
}
primary_key {
columns = [column.id]
@ -2704,7 +2799,6 @@ table "plugin_version" {
table "prompt_resource" {
schema = schema.opencoze
comment = "prompt_resource"
collate = "utf8mb4_0900_ai_ci"
column "id" {
null = false
type = bigint
@ -2721,16 +2815,19 @@ table "prompt_resource" {
null = false
type = varchar(255)
comment = "name"
collate = "utf8mb4_0900_ai_ci"
}
column "description" {
null = false
type = varchar(255)
comment = "description"
collate = "utf8mb4_0900_ai_ci"
}
column "prompt_text" {
null = true
type = mediumtext
comment = "prompt text"
collate = "utf8mb4_0900_ai_ci"
}
column "status" {
null = false
@ -3953,7 +4050,6 @@ table "user" {
table "variable_instance" {
schema = schema.opencoze
comment = "KV Memory"
collate = "utf8mb4_0900_ai_ci"
column "id" {
null = false
type = bigint
@ -3972,16 +4068,19 @@ table "variable_instance" {
type = varchar(128)
default = ""
comment = "1 for agent_id2 for app_id"
collate = "utf8mb4_0900_ai_ci"
}
column "version" {
null = false
type = varchar(255)
comment = "agent or project version empty represents draft status"
collate = "utf8mb4_0900_ai_ci"
}
column "keyword" {
null = false
type = varchar(255)
comment = "Keyword to Memory"
collate = "utf8mb4_0900_ai_ci"
}
column "type" {
null = false
@ -3992,11 +4091,13 @@ table "variable_instance" {
null = true
type = text
comment = "content"
collate = "utf8mb4_0900_ai_ci"
}
column "connector_uid" {
null = false
type = varchar(255)
comment = "connector_uid"
collate = "utf8mb4_0900_ai_ci"
}
column "connector_id" {
null = false
@ -4027,7 +4128,6 @@ table "variable_instance" {
table "variables_meta" {
schema = schema.opencoze
comment = "KV Memory meta"
collate = "utf8mb4_0900_ai_ci"
column "id" {
null = false
type = bigint
@ -4052,6 +4152,7 @@ table "variables_meta" {
type = varchar(128)
default = ""
comment = "1 for agent_id2 for app_id"
collate = "utf8mb4_0900_ai_ci"
}
column "variable_list" {
null = true
@ -4076,6 +4177,7 @@ table "variables_meta" {
null = false
type = varchar(255)
comment = "Project version, empty represents draft status"
collate = "utf8mb4_0900_ai_ci"
}
primary_key {
columns = [column.id]

View File

@ -18,7 +18,7 @@ server {
}
# API proxy
location ~ ^/(api|v[1-3])/ {
location ~ ^/(api|v[1-3]|admin)/ {
proxy_pass http://coze-server:8888;
proxy_set_header Host $http_host;

File diff suppressed because it is too large Load Diff