@christianriedl/utils 1.0.142 → 1.0.144

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/dist/iOpenAI.d.ts CHANGED
@@ -46,7 +46,8 @@ export interface ITool {
46
46
  export interface IMcpTool extends ITool {
47
47
  type: 'mcp';
48
48
  server_label: string;
49
- server_url: string;
49
+ server_url?: string;
50
+ connector_id?: string;
50
51
  allowed_tools?: string[];
51
52
  require_approval?: 'always' | 'never' | null;
52
53
  server_description?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/utils",
3
- "version": "1.0.142",
3
+ "version": "1.0.144",
4
4
  "description": "Interfaces, local storage, service worker, configuration, application state",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,8 +37,10 @@
37
37
  const toolName = ref('');
38
38
  const toolFunctions = reactive<IFunction[]>([]);
39
39
  let fileHandle: FileSystemFileHandle | null = null;
40
+ let vsSelected = false;
40
41
 
41
42
  initializeTools();
43
+ checkAllFilter();
42
44
 
43
45
  function initializeTools() {
44
46
  selectedVectorStoreFile.value = '';
@@ -131,7 +133,7 @@
131
133
  alert('Tool with this name already exists, please choose another name !');
132
134
  return;
133
135
  }
134
- const mcpTool: IMcpTool = { type: 'mcp', server_label: name, server_url: '<set url>', require_approval: 'never' };
136
+ const mcpTool: IMcpTool = { type: 'mcp', server_label: name, server_url: '<set url>', connector_id: '<set connector id>' require_approval: 'never' };
135
137
  tools[name] = mcpTool;
136
138
  }
137
139
  }
@@ -148,10 +150,13 @@
148
150
  }
149
151
  }
150
152
  async function vectorStoreSelected() {
151
-
152
153
  selectedVectorStoreFile.value = 'Get vectorestore files ...';
153
- if (!await openAI.initializeVectorStoreFiles())
154
- return;
154
+ if (!vsSelected) {
155
+ if (!await openAI.initializeVectorStoreFiles())
156
+ return;
157
+ checkAllFilter();
158
+ vsSelected = true;
159
+ }
155
160
  const vs = openAI.vectorStore![selectedVectorStoreName.value];
156
161
  vectorStoreFiles.value.splice(0, vectorStoreFiles.value.length);
157
162
  if (vs) {
@@ -301,6 +306,33 @@
301
306
  return;
302
307
  }
303
308
  }
309
+ function checkAllFilter(): number {
310
+ let count = 0;
311
+ for (const key in openAI.vectorStore) {
312
+ const vs = openAI.vectorStore[key];
313
+ count += checkMissingFilter(vs.metadata, openAI.vsMetadata);
314
+ for (const fileId in vs.files) {
315
+ const file = vs.files[fileId];
316
+ count += checkMissingFilter(file.attributes, openAI.fileAttributes);
317
+ }
318
+ }
319
+ if (count > 0) {
320
+ window.alert(`There are ${count} missing attributes in metadata/attributes ! Please check the logs.`);
321
+ }
322
+ return count;
323
+ }
324
+ function checkMissingFilter(attributes: Dictionary<any> | null, items: IDataItem[]): number {
325
+ if (!attributes)
326
+ return 0;
327
+ let count = 0;
328
+ for (const name in attributes) {
329
+ if (!items.find(i => i.name === name)) {
330
+ openAI.log.error(`Attribute ${name} not found in metadata !`);
331
+ count++;;
332
+ }
333
+ }
334
+ return count;
335
+ }
304
336
  </script>
305
337
 
306
338
  <template>
@@ -345,10 +377,13 @@
345
377
  <v-col cols="2">
346
378
  <v-text-field v-model="tool.server_label" type="string " hide-details disabled label="mcp" density="compact" @change="onToolChange"></v-text-field>
347
379
  </v-col>
348
- <v-col cols="4">
380
+ <v-col cols="3">
349
381
  <v-text-field v-model="tool.server_url" type="string" hide-details clearable label="Url" density="compact" @change="onToolChange"></v-text-field>
350
382
  </v-col>
351
- <v-col cols="3">
383
+ <v-col cols="2">
384
+ <v-text-field v-model="tool.connector_id" type="string" hide-details clearable label="Connector Id" density="compact" @change="onToolChange"></v-text-field>
385
+ </v-col>
386
+ <v-col cols="2">
352
387
  <v-text-field v-model="tool.server_description" type="string" hide-details clearable label="Description" density="compact" @change="onToolChange"></v-text-field>
353
388
  </v-col>
354
389
  <v-col cols="props.isMobile ? 2 : 1">
@@ -52,7 +52,7 @@
52
52
  const item = items[i];
53
53
  if (operators[item.name]) {
54
54
  if (i < numvs) {
55
- filter.vectorStoreFilter[item.name] = item.value;
55
+ filter.vectorStoreFilter[item.name] = item.value.toString();
56
56
  }
57
57
  else {
58
58
  const f: IComparisonFilter = { key: item.name, type: operators[item.name] as 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte', value: item.value };