@3-/aiapi 0.1.17 → 0.1.19
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/factCheck.js +12 -10
- package/fmtWithFactCheck.js +1 -1
- package/package.json +1 -1
package/factCheck.js
CHANGED
|
@@ -15,7 +15,7 @@ PREFIX = `对下文问答对做事实核查,只输出与事实不符的观点。
|
|
|
15
15
|
必须搜索到明确的反面事实才算失实,模棱两可算无法核实。
|
|
16
16
|
输出文本必须是简体中文,格式如下:
|
|
17
17
|
- id:
|
|
18
|
-
标题:
|
|
18
|
+
标题: 要简短,几个词即可
|
|
19
19
|
观点:
|
|
20
20
|
事实: 须标注搜索到的事实网页
|
|
21
21
|
失实度: ${SHOW_KIND.join(' / ')} / 基本一致 / 无法核实
|
|
@@ -95,14 +95,15 @@ addUrl = (text, items) => {
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
txtLi = (txt) => {
|
|
98
|
-
var i, id, msg, pos, pre, r, ref, reset, t, tag, trim;
|
|
98
|
+
var i, id, msg, pos, pre, r, ref, reset, t, tag, trim, txt_li;
|
|
99
99
|
r = [];
|
|
100
100
|
reset = () => {
|
|
101
101
|
r.push(t);
|
|
102
102
|
pre = t = void 0;
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
txt_li = txt.replaceAll('**', '').split('\n');
|
|
105
|
+
out: //;
|
|
106
|
+
for (i of txt_li) {
|
|
106
107
|
if (i.startsWith('- id:')) {
|
|
107
108
|
if (t) {
|
|
108
109
|
reset();
|
|
@@ -112,18 +113,19 @@ txtLi = (txt) => {
|
|
|
112
113
|
t = {id};
|
|
113
114
|
}
|
|
114
115
|
} else if (t) {
|
|
115
|
-
trim = i.trimStart();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
trim = i.trimStart().replace('- ', '');
|
|
117
|
+
ref = ['标题', '观点', '事实', '失实度'];
|
|
118
|
+
for (t of ref) {
|
|
119
|
+
if (trim.startsWith(t + ':')) {
|
|
120
|
+
pos = trim.indexOf(':');
|
|
121
|
+
tag = trim.slice(0, pos).trim();
|
|
120
122
|
pre = tag;
|
|
121
123
|
msg = trim.slice(pos + 1).trim();
|
|
122
124
|
t[tag] = msg;
|
|
123
125
|
if (tag === '失实度') {
|
|
124
126
|
reset();
|
|
125
127
|
}
|
|
126
|
-
continue;
|
|
128
|
+
continue out;
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
if (pre) {
|
package/fmtWithFactCheck.js
CHANGED