@3-/aiapi 0.1.61 → 0.1.63
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/TOPIC_SCHEMA.js +13 -27
- package/fmtJsonMd.js +7 -10
- package/fmtSeg.js +1 -1
- package/gemini.js +1 -1
- package/package.json +1 -1
package/TOPIC_SCHEMA.js
CHANGED
|
@@ -2,39 +2,25 @@ import TYPE from './TYPE.js';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
type: TYPE.ARRAY,
|
|
5
|
-
description: '
|
|
5
|
+
description: '录音的问答对',
|
|
6
|
+
minItems: 1,
|
|
6
7
|
items: {
|
|
7
8
|
type: TYPE.OBJECT,
|
|
8
9
|
properties: {
|
|
9
|
-
|
|
10
|
+
题: {
|
|
10
11
|
type: TYPE.STRING,
|
|
11
|
-
description: '
|
|
12
|
+
description: '问答的短标题'
|
|
12
13
|
},
|
|
13
|
-
|
|
14
|
-
type: TYPE.
|
|
15
|
-
description: '
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
题: {
|
|
21
|
-
type: TYPE.STRING,
|
|
22
|
-
description: '问答的短标题'
|
|
23
|
-
},
|
|
24
|
-
问: {
|
|
25
|
-
type: TYPE.STRING,
|
|
26
|
-
description: '提问'
|
|
27
|
-
},
|
|
28
|
-
答: {
|
|
29
|
-
type: TYPE.STRING,
|
|
30
|
-
description: '针对该问题的回答,重新分段,方便阅读'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
required: ['题', '问', '答'],
|
|
34
|
-
propertyOrdering: ['问', '答']
|
|
35
|
-
}
|
|
14
|
+
问: {
|
|
15
|
+
type: TYPE.STRING,
|
|
16
|
+
description: '提问'
|
|
17
|
+
},
|
|
18
|
+
答: {
|
|
19
|
+
type: TYPE.STRING,
|
|
20
|
+
description: '针对该问题的回答,重新分段,方便阅读'
|
|
36
21
|
}
|
|
37
22
|
},
|
|
38
|
-
required: ['
|
|
23
|
+
required: ['题', '问', '答'],
|
|
24
|
+
propertyOrdering: ['问', '答']
|
|
39
25
|
}
|
|
40
26
|
};
|
package/fmtJsonMd.js
CHANGED
|
@@ -8,22 +8,19 @@ txtFmt = (txt) => {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export default (title_json_li) => {
|
|
11
|
-
var li, md_li, title, x, y,
|
|
11
|
+
var li, md_li, title, x, y, 答, 问, 题;
|
|
12
12
|
md_li = [];
|
|
13
13
|
for (x of title_json_li) {
|
|
14
14
|
[title, li] = x;
|
|
15
15
|
md_li.push('# ' + title);
|
|
16
|
+
console.log(li);
|
|
16
17
|
for (y of li) {
|
|
17
|
-
({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
答 = txtFmt(答).trim();
|
|
22
|
-
if (答.startsWith('1. ')) {
|
|
23
|
-
答 = '\n' + 答;
|
|
24
|
-
}
|
|
25
|
-
md_li.push('### ' + 题 + '\n问: ' + txtFmt(问).trimEnd() + '\n\n答:' + 答 + '\n');
|
|
18
|
+
({题, 问, 答} = y);
|
|
19
|
+
答 = txtFmt(答).trim();
|
|
20
|
+
if (答.startsWith('1. ')) {
|
|
21
|
+
答 = '\n' + 答;
|
|
26
22
|
}
|
|
23
|
+
md_li.push('## ' + 题 + '\n问: ' + txtFmt(问).trimEnd() + '\n\n答: ' + 答 + '\n');
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
return md_li.join('\n');
|
package/fmtSeg.js
CHANGED
|
@@ -4,7 +4,7 @@ import TOPIC_SCHEMA from './TOPIC_SCHEMA.js';
|
|
|
4
4
|
import retry from '@3-/retry';
|
|
5
5
|
|
|
6
6
|
export default retry(async(chat, txt) => {
|
|
7
|
-
return (await chat(`将以下语音对话转为JSON
|
|
7
|
+
return (await chat(`将以下语音对话转为JSON数组,确保所有对话内容都必须被覆盖,不可遗漏。内容、术语要忠于原文,严禁脑补。:\n` + txt, TOPIC_SCHEMA, "你是专业资深的秘书", {
|
|
8
8
|
generationConfig: {
|
|
9
9
|
temperature: 0
|
|
10
10
|
}
|
package/gemini.js
CHANGED
|
@@ -3,7 +3,7 @@ import sleep from '@3-/sleep';
|
|
|
3
3
|
|
|
4
4
|
import merge from 'lodash-es/merge.js';
|
|
5
5
|
|
|
6
|
-
export default (token_li, model = 'gemini-
|
|
6
|
+
export default (token_li, model = 'gemini-3-pro-preview') => { // model='gemini-2.5-pro'
|
|
7
7
|
var _NEXT_TOKEN, _nextToken, generate_content_url, nextToken;
|
|
8
8
|
generate_content_url = 'https://generativelanguage.googleapis.com/v1beta/models/' + model + ':generateContent';
|
|
9
9
|
token_li.sort(() => {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@3-/aiapi","version":"0.1.
|
|
1
|
+
{"name":"@3-/aiapi","version":"0.1.63","repository":{"type":"git","url":"git+https://atomgit.com/i18n/lib.git"},"homepage":"https://atomgit.com/i18n/lib/tree/dev/aiapi","author":"i18n.site@gmail.com","license":"MulanPSL-2.0","exports":{".":"./lib.js","./*":"./*"},"files":["./*"],"devDependencies":{"@3-/read":"^0.1.4"},"scripts":{},"type":"module","dependencies":{"@3-/retry":"^0.0.2","@3-/rm_cn_space":"^0.1.1","@3-/sleep":"^0.0.4","@3-/txt_li":"^0.1.5","@3-/utf8":"^0.0.4","lodash-es":"^4.17.21"}}
|