@christianriedl/utils 1.0.134 → 1.0.136

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
@@ -79,6 +79,7 @@ export interface IOpenAIServiceWithTools extends IOpenAIService {
79
79
  addFileSearchTool(label: string, tool: IFileSearchTool): 'notfound' | 'exists' | 'changed';
80
80
  addWebSearchTool(label: string, tool: IWebSearchTool): void;
81
81
  addFunctionTool(tool: IFunctionTool, toolFunction: ToolFunction): void;
82
+ getToolFunctions(tool: string): Promise<IResponseResult>;
82
83
  }
83
84
  export interface IVectorStore {
84
85
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/utils",
3
- "version": "1.0.134",
3
+ "version": "1.0.136",
4
4
  "description": "Interfaces, local storage, service worker, configuration, application state",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,6 +3,11 @@
3
3
  import { appConfigSymbol, AppConfig, Dictionary } from '@christianriedl/utils';
4
4
  import { getOpenAISymbol, IOpenAIServiceWithVectorStore, IOpenAIAppConfig, IOpenAIOptions, ITool } from '@christianriedl/utils';
5
5
 
6
+ interface IFunction {
7
+ name: string;
8
+ description: string;
9
+ };
10
+
6
11
  const props = defineProps<{ tools?: string[], ismobile: boolean }>();
7
12
  const emits = defineEmits<{ (e: 'use', tools: string[], persist: boolean): void, (e: 'back'): void }>();
8
13
 
@@ -24,6 +29,9 @@
24
29
  const vectorStoreFiles = ref<string[]>([]);
25
30
  const selectedVectorStoreName = ref('');
26
31
  const selectedVectorStoreFile = ref('');
32
+ const showFunctions = ref(false);
33
+ const toolName = ref('');
34
+ const toolFunctions = reactive<IFunction[]>([]);
27
35
  let fileHandle: FileSystemFileHandle | null = null;
28
36
 
29
37
  initializeTools();
@@ -66,6 +74,15 @@
66
74
  function onUseChange() {
67
75
  useChanged.value = true;
68
76
  }
77
+ async function showTools(serverLabel: string) {
78
+ toolName.value = serverLabel;
79
+ const res = await openAI.getToolFunctions(serverLabel);
80
+ if (res.json) {
81
+ const funcs = res.json.tools as IFunction[];
82
+ toolFunctions.splice(0, toolFunctions.length, ...funcs);
83
+ showFunctions.value = true;
84
+ }
85
+ }
69
86
  function onSave() {
70
87
  const persist = window.confirm('Do you want to persist the changes?');
71
88
  if (toolsChanged.value) {
@@ -216,7 +233,7 @@
216
233
  <template v-for="(tool, key) in tools">
217
234
  <v-row v-if="tool.type == 'mcp'" dense align="center">
218
235
  <v-col cols="2">
219
- <v-text-field v-model="tool.server_label" type="string "hide-details disabled label="mcp" density="compact" @change="onToolChange"></v-text-field>
236
+ <v-text-field v-model="tool.server_label" type="string " hide-details disabled label="mcp" density="compact" @change="onToolChange"></v-text-field>
220
237
  </v-col>
221
238
  <v-col cols="4">
222
239
  <v-text-field v-model="tool.server_url" type="string" hide-details clearable label="Url" density="compact" @change="onToolChange"></v-text-field>
@@ -224,11 +241,14 @@
224
241
  <v-col cols="3">
225
242
  <v-text-field v-model="tool.server_description" type="string" hide-details clearable label="Description" density="compact" @change="onToolChange"></v-text-field>
226
243
  </v-col>
227
- <v-col cols="2">
228
- <v-select v-model="tool.require_approval" :items="mcpApprovals" hide-details
244
+ <v-col cols="props.isMobile ? 2 : 1">
245
+ <v-select v-model="tool.require_approval" :items="mcpApprovals" hide-details
229
246
  density="compact" label="Approval" @update:modelValue="onToolChange">
230
247
  </v-select>
231
248
  </v-col>
249
+ <v-col v-if="!props.ismobile" cols="1">
250
+ <v-btn variant="text" prepend-icon="$search" @click="showTools(tool.server_label)">TOOLS</v-btn>
251
+ </v-col>
232
252
  <v-col cols="1">
233
253
  <v-checkbox v-model="use[key]" label="Use" hide-details density="compact" @update:modelValue="onUseChange"></v-checkbox>
234
254
  </v-col>
@@ -268,20 +288,17 @@
268
288
  </template>
269
289
  <v-row dense align="center">
270
290
  <v-col cols="2">
271
- <v-btn class="bg-office" @click="emits('back')">
272
- BACK
291
+ <v-btn class="bg-office" @click="emits('back')">BACK
273
292
  <v-icon icon="$back"></v-icon>
274
293
  </v-btn>
275
294
  </v-col>
276
295
  <v-col cols="2">
277
- <v-btn :disabled="!optionsChanged && !toolsChanged" class="bg-office" @click="onSave">
278
- SAVE
296
+ <v-btn :disabled="!optionsChanged && !toolsChanged" class="bg-office" @click="onSave">SAVE
279
297
  <v-icon icon="$save"></v-icon>
280
298
  </v-btn>
281
299
  </v-col>
282
300
  <v-col cols="2">
283
- <v-btn :disabled="!useChanged" class="bg-office" @click="onSaveUsage">
284
- SAVE TOOL USE
301
+ <v-btn :disabled="!useChanged" class="bg-office" @click="onSaveUsage">SAVE TOOL USE
285
302
  <v-icon icon="$save"></v-icon>
286
303
  </v-btn>
287
304
  </v-col>
@@ -314,5 +331,21 @@
314
331
  </v-col>
315
332
  </v-row>
316
333
  </template>
334
+ <v-dialog v-model="showFunctions">
335
+ <v-container fluid class="bg-office overflow-y-auto">
336
+ <h4>{{toolName + " functions"}}</h4>
337
+ <v-row dense align="center" v-for="func in toolFunctions" :key="func.name">
338
+ <v-col cols="4">{{func.name}}</v-col>
339
+ <v-col cols="8">{{func.description}}</v-col>
340
+ </v-row>
341
+ <v-row dense align="center">
342
+ <v-col cols="2">
343
+ <v-btn class="bg-office" @click="showFunctions = false">BACK
344
+ <v-icon icon="$back"></v-icon>
345
+ </v-btn>
346
+ </v-col>
347
+ </v-row>
348
+ </v-container>
349
+ </v-dialog>
317
350
  </v-container>
318
351
  </template>