@olares/lares-mobile 0.15.36 → 0.15.38
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/package.json +2 -2
- package/src/App.vue +2 -1
- package/src/chat/Transcript.vue +2 -2
- package/src/host.js +2 -0
- package/src/settings/AgentSettings.vue +227 -242
- package/src/settings/PluginsSettings.vue +115 -0
- package/src/settings/TtsSettings.vue +49 -6
- package/src/settings/VoiceKeys.vue +129 -53
- package/src/settings/VoicePreferences.vue +64 -39
- package/src/settings/VoiceSettings.vue +431 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="lares-plugins" :data-device="device" :aria-busy="busy ? 'true' : 'false'">
|
|
3
|
+
<section v-for="pack in packs" :key="pack.id" class="lares-plugins__group">
|
|
4
|
+
<h2>{{ t(`pack.${pack.id}.title`) }}</h2>
|
|
5
|
+
<article class="lares-plugins__card">
|
|
6
|
+
<div class="lares-plugins__head">
|
|
7
|
+
<p>{{ t(`pack.${pack.id}.intro`) }}</p>
|
|
8
|
+
<button type="button" :disabled="busy || !state" @click="toggle(pack)">{{ t(busy === pack.id ? 'plugin.pending' : !status(pack.id).downloaded ? 'settings.download' : status(pack.id).enabled ? 'settings.disable' : 'settings.enable') }}</button>
|
|
9
|
+
</div>
|
|
10
|
+
<div v-if="pack.id === 'ha'" class="lares-plugins__body">
|
|
11
|
+
<p>{{ status('ha').connection?.server || t('settings.tokenHint') }}</p>
|
|
12
|
+
<label>{{ t('settings.server') }}<input v-model="server" type="url" :disabled="Boolean(busy)" autocomplete="off" /></label>
|
|
13
|
+
<label>{{ t('settings.tokenLabel') }}<input v-model="token" type="password" :disabled="Boolean(busy)" autocomplete="off" /></label>
|
|
14
|
+
<button type="button" class="is-primary" :disabled="Boolean(busy) || !server || !token" @click="saveHa">{{ t('settings.tokenSave') }}</button>
|
|
15
|
+
</div>
|
|
16
|
+
<div v-else-if="pack.id === 'google-workspace'" class="lares-plugins__body">
|
|
17
|
+
<p v-if="!status(pack.id).downloaded">{{ t('google.installFirst') }}</p>
|
|
18
|
+
<template v-else>
|
|
19
|
+
<p role="status">{{ t(`google.status.${google.status || 'unconfigured'}`, { email: google.email || '' }) }}</p>
|
|
20
|
+
<template v-if="!google.email">
|
|
21
|
+
<p>{{ t('google.setup') }}</p>
|
|
22
|
+
<p><a href="https://console.cloud.google.com/auth/clients" target="_blank" rel="noopener noreferrer">{{ t('google.console') }}</a> · <a href="https://gogcli.sh/quickstart.html" target="_blank" rel="noopener noreferrer">{{ t('google.docs') }}</a></p>
|
|
23
|
+
<label>{{ t('google.import') }}<input type="file" accept=".json,application/json" :disabled="Boolean(busy)" @change="importClient" /></label>
|
|
24
|
+
<p v-if="google.configured">{{ t('google.configured') }}</p>
|
|
25
|
+
</template>
|
|
26
|
+
<template v-if="google.configured">
|
|
27
|
+
<label v-if="!google.email">{{ t('google.email') }}<input v-model="email" type="email" :disabled="Boolean(busy)" autocomplete="off" /></label>
|
|
28
|
+
<p>{{ t('google.permissions') }}</p>
|
|
29
|
+
<div class="lares-plugins__actions">
|
|
30
|
+
<button type="button" :disabled="Boolean(busy) || !(google.email || email.trim())" @click="start">{{ t(google.email ? 'google.reconnect' : 'google.connect') }}</button>
|
|
31
|
+
<button v-if="google.email" type="button" :disabled="Boolean(busy)" @click="run('google', () => client.checkGoogle())">{{ t('google.check') }}</button>
|
|
32
|
+
<button v-if="google.email" type="button" :disabled="Boolean(busy)" @click="disconnect">{{ t('google.disconnect') }}</button>
|
|
33
|
+
</div>
|
|
34
|
+
<p v-if="google.email">{{ t('google.disconnectHint') }}</p>
|
|
35
|
+
</template>
|
|
36
|
+
<div v-if="authorization">
|
|
37
|
+
<a :href="authorization.url" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ t('google.open') }}</a>
|
|
38
|
+
<p>{{ t('google.returnHint') }}</p>
|
|
39
|
+
<label>{{ t('google.callback') }}<input v-model="callback" :disabled="Boolean(busy)" autocomplete="off" spellcheck="false" /></label>
|
|
40
|
+
<button type="button" :disabled="Boolean(busy) || !callback.trim()" @click="complete">{{ t('google.complete') }}</button>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
</div>
|
|
44
|
+
</article>
|
|
45
|
+
</section>
|
|
46
|
+
<p v-if="error" role="alert">{{ error }}</p>
|
|
47
|
+
</section>
|
|
48
|
+
</template>
|
|
49
|
+
<script>
|
|
50
|
+
import { markRaw } from 'vue';
|
|
51
|
+
import { OFFICIAL_PACKS } from '@olares/lares-core/skills/packs';
|
|
52
|
+
import { googleClientFile } from '@olares/lares-core/skills/client';
|
|
53
|
+
import { EN, ZH } from '@olares/lares-core/i18n/skills';
|
|
54
|
+
import { t as translate } from '@olares/lares-core/i18n/t';
|
|
55
|
+
export default {
|
|
56
|
+
props: { client: { type: Object, required: true }, locale: { type: String, default: 'en' }, device: { type: String, default: 'mobile' } },
|
|
57
|
+
data() { return { packs: markRaw(OFFICIAL_PACKS), state: null, busy: '', error: '', server: '', token: '', email: '', callback: '', authorization: null }; },
|
|
58
|
+
computed: {
|
|
59
|
+
google() { return this.status('google-workspace').connection || {}; },
|
|
60
|
+
},
|
|
61
|
+
mounted() { void this.load(); },
|
|
62
|
+
methods: {
|
|
63
|
+
t(key, params) { return translate({ en: EN, zh: ZH }, this.locale, key, params); },
|
|
64
|
+
status(id) { return this.state?.packs?.find((pack) => pack.id === id) || {}; },
|
|
65
|
+
async load() {
|
|
66
|
+
try { this.state = await this.client.list(); this.server = this.status('ha').connection?.server || ''; }
|
|
67
|
+
catch (err) { this.error = this.t('settings.loadFailed', { msg: err.message }); }
|
|
68
|
+
},
|
|
69
|
+
async run(id, action) {
|
|
70
|
+
if (this.busy) return null;
|
|
71
|
+
this.busy = id; this.error = '';
|
|
72
|
+
try { const result = await action(); this.state = { packs: result.packs }; return result; }
|
|
73
|
+
catch (err) { this.error = this.t('settings.saveFailed', { msg: err.message }); try { this.state = await this.client.list(); } catch {} return null; }
|
|
74
|
+
finally { this.busy = ''; }
|
|
75
|
+
},
|
|
76
|
+
toggle(pack) { const row = this.status(pack.id); return this.run(pack.id, () => !row.downloaded ? this.client.download(pack.id) : row.enabled ? this.client.disable(pack.id) : this.client.enable(pack.id)); },
|
|
77
|
+
async saveHa() { const token = this.token; this.token = ''; await this.run('ha', () => this.client.saveToken('ha', this.server, token)); },
|
|
78
|
+
async importClient(event) {
|
|
79
|
+
const file = event.target.files?.[0]; event.target.value = ''; if (!file) return;
|
|
80
|
+
try { const raw = await googleClientFile(file); if (await this.run('google', () => this.client.importGoogle(raw))) { this.authorization = null; this.callback = ''; } }
|
|
81
|
+
catch (err) { this.error = this.t('google.error', { msg: err.message }); }
|
|
82
|
+
},
|
|
83
|
+
async start() { this.authorization = null; this.callback = ''; const result = await this.run('google', () => this.client.startGoogle(this.google.email || this.email)); if (result) this.authorization = result.authorization; },
|
|
84
|
+
async complete() { const callback = this.callback; this.callback = ''; if (await this.run('google', () => this.client.completeGoogle(callback))) this.authorization = null; },
|
|
85
|
+
async disconnect() { if (await this.run('google', () => this.client.disconnectGoogle())) { this.authorization = null; this.callback = ''; this.email = ''; } },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
</script>
|
|
89
|
+
<style scoped>
|
|
90
|
+
.lares-plugins { display: flex; flex-direction: column; gap: 20px; min-width: 0; color: var(--q-ink-1); }
|
|
91
|
+
.lares-plugins[data-device="desktop"] { gap: 16px; }
|
|
92
|
+
.lares-plugins__group { display: flex; flex-direction: column; gap: 8px; }
|
|
93
|
+
.lares-plugins__card { display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--q-separator); border-radius: 16px; padding: 16px; min-width: 0; overflow-wrap: anywhere; }
|
|
94
|
+
.lares-plugins__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
|
95
|
+
.lares-plugins__body { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--q-separator); }
|
|
96
|
+
.lares-plugins h2 { margin: 0; color: var(--q-ink-1); font-size: 18px; font-weight: 500; line-height: 24px; }
|
|
97
|
+
.lares-plugins[data-device="desktop"] h2 { font-size: 16px; }
|
|
98
|
+
.lares-plugins p,
|
|
99
|
+
.lares-plugins a { margin: 0; color: var(--q-ink-3); font-size: 15px; line-height: 22px; }
|
|
100
|
+
.lares-plugins a { color: var(--q-blue-default); }
|
|
101
|
+
.lares-plugins [role="alert"] { color: var(--q-orange-default); }
|
|
102
|
+
.lares-plugins label { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--q-ink-2); font-size: 15px; line-height: 22px; }
|
|
103
|
+
.lares-plugins input { box-sizing: border-box; width: 100%; min-width: 0; height: 32px; padding: 0 12px; border: 1px solid var(--q-separator); border-radius: 8px; background: transparent; color: var(--q-ink-1); font: inherit; font-size: 15px; }
|
|
104
|
+
.lares-plugins input[type="file"] { height: auto; padding: 8px 0; border: 0; }
|
|
105
|
+
.lares-plugins button { flex: none; min-height: 36px; border: 1px solid var(--q-separator); border-radius: 12px; padding: 0 14px; background: transparent; color: inherit; font: inherit; font-size: 15px; line-height: 20px; cursor: pointer; }
|
|
106
|
+
.lares-plugins button.is-primary { border: 0; background: var(--q-blue-alpha); color: var(--q-blue-default); font-weight: 500; }
|
|
107
|
+
.lares-plugins button:disabled { opacity: .45; cursor: default; }
|
|
108
|
+
.lares-plugins button.is-primary:disabled { border: 1px solid var(--q-separator); background: transparent; color: inherit; font-weight: 400; }
|
|
109
|
+
.lares-plugins button:focus-visible,
|
|
110
|
+
.lares-plugins input:focus-visible { outline: 2px solid var(--q-blue-default); outline-offset: 2px; }
|
|
111
|
+
.lares-plugins__actions { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
112
|
+
@media (max-width: 560px) {
|
|
113
|
+
.lares-plugins__head { flex-direction: column; align-items: flex-start; gap: 12px; }
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<section class="lares-tts">
|
|
2
|
+
<section class="lares-tts" :data-device="device">
|
|
3
3
|
<h3>{{ t('settings.tts.title') }}</h3>
|
|
4
|
+
<div :class="isDesktop ? 'lares-tts__stack' : 'lares-tts__block'">
|
|
4
5
|
<label v-if="isDesktop" class="lares-tts__field">
|
|
5
6
|
<span>{{ t('settings.tts.model') }}</span>
|
|
6
7
|
<LaresSelect :value="modelId" :sections="modelSections" :disabled="state.saving" @select="chooseModel" />
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
:label="t('settings.tts.model')"
|
|
11
12
|
:value="modelLabel"
|
|
12
13
|
chevron
|
|
13
|
-
boxed
|
|
14
14
|
:disabled="state.saving"
|
|
15
15
|
@click="sheet = 'model'"
|
|
16
16
|
/>
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
:label="t('tts.voice')"
|
|
36
36
|
:value="voiceLabel"
|
|
37
37
|
chevron
|
|
38
|
-
boxed
|
|
39
38
|
:disabled="state.saving"
|
|
40
39
|
@click="sheet = 'voice'"
|
|
41
40
|
/>
|
|
@@ -48,11 +47,15 @@
|
|
|
48
47
|
</div>
|
|
49
48
|
<p v-if="state.previewError" class="lares-tts__alert" role="alert">{{ t('tts.previewFailed') }}</p>
|
|
50
49
|
<label class="lares-tts__switch">
|
|
51
|
-
<span
|
|
50
|
+
<span class="lares-tts__switch-copy">
|
|
51
|
+
<span>{{ t('settings.speak.title') }}</span>
|
|
52
|
+
<span v-if="!isDesktop" class="lares-tts__hint">{{ t('settings.tts.hint') }}</span>
|
|
53
|
+
</span>
|
|
52
54
|
<input type="checkbox" role="switch" :checked="view.value.config.speak === true" :disabled="Boolean(view.pending.speak)" :aria-checked="view.value.config.speak === true ? 'true' : 'false'" @change="save(preferences.patch({ speak: $event.target.checked }))" />
|
|
53
55
|
</label>
|
|
54
|
-
<p class="lares-tts__hint">{{ t('settings.tts.hint') }}</p>
|
|
56
|
+
<p v-if="isDesktop" class="lares-tts__hint">{{ t('settings.tts.hint') }}</p>
|
|
55
57
|
<p v-if="view.errors.speak" class="lares-tts__alert" role="alert">{{ t('settings.saveFailed') }}</p>
|
|
58
|
+
</div>
|
|
56
59
|
<LaresSheet v-if="!isDesktop" :open="Boolean(sheet)" :title="sheetTitle" @close="sheet = ''">
|
|
57
60
|
<LaresSettingRow
|
|
58
61
|
v-for="item in sheetItems"
|
|
@@ -129,6 +132,38 @@ export default {
|
|
|
129
132
|
line-height: 22px;
|
|
130
133
|
}
|
|
131
134
|
|
|
135
|
+
.lares-tts__stack,
|
|
136
|
+
.lares-tts__block {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
gap: 12px;
|
|
140
|
+
min-width: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.lares-tts__block {
|
|
144
|
+
gap: 0;
|
|
145
|
+
border: 1px solid var(--q-separator);
|
|
146
|
+
border-radius: 20px;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.lares-tts__block :deep(.lares-set-row) {
|
|
151
|
+
min-height: 64px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.lares-tts__block > .lares-tts__hint,
|
|
155
|
+
.lares-tts__block > .lares-tts__alert,
|
|
156
|
+
.lares-tts__block > .lares-tts__status {
|
|
157
|
+
padding: 0 16px 8px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.lares-tts__block .lares-tts__action,
|
|
161
|
+
.lares-tts__block .lares-tts__switch {
|
|
162
|
+
border: 0;
|
|
163
|
+
border-radius: 0;
|
|
164
|
+
border-top: 1px solid var(--q-separator);
|
|
165
|
+
}
|
|
166
|
+
|
|
132
167
|
.lares-tts h3 {
|
|
133
168
|
margin: 4px 0 0;
|
|
134
169
|
color: var(--q-ink-3);
|
|
@@ -222,13 +257,21 @@ export default {
|
|
|
222
257
|
line-height: 22px;
|
|
223
258
|
}
|
|
224
259
|
|
|
225
|
-
.lares-tts__switch
|
|
260
|
+
.lares-tts__switch-copy {
|
|
261
|
+
display: flex;
|
|
226
262
|
flex: 1;
|
|
263
|
+
flex-direction: column;
|
|
264
|
+
gap: 2px;
|
|
227
265
|
min-width: 0;
|
|
228
266
|
font-size: 16px;
|
|
229
267
|
line-height: 22px;
|
|
230
268
|
}
|
|
231
269
|
|
|
270
|
+
.lares-tts__switch-copy > .lares-tts__hint {
|
|
271
|
+
font-size: 13px;
|
|
272
|
+
line-height: 18px;
|
|
273
|
+
}
|
|
274
|
+
|
|
232
275
|
.lares-tts__switch {
|
|
233
276
|
cursor: pointer;
|
|
234
277
|
}
|
|
@@ -1,41 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section class="lares-voice-keys">
|
|
3
3
|
<h3>{{ t('settings.group.keys') }}</h3>
|
|
4
|
-
<p>{{ t('settings.keys.
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<label v-for="model in allModels" :key="model">
|
|
19
|
-
<input type="checkbox" :checked="models.includes(model)" :disabled="busy" @change="toggle(model)" />
|
|
20
|
-
<span>{{ model }}</span>
|
|
4
|
+
<p class="lares-voice-keys__purpose">{{ t('settings.keys.purpose') }}</p>
|
|
5
|
+
<div class="lares-voice-keys__block">
|
|
6
|
+
<div v-if="keys" class="lares-voice-keys__status" role="status">
|
|
7
|
+
<ul v-if="keys.length" class="lares-voice-keys__list">
|
|
8
|
+
<li v-for="key in keys" :key="key.id">
|
|
9
|
+
<span class="lares-voice-keys__name">{{ key.name }}<small>{{ keySummary(key) }}</small></span>
|
|
10
|
+
<button type="button" :disabled="busy" @click="revoking = key">{{ t('settings.keys.revoke') }}</button>
|
|
11
|
+
</li>
|
|
12
|
+
</ul>
|
|
13
|
+
<p v-else class="lares-voice-keys__empty"><span class="lares-voice-keys__dot" aria-hidden="true" />{{ t('settings.keys.empty') }}</p>
|
|
14
|
+
</div>
|
|
15
|
+
<label class="lares-voice-keys__field">
|
|
16
|
+
<span>{{ t('settings.keys.name') }}</span>
|
|
17
|
+
<input v-model="name" type="text" maxlength="64" :placeholder="t('settings.keys.namePlaceholder')" :disabled="busy" />
|
|
21
18
|
</label>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
<div class="lares-voice-keys__models" role="group" :aria-label="t('settings.keys.models')">
|
|
20
|
+
<p>{{ t('settings.keys.models') }}</p>
|
|
21
|
+
<label v-for="model in allModels" :key="model">
|
|
22
|
+
<input type="checkbox" :checked="models.includes(model)" :disabled="busy" @change="toggle(model)" />
|
|
23
|
+
<span>{{ model }}</span>
|
|
24
|
+
</label>
|
|
25
|
+
<label class="lares-voice-keys__tools">
|
|
26
|
+
<input type="checkbox" :checked="clientTools && toolsApply" :disabled="busy || !toolsApply" @change="clientTools = !clientTools" />
|
|
27
|
+
<span>
|
|
28
|
+
{{ t('settings.keys.clientTools') }}
|
|
29
|
+
<small>{{ t('settings.keys.clientToolsHint') }}</small>
|
|
30
|
+
</span>
|
|
31
|
+
</label>
|
|
32
32
|
</div>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
<
|
|
33
|
+
<p v-if="agentSelected" role="note">{{ t('settings.keys.agentWarning') }}</p>
|
|
34
|
+
<p class="lares-voice-keys__once">{{ t('settings.keys.once') }}</p>
|
|
35
|
+
<button type="button" class="lares-voice-keys__issue" :disabled="busy || !name.trim() || !models.length" @click="issue">{{ t(busy ? 'settings.keys.issuing' : 'settings.keys.issue') }}</button>
|
|
36
|
+
<p v-if="error" role="alert">{{ error }}</p>
|
|
37
|
+
<div v-if="issued" class="lares-voice-keys__dialog" role="dialog">
|
|
38
|
+
<p>{{ t('settings.keys.issued') }}</p>
|
|
39
|
+
<code>{{ issued.key }}</code>
|
|
40
|
+
<div class="lares-voice-keys__actions">
|
|
41
|
+
<button type="button" @click="copy">{{ t(copied ? 'settings.keys.copied' : 'settings.keys.copy') }}</button>
|
|
42
|
+
<button type="button" class="is-primary" @click="issued = null">{{ t('settings.keys.done') }}</button>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<div v-if="revoking" class="lares-voice-keys__dialog" role="dialog">
|
|
46
|
+
<p>{{ t('settings.keys.revokeConfirm', { name: revoking.name }) }}</p>
|
|
47
|
+
<div class="lares-voice-keys__actions">
|
|
48
|
+
<button type="button" :disabled="busy" @click="revoke">{{ t('settings.keys.revoke') }}</button>
|
|
49
|
+
<button type="button" @click="revoking = null">{{ t('settings.keys.done') }}</button>
|
|
50
|
+
</div>
|
|
39
51
|
</div>
|
|
40
52
|
</div>
|
|
41
53
|
</section>
|
|
@@ -43,21 +55,28 @@
|
|
|
43
55
|
<script>
|
|
44
56
|
import { markRaw } from "vue";
|
|
45
57
|
import { messageFromCode } from "@olares/lares-core/i18n/t";
|
|
46
|
-
import { VOICE_KEY_AGENT_MODELS, VOICE_KEY_DEFAULT_MODELS, VOICE_KEY_MODELS } from "@olares/lares-core/voice/keys-client";
|
|
58
|
+
import { VOICE_KEY_AGENT_MODELS, VOICE_KEY_DEFAULT_MODELS, VOICE_KEY_MODELS, VOICE_KEY_TOOL_MODELS } from "@olares/lares-core/voice/keys-client";
|
|
47
59
|
export default {
|
|
48
60
|
props: { client: { type: Object, required: true }, t: { type: Function, required: true } },
|
|
49
61
|
data() {
|
|
50
|
-
return { keys: null, name: "", models: [...VOICE_KEY_DEFAULT_MODELS], issued: null, copied: false, revoking: null, busy: false, error: "", allModels: markRaw([...VOICE_KEY_MODELS]) };
|
|
62
|
+
return { keys: null, name: "", models: [...VOICE_KEY_DEFAULT_MODELS], clientTools: false, issued: null, copied: false, revoking: null, busy: false, error: "", allModels: markRaw([...VOICE_KEY_MODELS]) };
|
|
63
|
+
},
|
|
64
|
+
computed: {
|
|
65
|
+
agentSelected() { return this.models.some((model) => VOICE_KEY_AGENT_MODELS.includes(model)); },
|
|
66
|
+
toolsApply() { return this.models.some((model) => VOICE_KEY_TOOL_MODELS.includes(model)); },
|
|
51
67
|
},
|
|
52
|
-
computed: { agentSelected() { return this.models.some((model) => VOICE_KEY_AGENT_MODELS.includes(model)); } },
|
|
53
68
|
mounted() { void this.load(); },
|
|
54
69
|
methods: {
|
|
55
70
|
fail(err) { this.error = messageFromCode(this.t, err?.message || "", "error.voice_key_failed"); },
|
|
56
71
|
async load() { try { this.keys = await this.client.list(); } catch (err) { this.fail(err); } },
|
|
57
72
|
toggle(model) { this.models = this.models.includes(model) ? this.models.filter((value) => value !== model) : VOICE_KEY_MODELS.filter((value) => value === model || this.models.includes(value)); },
|
|
73
|
+
keySummary(key) {
|
|
74
|
+
const created = key.createdAt ? ` · ${this.t("settings.keys.created", { at: new Date(key.createdAt).toLocaleString() })}` : "";
|
|
75
|
+
return `${key.models.join(", ")}${key.clientTools ? ` · ${this.t("settings.keys.clientToolsTag")}` : ""}${created}`;
|
|
76
|
+
},
|
|
58
77
|
async issue() {
|
|
59
78
|
this.busy = true; this.error = "";
|
|
60
|
-
try { this.issued = await this.client.issue({ name: this.name, models: this.models }); this.copied = false; this.name = ""; this.models = [...VOICE_KEY_DEFAULT_MODELS]; await this.load(); }
|
|
79
|
+
try { this.issued = await this.client.issue({ name: this.name, models: this.models, clientTools: this.clientTools && this.toolsApply }); this.copied = false; this.name = ""; this.models = [...VOICE_KEY_DEFAULT_MODELS]; this.clientTools = false; await this.load(); }
|
|
61
80
|
catch (err) { this.fail(err); }
|
|
62
81
|
finally { this.busy = false; }
|
|
63
82
|
},
|
|
@@ -91,6 +110,10 @@ export default {
|
|
|
91
110
|
line-height: 18px;
|
|
92
111
|
}
|
|
93
112
|
|
|
113
|
+
.lares-voice-keys__purpose {
|
|
114
|
+
margin: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
94
117
|
.lares-voice-keys p {
|
|
95
118
|
margin: 0;
|
|
96
119
|
color: var(--q-ink-3);
|
|
@@ -112,17 +135,62 @@ export default {
|
|
|
112
135
|
list-style: none;
|
|
113
136
|
}
|
|
114
137
|
|
|
138
|
+
.lares-voice-keys__block {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
gap: 12px;
|
|
142
|
+
box-sizing: border-box;
|
|
143
|
+
border: 1px solid var(--q-separator);
|
|
144
|
+
border-radius: 16px;
|
|
145
|
+
padding: 16px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.lares-voice-keys__status {
|
|
149
|
+
padding-bottom: 12px;
|
|
150
|
+
border-bottom: 1px solid var(--q-separator);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.lares-voice-keys p.lares-voice-keys__empty {
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
gap: 8px;
|
|
157
|
+
min-height: 28px;
|
|
158
|
+
color: var(--q-ink-2);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.lares-voice-keys__dot {
|
|
162
|
+
width: 8px;
|
|
163
|
+
height: 8px;
|
|
164
|
+
flex: none;
|
|
165
|
+
border-radius: 50%;
|
|
166
|
+
background: var(--q-ink-3);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.lares-voice-keys p.lares-voice-keys__once {
|
|
170
|
+
font-size: 13px;
|
|
171
|
+
line-height: 18px;
|
|
172
|
+
}
|
|
173
|
+
|
|
115
174
|
.lares-voice-keys__list li,
|
|
116
175
|
.lares-voice-keys__dialog {
|
|
117
176
|
display: flex;
|
|
118
177
|
align-items: center;
|
|
119
178
|
justify-content: space-between;
|
|
120
179
|
gap: 12px;
|
|
121
|
-
min-height:
|
|
180
|
+
min-height: 48px;
|
|
122
181
|
box-sizing: border-box;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.lares-voice-keys__list li {
|
|
185
|
+
border-bottom: 1px solid var(--q-separator);
|
|
186
|
+
padding: 8px 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.lares-voice-keys__dialog {
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
align-items: stretch;
|
|
192
|
+
border-top: 1px solid var(--q-separator);
|
|
193
|
+
padding-top: 12px;
|
|
126
194
|
}
|
|
127
195
|
|
|
128
196
|
.lares-voice-keys__name {
|
|
@@ -171,31 +239,44 @@ export default {
|
|
|
171
239
|
}
|
|
172
240
|
|
|
173
241
|
.lares-voice-keys__models {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
border-radius: 20px;
|
|
242
|
+
display: flex;
|
|
243
|
+
flex-direction: column;
|
|
177
244
|
}
|
|
178
245
|
|
|
179
246
|
.lares-voice-keys__models > p {
|
|
180
247
|
margin: 0;
|
|
181
|
-
padding:
|
|
248
|
+
padding: 4px 0;
|
|
182
249
|
font-size: 14px;
|
|
183
250
|
font-weight: 500;
|
|
184
251
|
line-height: 18px;
|
|
185
252
|
}
|
|
186
253
|
|
|
187
|
-
.lares-voice-keys__models label
|
|
254
|
+
.lares-voice-keys__models label,
|
|
255
|
+
.lares-voice-keys__tools {
|
|
188
256
|
display: flex;
|
|
189
257
|
align-items: center;
|
|
190
258
|
gap: 12px;
|
|
191
259
|
min-height: 48px;
|
|
192
|
-
padding: 0 16px;
|
|
193
260
|
border-top: 1px solid var(--q-separator);
|
|
194
261
|
font-size: 16px;
|
|
195
262
|
line-height: 22px;
|
|
196
263
|
}
|
|
197
264
|
|
|
198
|
-
.lares-voice-
|
|
265
|
+
.lares-voice-keys__tools {
|
|
266
|
+
align-items: flex-start;
|
|
267
|
+
padding-top: 12px;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.lares-voice-keys__tools small {
|
|
271
|
+
display: block;
|
|
272
|
+
margin-top: 2px;
|
|
273
|
+
color: var(--q-ink-3);
|
|
274
|
+
font-size: 13px;
|
|
275
|
+
line-height: 18px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.lares-voice-keys__models input,
|
|
279
|
+
.lares-voice-keys__tools input {
|
|
199
280
|
width: 20px;
|
|
200
281
|
height: 20px;
|
|
201
282
|
margin: 0;
|
|
@@ -239,11 +320,6 @@ export default {
|
|
|
239
320
|
font-size: 16px;
|
|
240
321
|
}
|
|
241
322
|
|
|
242
|
-
.lares-voice-keys__dialog {
|
|
243
|
-
flex-direction: column;
|
|
244
|
-
align-items: stretch;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
323
|
.lares-voice-keys__dialog p {
|
|
248
324
|
color: var(--q-ink-1);
|
|
249
325
|
}
|
|
@@ -1,47 +1,67 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="view.value" class="lares-voice-preferences">
|
|
3
|
-
<
|
|
4
|
-
<span>{{ t('preferences.dictationStyle') }}</span>
|
|
5
|
-
<LaresSelect :value="view.value.config.dictationPreset" :sections="presetSections" :disabled="guardView.selecting || Boolean(view.pending.dictationPreset)" @select="choosePreset" />
|
|
6
|
-
</label>
|
|
7
|
-
<LaresSettingRow
|
|
8
|
-
v-else
|
|
9
|
-
:label="t('preferences.dictationStyle')"
|
|
10
|
-
:value="t(`dictation.${view.value.config.dictationPreset}`)"
|
|
11
|
-
chevron
|
|
12
|
-
boxed
|
|
13
|
-
:disabled="guardView.selecting || Boolean(view.pending.dictationPreset)"
|
|
14
|
-
@click="sheet = 'preset'"
|
|
15
|
-
/>
|
|
16
|
-
<p v-if="view.errors.dictationPreset" role="alert">{{ t('settings.saveFailed') }}</p>
|
|
17
|
-
<p v-if="view.value.config.dictationPreset === 'raw'">{{ t('dictation.noLlm') }}</p>
|
|
18
|
-
<div v-else class="lares-voice-preferences__editor">
|
|
19
|
-
<label v-if="device === 'desktop'" class="lares-voice-preferences__field">
|
|
20
|
-
<span>{{ t('dictation.model') }}</span>
|
|
21
|
-
<LaresSelect :value="profile.model" :sections="modelSections" :disabled="profilePending" @select="chooseModel" />
|
|
22
|
-
</label>
|
|
23
|
-
<LaresSettingRow
|
|
24
|
-
v-else
|
|
25
|
-
:label="t('dictation.model')"
|
|
26
|
-
:value="modelLabel"
|
|
27
|
-
chevron
|
|
28
|
-
boxed
|
|
29
|
-
:disabled="profilePending"
|
|
30
|
-
@click="sheet = 'model'"
|
|
31
|
-
/>
|
|
3
|
+
<template v-if="device === 'desktop'">
|
|
32
4
|
<label class="lares-voice-preferences__field">
|
|
33
|
-
<span>{{ t('
|
|
34
|
-
<
|
|
5
|
+
<span>{{ t('preferences.dictationStyle') }}</span>
|
|
6
|
+
<LaresSelect :value="view.value.config.dictationPreset" :sections="presetSections" :disabled="guardView.selecting || Boolean(view.pending.dictationPreset)" @select="choosePreset" />
|
|
35
7
|
</label>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
8
|
+
<p v-if="view.errors.dictationPreset" role="alert">{{ t('settings.saveFailed') }}</p>
|
|
9
|
+
<p v-if="view.value.config.dictationPreset === 'raw'">{{ t('dictation.noLlm') }}</p>
|
|
10
|
+
<div v-else class="lares-voice-preferences__editor">
|
|
11
|
+
<label class="lares-voice-preferences__field">
|
|
12
|
+
<span>{{ t('dictation.model') }}</span>
|
|
13
|
+
<LaresSelect :value="profile.model" :sections="modelSections" :disabled="profilePending" @select="chooseModel" />
|
|
14
|
+
</label>
|
|
15
|
+
<label class="lares-voice-preferences__field">
|
|
16
|
+
<span>{{ t('dictation.instructions') }}</span>
|
|
17
|
+
<textarea ref="instructions" :value="profile.instructions" :disabled="profilePending" rows="6" maxlength="8000" @input="preferences.edit(view.value.config.dictationPreset, { instructions: $event.target.value })" />
|
|
18
|
+
</label>
|
|
19
|
+
<div class="lares-voice-preferences__actions">
|
|
20
|
+
<button type="button" :disabled="profilePending" @click="preferences.restore(view.value.config.dictationPreset)">{{ t('dictation.reset') }}</button>
|
|
21
|
+
<template v-if="preferences.dirty(view.value.config.dictationPreset)">
|
|
22
|
+
<button type="button" :disabled="profilePending" @click="preferences.discard([view.value.config.dictationPreset])">{{ t('preferences.cancel') }}</button>
|
|
23
|
+
<button type="button" class="is-primary" :disabled="profilePending" @click="saveProfile">{{ t(profilePending ? 'preferences.saving' : 'preferences.save') }}</button>
|
|
24
|
+
</template>
|
|
25
|
+
</div>
|
|
26
|
+
<p v-if="view.errors[`profile:${view.value.config.dictationPreset}`]" role="alert">{{ t('settings.saveFailed') }}</p>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-else>
|
|
30
|
+
<h3 class="lares-voice-preferences__section">{{ t('settings.stt.title') }}</h3>
|
|
31
|
+
<div class="lares-voice-preferences__block">
|
|
32
|
+
<slot name="lead" />
|
|
33
|
+
<LaresSettingRow
|
|
34
|
+
:label="t('preferences.dictationStyle')"
|
|
35
|
+
:value="t(`dictation.${view.value.config.dictationPreset}`)"
|
|
36
|
+
:hint="view.value.config.dictationPreset === 'raw' ? t('dictation.noLlm') : ''"
|
|
37
|
+
chevron
|
|
38
|
+
:disabled="guardView.selecting || Boolean(view.pending.dictationPreset)"
|
|
39
|
+
@click="sheet = 'preset'"
|
|
40
|
+
/>
|
|
41
|
+
<p v-if="view.errors.dictationPreset" role="alert">{{ t('settings.saveFailed') }}</p>
|
|
42
|
+
<div v-if="view.value.config.dictationPreset !== 'raw'" class="lares-voice-preferences__editor">
|
|
43
|
+
<LaresSettingRow
|
|
44
|
+
:label="t('dictation.model')"
|
|
45
|
+
:value="modelLabel"
|
|
46
|
+
chevron
|
|
47
|
+
:disabled="profilePending"
|
|
48
|
+
@click="sheet = 'model'"
|
|
49
|
+
/>
|
|
50
|
+
<label class="lares-voice-preferences__field">
|
|
51
|
+
<span>{{ t('dictation.instructions') }}</span>
|
|
52
|
+
<textarea ref="instructions" :value="profile.instructions" :disabled="profilePending" rows="6" maxlength="8000" @input="preferences.edit(view.value.config.dictationPreset, { instructions: $event.target.value })" />
|
|
53
|
+
</label>
|
|
54
|
+
<div class="lares-voice-preferences__actions">
|
|
55
|
+
<button type="button" :disabled="profilePending" @click="preferences.restore(view.value.config.dictationPreset)">{{ t('dictation.reset') }}</button>
|
|
56
|
+
<template v-if="preferences.dirty(view.value.config.dictationPreset)">
|
|
57
|
+
<button type="button" :disabled="profilePending" @click="preferences.discard([view.value.config.dictationPreset])">{{ t('preferences.cancel') }}</button>
|
|
58
|
+
<button type="button" class="is-primary" :disabled="profilePending" @click="saveProfile">{{ t(profilePending ? 'preferences.saving' : 'preferences.save') }}</button>
|
|
59
|
+
</template>
|
|
60
|
+
</div>
|
|
61
|
+
<p v-if="view.errors[`profile:${view.value.config.dictationPreset}`]" role="alert">{{ t('settings.saveFailed') }}</p>
|
|
62
|
+
</div>
|
|
42
63
|
</div>
|
|
43
|
-
|
|
44
|
-
</div>
|
|
64
|
+
</template>
|
|
45
65
|
<TtsSettings :preferences="preferences" :view="view" :t="t" :fetcher="ttsFetch" :device="device" />
|
|
46
66
|
<section v-if="device === 'desktop'" class="lares-voice-preferences__shortcuts">
|
|
47
67
|
<h3>{{ t('preferences.shortcuts') }}</h3>
|
|
@@ -175,6 +195,11 @@ export default {
|
|
|
175
195
|
<style scoped>
|
|
176
196
|
.lares-voice-preferences { display: flex; flex-direction: column; gap: 12px; min-width: 0; color: var(--q-ink-1); font-size: 15px; line-height: 22px; }
|
|
177
197
|
.lares-voice-preferences h3 { margin: 4px 0 0; color: var(--q-ink-3); font-size: 14px; font-weight: 500; line-height: 18px; }
|
|
198
|
+
.lares-voice-preferences__section { margin: 0; }
|
|
199
|
+
.lares-voice-preferences__block { display: flex; flex-direction: column; border: 1px solid var(--q-separator); border-radius: 20px; overflow: hidden; }
|
|
200
|
+
.lares-voice-preferences__block :deep(.lares-set-row) { min-height: 64px; }
|
|
201
|
+
.lares-voice-preferences__block > [role="alert"] { padding: 0 16px 12px; }
|
|
202
|
+
.lares-voice-preferences__block .lares-voice-preferences__editor { padding: 12px 16px 16px; border-top: 1px solid var(--q-separator); }
|
|
178
203
|
.lares-voice-preferences p { margin: 0; color: var(--q-ink-3); font-size: 15px; line-height: 22px; }
|
|
179
204
|
.lares-voice-preferences [role="alert"] { color: var(--q-orange-default); }
|
|
180
205
|
.lares-voice-preferences__field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
|