@3-/aiapi 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fmtJson.js +4 -0
- package/package.json +1 -1
- package/seg.js +2 -2
package/fmtJson.js
CHANGED
|
@@ -7,6 +7,9 @@ import seg from './seg.js';
|
|
|
7
7
|
|
|
8
8
|
export default async(chat, txt) => {
|
|
9
9
|
var gen, i, pli, result, split_li, sum, tmp, txt_li;
|
|
10
|
+
if (!txt) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
10
13
|
txt_li = txt.split('\n');
|
|
11
14
|
split_li = (await seg(chat, txt_li));
|
|
12
15
|
pli = partition(txt_li, split_li.map((i) => {
|
|
@@ -22,6 +25,7 @@ export default async(chat, txt) => {
|
|
|
22
25
|
tmp.push(i);
|
|
23
26
|
sum += i.length;
|
|
24
27
|
if (sum > 3000) {
|
|
28
|
+
console.log(sum);
|
|
25
29
|
gen();
|
|
26
30
|
sum = 0;
|
|
27
31
|
tmp = [];
|
package/package.json
CHANGED
package/seg.js
CHANGED
|
@@ -4,7 +4,7 @@ import TYPE from './TYPE.js';
|
|
|
4
4
|
export default async(chat, txt_li) => {
|
|
5
5
|
var split_li, 提示词;
|
|
6
6
|
提示词 = `下文第1列为行号,第2列为对话内容,以tab分隔。
|
|
7
|
-
|
|
7
|
+
请划分章节,每章以提问开始,包含多组问答,每章三千字左右。
|
|
8
8
|
输出章节标题和每章首个问题的行号及原文,输出格式为JSON数组:\n` + txt_li.map((i, pos) => {
|
|
9
9
|
return (pos + 1) + '\t' + i.trim();
|
|
10
10
|
}).join('\n');
|
|
@@ -16,7 +16,7 @@ export default async(chat, txt_li) => {
|
|
|
16
16
|
type: TYPE.OBJECT,
|
|
17
17
|
properties: {
|
|
18
18
|
题: {
|
|
19
|
-
description: '
|
|
19
|
+
description: '章节标题,要概括章节内容',
|
|
20
20
|
type: TYPE.STRING
|
|
21
21
|
},
|
|
22
22
|
行: {
|