Browse Source

feat: 调整编码提交的数据结构

Carson 1 year ago
parent
commit
b45caee8d3
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/components/pages/classroomObservation/components/chatArea.vue

+ 3 - 3
src/components/pages/classroomObservation/components/chatArea.vue

@@ -2357,7 +2357,7 @@ ${JSON.stringify(_list)}
         },
       };
       // large chunk size will cause token limit and slower
-      const chunkSize = 30;
+      const chunkSize = 10;
       this.actionTypesMap.jsonData[key] = Array.from({ length: tableRows.length }).fill(
         ""
       );
@@ -2375,7 +2375,7 @@ ${JSON.stringify(_list)}
               inputs: {
                 // PERF better to just include `role` and `content` to minimize token cost
                 rows: JSON.stringify(
-                  rows.map((r) => [r.cells[3].textContent, r.cells[5].textContent])
+                  rows.map((r) => ({content: r.cells[3].textContent, role: r.cells[5].textContent}))
                 ),
                 options: options.join(","),
                 attention,
@@ -2397,7 +2397,7 @@ ${JSON.stringify(_list)}
           this.actionTypesMap.jsonData[key].splice(
             index * chunkSize,
             rows.length,
-            ...chunkResult
+            ...Object.assign(new Array(rows.length), chunkResult.slice(0, rows.length))
           );
           this.changeEditorBar({
             transcriptionData: this.transcriptionData.content,