From d4e2edb1f9115ab74430095272cf31d55b71a86b Mon Sep 17 00:00:00 2001 From: Fangyin Cheng Date: Mon, 25 Dec 2023 17:12:53 +0800 Subject: [PATCH] fix(core): Fix mysql uk too long error --- assets/schema/knowledge_management.sql | 6 +++--- dbgpt/serve/prompt/models/models.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/schema/knowledge_management.sql b/assets/schema/knowledge_management.sql index 454f0b588..908a40e27 100644 --- a/assets/schema/knowledge_management.sql +++ b/assets/schema/knowledge_management.sql @@ -169,10 +169,10 @@ CREATE TABLE IF NOT EXISTS `prompt_manage` `chat_scene` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Chat scene', `sub_chat_scene` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Sub chat scene', `prompt_type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Prompt type: common or private', - `prompt_name` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'prompt name', + `prompt_name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'prompt name', `content` longtext COLLATE utf8mb4_unicode_ci COMMENT 'Prompt content', `input_variables` varchar(1024) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Prompt input variables(split by comma))', - `model` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Prompt model name(we can use different models for different prompt)', + `model` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Prompt model name(we can use different models for different prompt)', `prompt_language` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Prompt language(eg:en, zh-cn)', `prompt_format` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT 'f-string' COMMENT 'Prompt format(eg: f-string, jinja2)', `user_name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'User name', @@ -180,7 +180,7 @@ CREATE TABLE IF NOT EXISTS `prompt_manage` `gmt_created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'created time', `gmt_modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time', PRIMARY KEY (`id`), - UNIQUE KEY `prompt_name_uiq` (`prompt_name`, `sys_code`, `prompt_language`, `models`), + UNIQUE KEY `prompt_name_uiq` (`prompt_name`, `sys_code`, `prompt_language`, `model`), KEY `gmt_created_idx` (`gmt_created`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Prompt management table'; diff --git a/dbgpt/serve/prompt/models/models.py b/dbgpt/serve/prompt/models/models.py index 3e1f6795a..710d5af5f 100644 --- a/dbgpt/serve/prompt/models/models.py +++ b/dbgpt/serve/prompt/models/models.py @@ -28,13 +28,13 @@ class ServeEntity(Model): chat_scene = Column(String(100), comment="Chat scene") sub_chat_scene = Column(String(100), comment="Sub chat scene") prompt_type = Column(String(100), comment="Prompt type(eg: common, private)") - prompt_name = Column(String(512), comment="Prompt name") + prompt_name = Column(String(128), comment="Prompt name") content = Column(Text, comment="Prompt content") input_variables = Column( String(1024), nullable=True, comment="Prompt input variables(split by comma))" ) model = Column( - String(128), + String(64), nullable=True, comment="Prompt model name(we can use different models for different prompt", )