浏览代码

修复数据库的问题

黎海 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 6
   speechToText,
7 7
   translateText,
8 8
   summarizeText,
9
-  getCozeService
9
+  cozeService
10 10
 } from '../utils/cozeExample';
11 11
 
12 12
 /**
@@ -183,7 +183,7 @@ const CozeWorkflowDemo = () => {
183 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 189
       setOutputText(JSON.stringify(response, null, 2));

+ 4 - 0
src/nodeapi/dbHandler.js

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

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

@@ -26,14 +26,6 @@ const Home = forwardRef((props, ref) => {
26 26
   const [currentVideo, setCurrentVideo] = useState(null);
27 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 29
   const handleAddProject = () => {
38 30
     setShowProject(true);
39 31
   };
@@ -55,7 +47,6 @@ const Home = forwardRef((props, ref) => {
55 47
       setProjects(books);
56 48
     } catch (error) {
57 49
       console.error('加载项目列表失败:', error);
58
-      toast.error('加载项目列表失败');
59 50
     } finally {
60 51
       setLoading(false);
61 52
     }