From efef59438e64a61e9f00da887ebb1b6b95e5f0b9 Mon Sep 17 00:00:00 2001 From: Fangyin Cheng Date: Wed, 21 Feb 2024 18:29:53 +0800 Subject: [PATCH] docs: Add upgrade to v0.5.0 documents (#1176) --- docs/docs/upgrade/v0.5.0.md | 125 ++++++++++++++++++++++++++++++++++++ docs/sidebars.js | 13 +++- 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 docs/docs/upgrade/v0.5.0.md diff --git a/docs/docs/upgrade/v0.5.0.md b/docs/docs/upgrade/v0.5.0.md new file mode 100644 index 000000000..97d8d8e93 --- /dev/null +++ b/docs/docs/upgrade/v0.5.0.md @@ -0,0 +1,125 @@ +# Upgrade To v0.5.0(Draft) + +## Overview + +This guide is for upgrading from v0.4.6 and v0.4.7 to v0.5.0. If you use SQLite, +you not need to upgrade the database. If you use MySQL, you need to upgrade the database. + +## Prepare + +### Backup Your Database + +To prevent data loss, it is recommended to back up your database before upgrading. +The backup way according to your database type. + +## Upgrade + +### Stop DB-GPT Service + +Stop the DB-GPT service according to your start way. + +### Upgrade Database + +Execute the following SQL to upgrade the database. + +**New Tables** + +```sql +-- dbgpt.dbgpt_serve_flow definition +CREATE TABLE `dbgpt_serve_flow` ( + `id` int NOT NULL AUTO_INCREMENT COMMENT 'Auto increment id', + `uid` varchar(128) NOT NULL COMMENT 'Unique id', + `dag_id` varchar(128) DEFAULT NULL COMMENT 'DAG id', + `name` varchar(128) DEFAULT NULL COMMENT 'Flow name', + `flow_data` text COMMENT 'Flow data, JSON format', + `user_name` varchar(128) DEFAULT NULL COMMENT 'User name', + `sys_code` varchar(128) DEFAULT NULL COMMENT 'System code', + `gmt_created` datetime DEFAULT NULL COMMENT 'Record creation time', + `gmt_modified` datetime DEFAULT NULL COMMENT 'Record update time', + `flow_category` varchar(64) DEFAULT NULL COMMENT 'Flow category', + `description` varchar(512) DEFAULT NULL COMMENT 'Flow description', + `state` varchar(32) DEFAULT NULL COMMENT 'Flow state', + `source` varchar(64) DEFAULT NULL COMMENT 'Flow source', + `source_url` varchar(512) DEFAULT NULL COMMENT 'Flow source url', + `version` varchar(32) DEFAULT NULL COMMENT 'Flow version', + `label` varchar(128) DEFAULT NULL COMMENT 'Flow label', + `editable` int DEFAULT NULL COMMENT 'Editable, 0: editable, 1: not editable', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_uid` (`uid`), + KEY `ix_dbgpt_serve_flow_sys_code` (`sys_code`), + KEY `ix_dbgpt_serve_flow_uid` (`uid`), + KEY `ix_dbgpt_serve_flow_dag_id` (`dag_id`), + KEY `ix_dbgpt_serve_flow_user_name` (`user_name`), + KEY `ix_dbgpt_serve_flow_name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- dbgpt.gpts_app definition +CREATE TABLE `gpts_app` ( + `id` int NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id', + `app_code` varchar(255) NOT NULL COMMENT 'Current AI assistant code', + `app_name` varchar(255) NOT NULL COMMENT 'Current AI assistant name', + `app_describe` varchar(2255) NOT NULL COMMENT 'Current AI assistant describe', + `language` varchar(100) NOT NULL COMMENT 'gpts language', + `team_mode` varchar(255) NOT NULL COMMENT 'Team work mode', + `team_context` text COMMENT 'The execution logic and team member content that teams with different working modes rely on', + `user_code` varchar(255) DEFAULT NULL COMMENT 'user code', + `sys_code` varchar(255) DEFAULT NULL COMMENT 'system app code', + `created_at` datetime DEFAULT NULL COMMENT 'create time', + `updated_at` datetime DEFAULT NULL COMMENT 'last update time', + `icon` varchar(1024) DEFAULT NULL COMMENT 'app icon, url', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_gpts_app` (`app_name`) +) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +CREATE TABLE `gpts_app_collection` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id', + `app_code` varchar(255) NOT NULL COMMENT 'Current AI assistant code', + `user_code` int(11) NOT NULL COMMENT 'user code', + `sys_code` varchar(255) NOT NULL COMMENT 'system app code', + `created_at` datetime DEFAULT NULL COMMENT 'create time', + `updated_at` datetime DEFAULT NULL COMMENT 'last update time', + PRIMARY KEY (`id`), + KEY `idx_app_code` (`app_code`), + KEY `idx_user_code` (`user_code`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT="gpt collections"; + +-- dbgpt.gpts_app_detail definition +CREATE TABLE `gpts_app_detail` ( + `id` int NOT NULL AUTO_INCREMENT COMMENT 'autoincrement id', + `app_code` varchar(255) NOT NULL COMMENT 'Current AI assistant code', + `app_name` varchar(255) NOT NULL COMMENT 'Current AI assistant name', + `agent_name` varchar(255) NOT NULL COMMENT ' Agent name', + `node_id` varchar(255) NOT NULL COMMENT 'Current AI assistant Agent Node id', + `resources` text COMMENT 'Agent bind resource', + `prompt_template` text COMMENT 'Agent bind template', + `llm_strategy` varchar(25) DEFAULT NULL COMMENT 'Agent use llm strategy', + `llm_strategy_value` text COMMENT 'Agent use llm strategy value', + `created_at` datetime DEFAULT NULL COMMENT 'create time', + `updated_at` datetime DEFAULT NULL COMMENT 'last update time', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_gpts_app_agent_node` (`app_name`,`agent_name`,`node_id`) +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + + +``` + +**Add Columns** +```sql +ALTER TABLE `gpts_conversations` +ADD COLUMN `team_mode` varchar(255) NULL COMMENT 'agent team work mode'; + +ALTER TABLE `gpts_conversations` +ADD COLUMN `current_goal` text COMMENT 'The target corresponding to the current message'; +``` + +### Install Dependencies + +Install dependencies according to your installation way, if your installation from +source code and use the default way, you can run the following command: +```bash +pip install -e ".[default]" +``` + +### Start DB-GPT Service + +Start your DB-GPT service according to your start way. \ No newline at end of file diff --git a/docs/sidebars.js b/docs/sidebars.js index 948df697e..017a0b63e 100755 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -361,7 +361,18 @@ const sidebars = { id: 'changelog/doc', }, ], - + }, + + { + type: "category", + label: "Upgrade", + collapsed: true, + items: [ + { + type: 'doc', + id: 'upgrade/v0.5.0', + }, + ], }, {