@christianriedl/utils 1.0.132 → 1.0.133

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
@@ -87,7 +87,7 @@ export interface IOpenAIServiceWithVectorStore extends IOpenAIServiceWithTools {
87
87
  initializeVectorStore(): Promise<boolean>;
88
88
  getVectorStore(vectorStoreId: string): IVectorStore | undefined;
89
89
  addVectorStore(vectorStoreName: string): Promise<boolean>;
90
- addFile(fileUrl: string, vectorStoreName: string, wait?: boolean): Promise<boolean>;
90
+ addFile(fileUrl: string | File, vectorStoreName: string, wait?: boolean): Promise<boolean>;
91
91
  deleteFile(fileId: string): Promise<boolean>;
92
92
  deleteVectorStore(vectorStoreId: string): Promise<boolean>;
93
93
  getFileId(fileUrl: string): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/utils",
3
- "version": "1.0.132",
3
+ "version": "1.0.133",
4
4
  "description": "Interfaces, local storage, service worker, configuration, application state",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -99,12 +99,12 @@
99
99
  useChanged.value = false;
100
100
  }
101
101
  function vectorStoreSelected() {
102
- const vs = openAI.getVectorStore(selectedVectorStoreName.value);
103
- vectorStoreFiles.value.splice(0, vectorStoreFiles.value.length;
102
+ const vs = openAI.vectorStore![selectedVectorStoreName.value];
103
+ vectorStoreFiles.value.splice(0, vectorStoreFiles.value.length);
104
104
  if (vs) {
105
- vectorStoreFiles.value.splice(0, 0, ...vs.files.map(file => file.name);
106
- if (vs.files.length > 0) {
107
- selectedVectorStoreFile.value = vs.files[0].name;
105
+ vectorStoreFiles.value.splice(0, 0, ...Object.values(vs.files) as string[]);
106
+ if (vectorStoreFiles.value.length > 0) {
107
+ selectedVectorStoreFile.value = vectorStoreFiles.value[0];
108
108
  }
109
109
  }
110
110
  }
@@ -120,8 +120,8 @@
120
120
  initializeTools();
121
121
  }
122
122
  async function deleteVectorStore() {
123
- const id = openAI.vectorStore![selectedVectorStoreName.value]);
124
- if (!openAI.deleteVectorStore(id)) {
123
+ const vs = openAI.vectorStore![selectedVectorStoreName.value];
124
+ if (!openAI.deleteVectorStore(vs.id)) {
125
125
  alert('Vector Store not deleted, error ! ');
126
126
  return;
127
127
  }
@@ -151,7 +151,8 @@
151
151
  try {
152
152
  files = await (window as any).showOpenFilePicker();
153
153
  if (files.length > 0) {
154
- selectedVectorStoreFile.value = files[0].name;
154
+ const file = await files[0].getFile();
155
+ selectedVectorStoreFile.value = file.name;
155
156
  }
156
157
  }
157
158
  catch (e) {
@@ -163,29 +164,29 @@
163
164
 
164
165
  <template>
165
166
  <v-container fluid class="bg-office">
166
- <h2>OpenAI Settings</h2>
167
+ <h4>OpenAI Settings</h4>
167
168
  <v-row dense align="center">
168
169
  <v-col cols="3">
169
- <v-text-field v-model="options.model" type="string" label="Model" density="compact" @change="onOptionChange"></v-text-field>
170
+ <v-text-field v-model="options.model" type="string" hide-details label="Model" density="compact" @change="onOptionChange"></v-text-field>
170
171
  </v-col>
171
172
  <v-col cols="2">
172
- <v-select v-model="options.outputFormat" :items="outputFormats" persistent-hint density="compact"
173
+ <v-select v-model="options.outputFormat" :items="outputFormats" hide-details density="compact"
173
174
  label="Format" @update:modelValue="onOptionChange">
174
175
  </v-select>
175
176
  </v-col>
176
177
  <v-col cols="2">
177
- <v-select v-model="options.reasoning_effort_level" :items="reasoningEffortLevels" persistent-hint density="compact"
178
+ <v-select v-model="options.reasoning_effort_level" :items="reasoningEffortLevels" hide-details density="compact"
178
179
  label="Reasoning" @update:modelValue="onOptionChange">
179
180
  </v-select>
180
181
  </v-col>
181
182
  <v-col cols="2">
182
- <v-text-field v-model="options.max_output_tokens" type="number" label="Max Token" density="compact" @change="onOptionChange"></v-text-field>
183
+ <v-text-field v-model="options.max_output_tokens" type="number" hide-details clearable label="Max Token" density="compact" @change="onOptionChange"></v-text-field>
183
184
  </v-col>
184
185
  <v-col cols="1">
185
- <v-text-field v-model="options.temperature" type="number" label="Temperature" density="compact" @change="onOptionChange"></v-text-field>
186
+ <v-text-field v-model="options.temperature" type="number" hide-details clearable label="Temperature" density="compact" @change="onOptionChange"></v-text-field>
186
187
  </v-col>
187
188
  <v-col cols="1">
188
- <v-text-field v-model="options.top_p" type="number" label="Top P" density="compact" @change="onOptionChange"></v-text-field>
189
+ <v-text-field v-model="options.top_p" type="number" hide-details clearable label="Top P" density="compact" @change="onOptionChange"></v-text-field>
189
190
  </v-col>
190
191
  <v-col cols="1">
191
192
  <v-checkbox v-model="options.store" label="Store" density="compact" @change="onOptionChange"></v-checkbox>
@@ -193,22 +194,22 @@
193
194
  </v-row>
194
195
  <v-row dense align="center">
195
196
  <v-col cols="12">
196
- <v-text-field v-model="options.instructions" type="string" label="System Message" density="compact" @change="onOptionChange"></v-text-field>
197
+ <v-text-field v-model="options.instructions" type="string" hide-details clearable label="System Message" density="compact" @change="onOptionChange"></v-text-field>
197
198
  </v-col>
198
199
  </v-row>
199
200
  <template v-for="(tool, key) in tools">
200
201
  <v-row v-if="tool.type == 'mcp'" dense align="center">
201
202
  <v-col cols="2">
202
- <v-text-field v-model="tool.server_label" disabled type="string" label="mcp" density="compact" @change="onToolChange"></v-text-field>
203
+ <v-text-field v-model="tool.server_label" disabled type="string" hide-details label="mcp" density="compact" @change="onToolChange"></v-text-field>
203
204
  </v-col>
204
205
  <v-col cols="4">
205
- <v-text-field v-model="tool.server_url" type="string" label="Url" density="compact" @change="onToolChange"></v-text-field>
206
+ <v-text-field v-model="tool.server_url" type="string" hide-details clearable label="Url" density="compact" @change="onToolChange"></v-text-field>
206
207
  </v-col>
207
208
  <v-col cols="3">
208
- <v-text-field v-model="tool.server_description" type="string" label="Description" density="compact" density="compact" @change="onToolChange"></v-text-field>
209
+ <v-text-field v-model="tool.server_description" type="string" hide-details clearable label="Description" density="compact" @change="onToolChange"></v-text-field>
209
210
  </v-col>
210
211
  <v-col cols="2">
211
- <v-select v-model="tool.require_approval" :items="mcpApprovals" persistent-hint
212
+ <v-select v-model="tool.require_approval" :items="mcpApprovals" hide-details
212
213
  density="compact" label="Approval" @update:modelValue="onToolChange">
213
214
  </v-select>
214
215
  </v-col>
@@ -218,15 +219,14 @@
218
219
  </v-row>
219
220
  <v-row v-if="tool.type == 'file_search'" dense align="center">
220
221
  <v-col cols="2">
221
- <v-text-field :model-value="key" disabled type="string" label="file_search" density="compact" @change="onToolChange"></v-text-field>
222
+ <v-text-field :model-value="key" disabled type="string" hide-details label="file_search" density="compact" @change="onToolChange"></v-text-field>
222
223
  </v-col>
223
224
  <v-col cols="7">
224
- <v-select v-model="fileSearch[key]" :items="vectorStoreNames" density="compact" multiple persistent-hint
225
- label="Vector Stores" @update:modelValue="onToolChange">
225
+ <v-select v-model="fileSearch[key]" :items="vectorStoreNames" density="compact" multiple hide-details label="Vector Stores" @update:modelValue="onToolChange">
226
226
  </v-select>
227
227
  </v-col>
228
228
  <v-col cols="2">
229
- <v-text-field v-model="tool.max_num_results" type="string" label="Max Results" density="compact" @change="onToolChange"></v-text-field>
229
+ <v-text-field v-model="tool.max_num_results" type="string" hide-details clearable label="Max Results" density="compact" @change="onToolChange"></v-text-field>
230
230
  </v-col>
231
231
  <v-col cols="1">
232
232
  <v-checkbox v-model="use[key]" label="Use" density="compact" @update:modelValue="onUseChange"></v-checkbox>
@@ -234,16 +234,16 @@
234
234
  </v-row>
235
235
  <v-row v-if="tool.type.startsWith('web_search')" dense align="center">
236
236
  <v-col cols="2">
237
- <v-text-field :model-value="key" disabled type="string" label="file_search" density="compact" @change="onToolChange"></v-text-field>
237
+ <v-text-field :model-value="key" disabled type="string" hide-details label="file_search" density="compact" @change="onToolChange"></v-text-field>
238
238
  </v-col>
239
239
  <v-col cols="2">
240
- <v-text-field v-model="tool.user_location.country" type="string" label="Country" density="compact" @change="onToolChange"></v-text-field>
240
+ <v-text-field v-model="tool.user_location.country" type="string" hide-details clearable label="Country" density="compact" @change="onToolChange"></v-text-field>
241
241
  </v-col>
242
242
  <v-col cols="3">
243
- <v-text-field v-model="tool.user_location.city" type="string" label="City" density="compact" @change="onToolChange"></v-text-field>
243
+ <v-text-field v-model="tool.user_location.city" type="string" hide-details clearable label="City" density="compact" @change="onToolChange"></v-text-field>
244
244
  </v-col>
245
245
  <v-col cols="4">
246
- <v-text-field v-model="tool.user_location.region" type="string" label="Region" density="compact" @change="onToolChange"></v-text-field>
246
+ <v-text-field v-model="tool.user_location.region" type="string" hide-details clearable label="Region" density="compact" @change="onToolChange"></v-text-field>
247
247
  </v-col>
248
248
  <v-col cols="1">
249
249
  <v-checkbox v-model="use[key]" label="Use" density="compact" @update:modelValue="onUseChange"></v-checkbox>
@@ -270,43 +270,33 @@
270
270
  </v-btn>
271
271
  </v-col>
272
272
  </v-row>
273
- <v-row v-if="!props.ismobile && openAI.vectoreStore" dense align="center">
274
- <v-col cols="2">
275
- <v-combobox v-model="selectedVectorStoreName" :items="vectorStoreNames" density="compact" @update:modelValue="vectorStoreSelected()"></v-combobox>
276
- </v-col>
277
- <v-col cols="1">
278
- <v-btn :class="bg-office" @click="deleteVectorStore">
279
- VS
280
- <v-icon icon="$delete"></v-icon>
281
- </v-btn>
282
- </v-col>
283
- <v-col cols="1">
284
- <v-btn :class="bg-office" @click="addVectorStore">
285
- VS
286
- <v-icon icon="$plus"></v-icon>
287
- </v-btn>
288
- </v-col>
289
- <v-col cols="5">
290
- <v-combobox v-model="selectedVectorStoreFile" :items="vectorStoreFiles" density="compact"></v-combobox>
291
- </v-col>
292
- <v-col cols="1">
293
- <v-btn :class="bg-office" @click="searchFile">
294
- FILE
295
- <v-icon icon="$search"></v-icon>
296
- </v-btn>
297
- </v-col>
298
- <v-col cols="1">
299
- <v-btn :class="bg-office" @click="deleteFile">
300
- FILE
301
- <v-icon icon="$delete"></v-icon>
302
- </v-btn>
303
- </v-col>
304
- <v-col cols="1">
305
- <v-btn :class="bg-office" @click="addFile">
306
- FILE
307
- <v-icon icon="add"></v-icon>
308
- </v-btn>
309
- </v-col>
310
- </v-row>
273
+ <template v-if="!props.ismobile && openAI.vectorStore">
274
+ <v-divider></v-divider>
275
+ <h4> </h4>
276
+ <h4>Vector Store</h4>
277
+ <v-row dense align="center">
278
+ <v-col cols="2">
279
+ <v-combobox v-model="selectedVectorStoreName" :items="vectorStoreNames" hide-details density="compact" @update:modelValue="vectorStoreSelected()"></v-combobox>
280
+ </v-col>
281
+ <v-col cols="1">
282
+ <v-btn variant="text" prepend-icon="$delete" @click="deleteVectorStore">VS</v-btn>
283
+ </v-col>
284
+ <v-col cols="1">
285
+ <v-btn variant="text" prepend-icon="$plus" @click="addVectorStore">VS</v-btn>
286
+ </v-col>
287
+ <v-col cols="5">
288
+ <v-combobox v-model="selectedVectorStoreFile" :items="vectorStoreFiles" hide-details density="compact"></v-combobox>
289
+ </v-col>
290
+ <v-col cols="1">
291
+ <v-btn variant="text" prepend-icon="$search" @click="searchFile">FILE</v-btn>
292
+ </v-col>
293
+ <v-col cols="1">
294
+ <v-btn variant="text" prepend-icon="$delete" @click="deleteFile">FILE</v-btn>
295
+ </v-col>
296
+ <v-col cols="1">
297
+ <v-btn variant="text" prepend-icon="$plus" @click="addFile">FILE</v-btn>
298
+ </v-col>
299
+ </v-row>
300
+ </template>
311
301
  </v-container>
312
302
  </template>