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