@3-/aiapi 0.1.6 → 0.1.7
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 +3 -1
- package/package.json +1 -1
- package/partition.js +1 -1
- package/seg.js +8 -9
package/fmtJson.js
CHANGED
|
@@ -9,7 +9,9 @@ export default async(chat, txt) => {
|
|
|
9
9
|
var gen, i, pli, result, split_li, sum, tmp, txt_li;
|
|
10
10
|
txt_li = txt.split('\n');
|
|
11
11
|
split_li = (await seg(chat, txt_li));
|
|
12
|
-
pli = partition(txt_li, split_li)
|
|
12
|
+
pli = partition(txt_li, split_li.map((i) => {
|
|
13
|
+
return [i.题, i.行];
|
|
14
|
+
}));
|
|
13
15
|
result = [];
|
|
14
16
|
sum = 0;
|
|
15
17
|
tmp = [];
|
package/package.json
CHANGED
package/partition.js
CHANGED
|
@@ -10,9 +10,9 @@ export default (lines, title_number) => {
|
|
|
10
10
|
|
|
11
11
|
// 遍历排序后的行号
|
|
12
12
|
for (const [t, row] of order) {
|
|
13
|
+
console.log(t)
|
|
13
14
|
// 将行号转换为从0开始的数组索引
|
|
14
15
|
const index = row - 1;
|
|
15
|
-
console.log(title)
|
|
16
16
|
result.push(title + lines.slice(start, index).join('\n'));
|
|
17
17
|
title = '# ' + t + '\n'
|
|
18
18
|
start = index;
|
package/seg.js
CHANGED
|
@@ -11,25 +11,24 @@ export default async(chat, txt_li) => {
|
|
|
11
11
|
return split_li = (await chat(提示词, {
|
|
12
12
|
type: TYPE.ARRAY,
|
|
13
13
|
description: '章节和行号的列表',
|
|
14
|
+
minItems: 1,
|
|
14
15
|
items: {
|
|
15
|
-
type: TYPE.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
maxItems: 3,
|
|
19
|
-
prefixItems: [
|
|
20
|
-
{
|
|
16
|
+
type: TYPE.OBJECT,
|
|
17
|
+
properties: {
|
|
18
|
+
题: {
|
|
21
19
|
description: '章节标题,1-2个词即可',
|
|
22
20
|
type: TYPE.STRING
|
|
23
21
|
},
|
|
24
|
-
{
|
|
22
|
+
行: {
|
|
25
23
|
description: '该章首行行号',
|
|
26
24
|
type: TYPE.INTEGER
|
|
27
25
|
},
|
|
28
|
-
{
|
|
26
|
+
文: {
|
|
29
27
|
description: '该章首行提问的原文',
|
|
30
28
|
type: TYPE.STRING
|
|
31
29
|
}
|
|
32
|
-
|
|
30
|
+
},
|
|
31
|
+
required: ['题', '行', '文']
|
|
33
32
|
}
|
|
34
33
|
}, '你是专业资深的秘书'));
|
|
35
34
|
};
|