浏览代码

修复数据库的问题

黎海 2 月之前
父节点
当前提交
baa3207342
共有 3 个文件被更改,包括 6 次插入11 次删除
  1. 2 2
      src/components/CozeWorkflowDemo.js
  2. 4 0
      src/nodeapi/dbHandler.js
  3. 0 9
      src/pages/home/home.js

+ 2 - 2
src/components/CozeWorkflowDemo.js

@@ -6,7 +6,7 @@ import {
6
   speechToText,
6
   speechToText,
7
   translateText,
7
   translateText,
8
   summarizeText,
8
   summarizeText,
9
-  getCozeService
9
+  cozeService
10
 } from '../utils/cozeExample';
10
 } from '../utils/cozeExample';
11
 
11
 
12
 /**
12
 /**
@@ -183,7 +183,7 @@ const CozeWorkflowDemo = () => {
183
         parameters = { text: inputText };
183
         parameters = { text: inputText };
184
       }
184
       }
185
       
185
       
186
-      const response = await getCozeService().runWorkflow(workflowId, parameters);
186
+      const response = await cozeService.runWorkflow(workflowId, parameters);
187
       
187
       
188
       // 在实际应用中,您可能需要根据工作流的不同输出格式进行不同的处理
188
       // 在实际应用中,您可能需要根据工作流的不同输出格式进行不同的处理
189
       setOutputText(JSON.stringify(response, null, 2));
189
       setOutputText(JSON.stringify(response, null, 2));

+ 4 - 0
src/nodeapi/dbHandler.js

@@ -183,15 +183,18 @@ const initDatabase = async (forceUpdate = false) => {
183
         table.increments('id').primary();
183
         table.increments('id').primary();
184
         table.integer('book_id').unsigned().references('id').inTable('book').onDelete('CASCADE');
184
         table.integer('book_id').unsigned().references('id').inTable('book').onDelete('CASCADE');
185
         table.integer('index').notNullable();
185
         table.integer('index').notNullable();
186
+        table.integer('segment_id').nullable();
186
         table.text('text').nullable();
187
         table.text('text').nullable();
187
         table.string('start_time').nullable();
188
         table.string('start_time').nullable();
188
         table.string('end_time').nullable();
189
         table.string('end_time').nullable();
190
+        table.string('duration').nullable();
189
         table.string('audio_path').nullable();
191
         table.string('audio_path').nullable();
190
         table.string('image_path').nullable();
192
         table.string('image_path').nullable();
191
         table.string('video_path').nullable();
193
         table.string('video_path').nullable();
192
         table.text('description').nullable();
194
         table.text('description').nullable();
193
         table.integer('draw_status').defaultTo(2); // 添加绘图状态字段,默认为已完成
195
         table.integer('draw_status').defaultTo(2); // 添加绘图状态字段,默认为已完成
194
         table.boolean('is_merged').defaultTo(false);
196
         table.boolean('is_merged').defaultTo(false);
197
+        table.text('merged_from').nullable(); // 添加merged_from字段
195
         table.timestamp('created_at').defaultTo(db.fn.now());
198
         table.timestamp('created_at').defaultTo(db.fn.now());
196
         table.timestamp('updated_at').defaultTo(db.fn.now());
199
         table.timestamp('updated_at').defaultTo(db.fn.now());
197
       });
200
       });
@@ -303,6 +306,7 @@ const handleBookInfoOperations = {
303
       
306
       
304
       const bookInfo = {
307
       const bookInfo = {
305
         book_id: bookInfoData.book_id,
308
         book_id: bookInfoData.book_id,
309
+        index: bookInfoData.index || 1,
306
         segment_id: bookInfoData.segment_id || null,
310
         segment_id: bookInfoData.segment_id || null,
307
         start_time: bookInfoData.start_time || null,
311
         start_time: bookInfoData.start_time || null,
308
         end_time: bookInfoData.end_time || null,
312
         end_time: bookInfoData.end_time || null,

+ 0 - 9
src/pages/home/home.js

@@ -26,14 +26,6 @@ const Home = forwardRef((props, ref) => {
26
   const [currentVideo, setCurrentVideo] = useState(null);
26
   const [currentVideo, setCurrentVideo] = useState(null);
27
   const history = useHistory();
27
   const history = useHistory();
28
 
28
 
29
-  // 检查Coze API Token
30
-  useEffect(() => {
31
-    // 用户首次访问时,如果没有配置Coze API Token,引导用户进行配置
32
-    if (!hasValidToken()) {
33
-      setShowApiSettings(true);
34
-    }
35
-  }, []);
36
-
37
   const handleAddProject = () => {
29
   const handleAddProject = () => {
38
     setShowProject(true);
30
     setShowProject(true);
39
   };
31
   };
@@ -55,7 +47,6 @@ const Home = forwardRef((props, ref) => {
55
       setProjects(books);
47
       setProjects(books);
56
     } catch (error) {
48
     } catch (error) {
57
       console.error('加载项目列表失败:', error);
49
       console.error('加载项目列表失败:', error);
58
-      toast.error('加载项目列表失败');
59
     } finally {
50
     } finally {
60
       setLoading(false);
51
       setLoading(false);
61
     }
52
     }