@3-/aiapi 0.1.20 → 0.1.22

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.
Files changed (2) hide show
  1. package/factCheck.js +9 -8
  2. package/package.json +1 -1
package/factCheck.js CHANGED
@@ -95,28 +95,28 @@ addUrl = (text, items) => {
95
95
  };
96
96
 
97
97
  txtLi = (txt) => {
98
- var add_tag, i, id, pre, r, reset, t, tag, trim, txt_li;
98
+ var all_tag, i, id, pre, r, reset, t, tag, trim, txt_li;
99
99
  r = [];
100
100
  reset = () => {
101
- r.push(t);
101
+ all_tag = new Set(['标题', '观点', '事实', '失实度']);
102
+ if (t) {
103
+ r.push(t);
104
+ }
102
105
  pre = t = void 0;
103
106
  };
104
107
  txt_li = txt.replaceAll('**', '').split('\n');
105
- add_tag = new Set(['标题', '观点', '事实', '失实度']);
106
108
  out: //;
107
109
  for (i of txt_li) {
108
110
  if (i.startsWith('- id:')) {
109
- if (t) {
110
- reset();
111
- }
111
+ reset();
112
112
  id = parseInt(i.slice(5).trim());
113
113
  if (id) {
114
114
  t = {id};
115
115
  }
116
116
  } else if (t) {
117
117
  trim = i.trimStart().replace('- ', '');
118
- for (tag of add_tag) {
119
- add_tag.delete(tag);
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
  ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3-/aiapi",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://atomgit.com/i18n/lib.git"