@christianriedl/utils 1.0.147 → 1.0.149
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 +14 -2
- package/package.json +1 -1
- package/src/components/OpenAI.vue +6 -0
- package/src/components/OpenAIConfig.vue +29 -0
- package/src/components/OpenAIFilter.vue +2 -35
- package/src/components/OpenAIMetaData.vue +0 -19
- package/src/components/SettingsLine.vue +0 -20
- package/src/views/SettingsPage.vue +0 -13
package/dist/iOpenAI.d.ts
CHANGED
|
@@ -17,10 +17,11 @@ export interface IResultContent {
|
|
|
17
17
|
export interface IResultOutput {
|
|
18
18
|
id: string;
|
|
19
19
|
queries?: string[];
|
|
20
|
+
result?: string;
|
|
20
21
|
results?: any[];
|
|
21
22
|
role?: 'assistant';
|
|
22
23
|
status?: 'in_progress' | 'completed' | 'incomplete';
|
|
23
|
-
type: 'message' | 'file_search_call' | 'mcp_call' | 'function_call';
|
|
24
|
+
type: 'message' | 'file_search_call' | 'mcp_call' | 'function_call' | 'image_generation';
|
|
24
25
|
content?: IResultContent[];
|
|
25
26
|
}
|
|
26
27
|
export interface IResponseResult {
|
|
@@ -28,6 +29,7 @@ export interface IResponseResult {
|
|
|
28
29
|
output?: IResultOutput[];
|
|
29
30
|
text?: string;
|
|
30
31
|
error?: string;
|
|
32
|
+
image?: string;
|
|
31
33
|
json?: any;
|
|
32
34
|
usage?: {
|
|
33
35
|
inputTokens: number;
|
|
@@ -41,7 +43,7 @@ export interface ISchema {
|
|
|
41
43
|
schema?: Dictionary<unknown>;
|
|
42
44
|
}
|
|
43
45
|
export interface ITool {
|
|
44
|
-
type: 'mcp' | 'file_search' | 'web_search_preview' | 'web_search_preview_2025_03_11' | 'function';
|
|
46
|
+
type: 'mcp' | 'file_search' | 'web_search_preview' | 'web_search_preview_2025_03_11' | 'function' | 'image_generation';
|
|
45
47
|
}
|
|
46
48
|
export interface IMcpTool extends ITool {
|
|
47
49
|
type: 'mcp';
|
|
@@ -64,6 +66,15 @@ export interface IWebSearchLocation {
|
|
|
64
66
|
country?: string | null;
|
|
65
67
|
region?: string | null;
|
|
66
68
|
}
|
|
69
|
+
export interface IImageGenerationTool extends ITool {
|
|
70
|
+
type: 'image_generation';
|
|
71
|
+
background?: 'transparent' | 'opaque' | 'auto';
|
|
72
|
+
input_fidelity?: 'low' | 'high';
|
|
73
|
+
model?: string;
|
|
74
|
+
output_format?: 'jpeg' | 'png' | 'webp';
|
|
75
|
+
quality?: 'low' | 'medium' | 'high' | 'auto';
|
|
76
|
+
size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
|
|
77
|
+
}
|
|
67
78
|
export interface IWebSearchTool extends ITool {
|
|
68
79
|
type: 'web_search_preview' | 'web_search_preview_2025_03_11';
|
|
69
80
|
search_context_size?: 'low' | 'medium' | 'high';
|
|
@@ -114,6 +125,7 @@ export interface IOpenAIServiceWithTools extends IOpenAIService {
|
|
|
114
125
|
addMcpTool(tool: IMcpTool): void;
|
|
115
126
|
addFileSearchTool(label: string, tool: IFileSearchTool): 'notfound' | 'exists' | 'changed';
|
|
116
127
|
addWebSearchTool(label: string, tool: IWebSearchTool): void;
|
|
128
|
+
addImageGenerationTool(label: string, tool: IImageGenerationTool): void;
|
|
117
129
|
addFunctionTool(tool: IFunctionTool, toolFunction: ToolFunction): void;
|
|
118
130
|
getToolFunctions(tool: string): Promise<IResponseResult>;
|
|
119
131
|
}
|
package/package.json
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
const tools = ref(props.tools);
|
|
33
33
|
const filter = ref<IOpenAIFilter | undefined>(undefined);
|
|
34
34
|
const tooltips = computed(() => tools.value ? 'Tools: ' + tools.value.join(',') : 'No Tools');
|
|
35
|
+
const imageSrc = ref('');
|
|
35
36
|
|
|
36
37
|
onUnmounted(() => {
|
|
37
38
|
openAI.clearContext();
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
camera.value = undefined;
|
|
51
52
|
isCamera.value = false;
|
|
52
53
|
}
|
|
54
|
+
imageSrc.value = '';
|
|
53
55
|
if (imageUrl.value) {
|
|
54
56
|
answer = await openAI.response(question.value, undefined, imageUrl.value);
|
|
55
57
|
imageUrl.value = "";
|
|
@@ -62,6 +64,9 @@
|
|
|
62
64
|
answer = await openAI.response(question.value, undefined, undefined, undefined, filter.value);
|
|
63
65
|
}
|
|
64
66
|
}
|
|
67
|
+
if (answer && answer.image) {
|
|
68
|
+
imageSrc.value = answer.image;
|
|
69
|
+
}
|
|
65
70
|
if (answer && answer.text) {
|
|
66
71
|
emits('result', answer.text);
|
|
67
72
|
if (openAI.options.outputFormat == 'markdown') {
|
|
@@ -213,6 +218,7 @@
|
|
|
213
218
|
<v-row v-else v-for="(line, index) in replyLines" :key=index dense align="center">
|
|
214
219
|
<v-col cols="12">{{line}}</v-col>
|
|
215
220
|
</v-row>
|
|
221
|
+
<v-img v-if="imageSrc" :src="imageSrc"></v-img>
|
|
216
222
|
<v-dialog v-model="showConfig" :fullscreen="isMobile">
|
|
217
223
|
<OpenAIConfig :tools="tools" :ismobile="isMobile" @use="onUse" @back="showConfig=false"></OpenAIConfig>
|
|
218
224
|
</v-dialog>
|
|
@@ -429,6 +429,35 @@
|
|
|
429
429
|
<v-checkbox v-model="use[key]" label="Use" hide-details density="compact" @update:modelValue="onUseChange"></v-checkbox>
|
|
430
430
|
</v-col>
|
|
431
431
|
</v-row>
|
|
432
|
+
<v-row v-if="tool.type == 'image_generation'" dense align="center">
|
|
433
|
+
<v-col cols="1">
|
|
434
|
+
<v-text-field :model-value="key" type="string" hide-details disabled label="image_generation" density="compact" @change="onToolChange"></v-text-field>
|
|
435
|
+
</v-col>
|
|
436
|
+
<v-col cols="2">
|
|
437
|
+
<v-text-field v-model="tool.model" type="string" hide-details :clearable="canClear" label="Model" density="compact" @change="onToolChange"></v-text-field>
|
|
438
|
+
</v-col>
|
|
439
|
+
<v-col cols="2">
|
|
440
|
+
<v-select v-model="tool.input_fidelity" :items="['low', 'high' ]" hide-details density="compact"
|
|
441
|
+
label="Fidelity" @update:modelValue="onToolChange">
|
|
442
|
+
</v-select>
|
|
443
|
+
</v-col>
|
|
444
|
+
<v-col cols="2">
|
|
445
|
+
<v-select v-model="tool.quality" :items="['auto', 'low', 'medium', 'high' ]" hide-details density="compact"
|
|
446
|
+
label="Quality" @update:modelValue="onToolChange">
|
|
447
|
+
</v-select>
|
|
448
|
+
</v-col>
|
|
449
|
+
<v-col cols="3">
|
|
450
|
+
<v-select v-model="tool.size" :items="['auto', '1024x1024', '1024x1536', '1536x1024' ]" hide-details density="compact"
|
|
451
|
+
label="Size" @update:modelValue="onToolChange">
|
|
452
|
+
</v-select>
|
|
453
|
+
</v-col>
|
|
454
|
+
<v-col cols="1">
|
|
455
|
+
<v-btn icon="$delete" variant="tonal" @click.stop.prevent="onDelete(key)"></v-btn>
|
|
456
|
+
</v-col>
|
|
457
|
+
<v-col cols="1">
|
|
458
|
+
<v-checkbox v-model="use[key]" label="Use" hide-details density="compact" @update:modelValue="onUseChange"></v-checkbox>
|
|
459
|
+
</v-col>
|
|
460
|
+
</v-row>
|
|
432
461
|
<v-row v-if="tool.type.startsWith('web_search')" dense align="center">
|
|
433
462
|
<v-col cols="1">
|
|
434
463
|
<v-text-field :model-value="key" type="string" hide-details disabled label="file_search" density="compact" @change="onToolChange"></v-text-field>
|
|
@@ -81,22 +81,6 @@
|
|
|
81
81
|
<h4>Tools and FileSearch filter</h4>
|
|
82
82
|
<v-row dense>
|
|
83
83
|
<v-col cols="4">
|
|
84
|
-
<!--
|
|
85
|
-
<v-table density="compact">
|
|
86
|
-
<thead>
|
|
87
|
-
<tr>
|
|
88
|
-
<th class="font-weight-bold">Tool use</th>
|
|
89
|
-
</tr>
|
|
90
|
-
</thead>
|
|
91
|
-
<tbody>
|
|
92
|
-
<tr v-for="(tool,key) in tools" :key="key">
|
|
93
|
-
<td>
|
|
94
|
-
<v-checkbox density="compact" hide-details v-model="tools[key]" :label="key.toString()"></v-checkbox>
|
|
95
|
-
</td>
|
|
96
|
-
</tr>
|
|
97
|
-
</tbody>
|
|
98
|
-
</v-table>
|
|
99
|
-
-->
|
|
100
84
|
<v-row dense class="font-weight-bold">
|
|
101
85
|
<v-col cols="4">Tool Use</v-col>
|
|
102
86
|
</v-row>
|
|
@@ -108,23 +92,6 @@
|
|
|
108
92
|
</v-row>
|
|
109
93
|
</v-col>
|
|
110
94
|
<v-col cols="8">
|
|
111
|
-
<!--
|
|
112
|
-
<v-table density="compact">
|
|
113
|
-
<thead>
|
|
114
|
-
<tr>
|
|
115
|
-
<th class="font-weight-bold" style="width:35%">Name</th>
|
|
116
|
-
<th class="font-weight-bold" style="width:35%">Value</th>
|
|
117
|
-
<th class="font-weight-bold" style="width:30%">Op</th>
|
|
118
|
-
</tr>
|
|
119
|
-
</thead>
|
|
120
|
-
<tbody>
|
|
121
|
-
<settings-line v-for="(item, index) in items" :key="item.name" :item="item" :op="operators[item.name]"
|
|
122
|
-
:operations="index < numvs ? opsvs : opsfile" @change="onChange(item, true)"
|
|
123
|
-
@clear="onChange(item, false)" @operation="(op) => onOperation(item, op)">
|
|
124
|
-
</settings-line>
|
|
125
|
-
</tbody>
|
|
126
|
-
</v-table>
|
|
127
|
-
-->
|
|
128
95
|
<v-row dense class="font-weight-bold">
|
|
129
96
|
<v-col cols="6">Name</v-col>
|
|
130
97
|
<v-col cols="4">Value</v-col>
|
|
@@ -139,8 +106,8 @@
|
|
|
139
106
|
</v-row>
|
|
140
107
|
<v-row dense>
|
|
141
108
|
<v-col cols="12">
|
|
142
|
-
<v-btn @click="onBack()">BACK<v-icon icon="$back"></v-icon></v-btn>
|
|
143
|
-
<v-btn @click="emits('config')">CONFIG<v-icon icon="$settings"></v-icon></v-btn>
|
|
109
|
+
<v-btn class="bg-office" @click="onBack()">BACK<v-icon icon="$back"></v-icon></v-btn>
|
|
110
|
+
<v-btn class="bg-office" @click="emits('config')">CONFIG<v-icon icon="$settings"></v-icon></v-btn>
|
|
144
111
|
</v-col>
|
|
145
112
|
</v-row>
|
|
146
113
|
</v-container>
|
|
@@ -33,25 +33,6 @@
|
|
|
33
33
|
<template>
|
|
34
34
|
<v-container fluid class="bg-office">
|
|
35
35
|
<h4>{{header}}</h4>
|
|
36
|
-
<!--
|
|
37
|
-
<v-table>
|
|
38
|
-
<thead>
|
|
39
|
-
<tr>
|
|
40
|
-
<th class="font-weight-bold" style="width:50%">Name</th>
|
|
41
|
-
<th class="font-weight-bold" style="width:50%">Value</th>
|
|
42
|
-
</tr>
|
|
43
|
-
</thead>
|
|
44
|
-
<tbody>
|
|
45
|
-
<settings-line v-for="item in items" :key="item.name" :item="item" @change="onChange(item, true)" clearable @clear="onChange(item, false)"></settings-line>
|
|
46
|
-
<tr>
|
|
47
|
-
<td>
|
|
48
|
-
<v-btn @click="onBack">BACK</v-btn>
|
|
49
|
-
</td>
|
|
50
|
-
<td></td>
|
|
51
|
-
</tr>
|
|
52
|
-
</tbody>
|
|
53
|
-
</v-table>
|
|
54
|
-
-->
|
|
55
36
|
<v-row dense class="font-weight-bold">
|
|
56
37
|
<v-col cols="6">Topic</v-col>
|
|
57
38
|
<v-col cols="6">Parameter</v-col>
|
|
@@ -29,26 +29,6 @@
|
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
31
|
<template>
|
|
32
|
-
<!--
|
|
33
|
-
<tr v-if="isVisible" class="settingsline">
|
|
34
|
-
<td >{{description}}</td>
|
|
35
|
-
<td>
|
|
36
|
-
<v-switch v-if="isBoolean" v-model="item.value" :disabled="isDisabled" density="compact" hide-details color="primary"
|
|
37
|
-
:append-icon="props.clearable ? '$clear' : undefined" @update:modelValue="onChange" @click:append="onClear"></v-switch>
|
|
38
|
-
<v-text-field v-if="isString" v-model="item.value" :disabled="isDisabled" :clearable="props.clearable" density="compact"
|
|
39
|
-
hide-details type="string" @update:modelValue="onChange" @click:clear="onClear"></v-text-field>
|
|
40
|
-
<v-text-field v-if="isNumber" v-model="item.value" :disabled="isDisabled" :clearable="props.clearable" density="compact"
|
|
41
|
-
hide-details type="number" @update:modelValue="onChange" @click:clear="onClear"></v-text-field>
|
|
42
|
-
<v-select v-if="isEnum" name="enum" density="compact" v-model="item.value" :disabled="isDisabled" :clearable="props.clearable"
|
|
43
|
-
:items="enumValues" persistent-hint @update:modelValue="onChange" @click:clear="onClear" dense solo hide-details single-line>
|
|
44
|
-
</v-select>
|
|
45
|
-
</td>
|
|
46
|
-
<td v-if="props.operations">
|
|
47
|
-
<v-select density="compact" v-model="operation" :items="props.operations" persistent-hint @update:modelValue="onChangeOperation" dense solo hide-details single-line>
|
|
48
|
-
</v-select>
|
|
49
|
-
</td>
|
|
50
|
-
</tr>
|
|
51
|
-
-->
|
|
52
32
|
<v-row dense v-if="isVisible">
|
|
53
33
|
<v-col cols="6">{{description}}</v-col>
|
|
54
34
|
<v-col cols="props.operations ? 4 : 6">
|
|
@@ -62,19 +62,6 @@
|
|
|
62
62
|
<template>
|
|
63
63
|
<v-container fluid :style="heightStyle">
|
|
64
64
|
<h2>Settings</h2>
|
|
65
|
-
<!--
|
|
66
|
-
<v-table>
|
|
67
|
-
<thead>
|
|
68
|
-
<tr>
|
|
69
|
-
<th class="font-weight-bold" style="width:50%">Topic</th>
|
|
70
|
-
<th class="font-weight-bold" style="width:50%">Parameter</th>
|
|
71
|
-
</tr>
|
|
72
|
-
</thead>
|
|
73
|
-
<tbody>
|
|
74
|
-
<settings-line v-for="config in appConfig.items" :key="config.name" :item="config" :scopes="scopes" @change="onChange(config)"></settings-line>
|
|
75
|
-
</tbody>
|
|
76
|
-
</v-table>
|
|
77
|
-
-->
|
|
78
65
|
<v-row dense class="font-weight-bold">
|
|
79
66
|
<v-col cols="6">Topic</v-col>
|
|
80
67
|
<v-col cols="6">Parameter</v-col>
|