@3-/aiapi 0.1.19 → 0.1.21
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 +7 -8
- package/package.json +1 -1
package/factCheck.js
CHANGED
|
@@ -95,13 +95,14 @@ addUrl = (text, items) => {
|
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
txtLi = (txt) => {
|
|
98
|
-
var i, id,
|
|
98
|
+
var all_tag, i, id, pre, r, 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
104
|
txt_li = txt.replaceAll('**', '').split('\n');
|
|
105
|
+
all_tag = new Set(['标题', '观点', '事实', '失实度']);
|
|
105
106
|
out: //;
|
|
106
107
|
for (i of txt_li) {
|
|
107
108
|
if (i.startsWith('- id:')) {
|
|
@@ -114,14 +115,11 @@ txtLi = (txt) => {
|
|
|
114
115
|
}
|
|
115
116
|
} else if (t) {
|
|
116
117
|
trim = i.trimStart().replace('- ', '');
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (trim.startsWith(
|
|
120
|
-
pos = trim.indexOf(':');
|
|
121
|
-
tag = trim.slice(0, pos).trim();
|
|
118
|
+
for (tag of all_tag) {
|
|
119
|
+
all_tag.delete(tag);
|
|
120
|
+
if (trim.startsWith(tag + ':')) {
|
|
122
121
|
pre = tag;
|
|
123
|
-
|
|
124
|
-
t[tag] = msg;
|
|
122
|
+
t[tag] = trim.slice(tag.length + 1).trim();
|
|
125
123
|
if (tag === '失实度') {
|
|
126
124
|
reset();
|
|
127
125
|
}
|
|
@@ -159,6 +157,7 @@ export default retry(async(chat, li) => {
|
|
|
159
157
|
return new Map();
|
|
160
158
|
}
|
|
161
159
|
content = content.parts[0].text;
|
|
160
|
+
console.log(content);
|
|
162
161
|
url_li = [];
|
|
163
162
|
for (x of groundingChunks) {
|
|
164
163
|
({
|