forked from Blendman974/faceclaw
Debugged ElevenLabs STT; added debug-recording option
This commit is contained in:
1 parent
097d40efb2
commit
7fcab243a3
8 files changed
+34
-7
No files matched your search
@@ -33,6 +33,7 @@ import {
|
|||||||
nightscoutSiteUrlSetting,
|
nightscoutSiteUrlSetting,
|
||||||
onAnySettingChanged,
|
onAnySettingChanged,
|
||||||
rawScreenshotsEnabledSetting,
|
rawScreenshotsEnabledSetting,
|
||||||
|
saveVoiceRecordingsSetting,
|
||||||
systemCardNameSetting,
|
systemCardNameSetting,
|
||||||
voiceProviderSetting,
|
voiceProviderSetting,
|
||||||
type ConfigSettingString,
|
type ConfigSettingString,
|
||||||
@@ -280,8 +281,15 @@ class DashboardController {
|
|||||||
|
|
||||||
setActiveTextSettingValue(value: string): void {
|
setActiveTextSettingValue(value: string): void {
|
||||||
noteDashboardPhoneTextInput();
|
noteDashboardPhoneTextInput();
|
||||||
if (!this.activeTextSetting) return;
|
const setting = this.activeTextSetting;
|
||||||
this.updateTextSetting(this.activeTextSetting, value);
|
if (!setting) return;
|
||||||
|
if (setting.get() === value) return;
|
||||||
|
setting.set(value);
|
||||||
|
// Deliberately do NOT emit() here. The phone TextField is the source of
|
||||||
|
// truth while typing; echoing activeTextSettingValue back into its two-way
|
||||||
|
// binding on every keystroke drops fast/pasted characters (observed: a
|
||||||
|
// 51-char API key stored as its first 46 chars). Just refresh the preview.
|
||||||
|
this.previewOrRenderAfterTextSettingChange(setting.label);
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect(): Promise<void> {
|
async connect(): Promise<void> {
|
||||||
@@ -574,6 +582,7 @@ class DashboardController {
|
|||||||
communicator: communicator.getNativeCommunicator(),
|
communicator: communicator.getNativeCommunicator(),
|
||||||
provider: voiceProviderSetting.get(),
|
provider: voiceProviderSetting.get(),
|
||||||
elevenLabsApiKey: elevenLabsApiKeySetting.get(),
|
elevenLabsApiKey: elevenLabsApiKeySetting.get(),
|
||||||
|
saveRecording: saveVoiceRecordingsSetting.get(),
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ export class ElevenLabsSttClient {
|
|||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
// The API key rides an xi-api-key header, added by FaceclawWebSocket.
|
// The API key rides an xi-api-key header, added by FaceclawWebSocket.
|
||||||
this.ws = new com.faceclaw.app.FaceclawWebSocket(url, this.listenerProxy, "xi-api-key", this.options.apiKey);
|
const key = this.options.apiKey;
|
||||||
|
console.log(`[elevenlabs] connecting; apiKey length=${key.length} prefix=${key.slice(0, 4)}`);
|
||||||
|
this.ws = new com.faceclaw.app.FaceclawWebSocket(url, this.listenerProxy, "xi-api-key", key);
|
||||||
this.options.onStatus("Connecting to ElevenLabs...");
|
this.options.onStatus("Connecting to ElevenLabs...");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.options.onError(`ElevenLabs connection failed: ${String((error as Error)?.message ?? error)}`);
|
this.options.onError(`ElevenLabs connection failed: ${String((error as Error)?.message ?? error)}`);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export class G2MirrorClient {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
this.ws = new com.faceclaw.app.FaceclawWebSocket(url, this.listenerProxy);
|
this.ws = new com.faceclaw.app.FaceclawWebSocket(url, this.listenerProxy, null, null);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.ws = null;
|
this.ws = null;
|
||||||
this.handleConnectionLost(`Connection failed: ${shortenError(String((error as Error)?.message ?? error))}`);
|
this.handleConnectionLost(`Connection failed: ${shortenError(String((error as Error)?.message ?? error))}`);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export type PushToTalkOptions = {
|
|||||||
communicator: any;
|
communicator: any;
|
||||||
provider: VoiceProviderKind;
|
provider: VoiceProviderKind;
|
||||||
elevenLabsApiKey: string;
|
elevenLabsApiKey: string;
|
||||||
|
saveRecording: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class FaceclawVoiceControlBridge {
|
export class FaceclawVoiceControlBridge {
|
||||||
@@ -59,6 +60,7 @@ export class FaceclawVoiceControlBridge {
|
|||||||
if (this.started) this.stop();
|
if (this.started) this.stop();
|
||||||
this.ensureController();
|
this.ensureController();
|
||||||
this.controller?.setCommunicator(options.communicator);
|
this.controller?.setCommunicator(options.communicator);
|
||||||
|
this.controller?.setSaveRecordings(options.saveRecording);
|
||||||
|
|
||||||
if (options.provider === "elevenlabs" && options.elevenLabsApiKey.trim()) {
|
if (options.provider === "elevenlabs" && options.elevenLabsApiKey.trim()) {
|
||||||
this.cloudClient = new ElevenLabsSttClient({
|
this.cloudClient = new ElevenLabsSttClient({
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
textChange="{{ onTextSettingTextChange }}"
|
textChange="{{ onTextSettingTextChange }}"
|
||||||
returnPress="{{ onTextSettingReturnPress }}"
|
returnPress="{{ onTextSettingReturnPress }}"
|
||||||
autocorrect="false"
|
autocorrect="false"
|
||||||
autocapitalizationType="words"
|
autocapitalizationType="none"
|
||||||
returnKeyType="done" />
|
returnKeyType="done" />
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</GridLayout>
|
</GridLayout>
|
||||||
|
|||||||
@@ -344,7 +344,13 @@ export class MainViewModel extends Observable {
|
|||||||
dashboardController.setActiveTextSettingValue(args.object?.text ?? args.value ?? "");
|
dashboardController.setActiveTextSettingValue(args.object?.text ?? args.value ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextSettingReturnPress(): void {
|
onTextSettingReturnPress(args: { object?: { text?: string } }): void {
|
||||||
|
// Commit the field's actual text at done-time, in case the final
|
||||||
|
// keystroke's textChange hadn't landed yet.
|
||||||
|
const text = args?.object?.text;
|
||||||
|
if (typeof text === "string") {
|
||||||
|
dashboardController.setActiveTextSettingValue(text);
|
||||||
|
}
|
||||||
dashboardController.finishActiveTextSettingEdit();
|
dashboardController.finishActiveTextSettingEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -278,6 +278,13 @@ export const voiceProviderSetting = new ConfigSettingEnum<VoiceProvider>({
|
|||||||
formatValue: (value) => (value === "elevenlabs" ? "ElevenLabs" : "On-device"),
|
formatValue: (value) => (value === "elevenlabs" ? "ElevenLabs" : "On-device"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const saveVoiceRecordingsSetting = new ConfigSettingBoolean({
|
||||||
|
id: "save-voice-recordings",
|
||||||
|
label: "Save voice recordings",
|
||||||
|
storageKey: "developer.saveVoiceRecordings",
|
||||||
|
defaultValue: false,
|
||||||
|
});
|
||||||
|
|
||||||
export const elevenLabsApiKeySetting = new ConfigSettingString({
|
export const elevenLabsApiKeySetting = new ConfigSettingString({
|
||||||
id: "elevenlabs-api-key",
|
id: "elevenlabs-api-key",
|
||||||
label: "ElevenLabs key",
|
label: "ElevenLabs key",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { dashboardState, TOP_LEFT_MENU_LAYOUT } from "../dashboard";
|
import { dashboardState, TOP_LEFT_MENU_LAYOUT } from "../dashboard";
|
||||||
import { batteryDisplayModeSetting, dashboardSlotIds, elevenLabsApiKeySetting, enumSettingMenuItem, rawScreenshotsEnabledSetting, showSignalStrengthSetting, showAndroidNotificationsSetting, showBatteryIndicatorsSetting, showFaceclawLogoSetting, systemCardNameSetting, textSettingMenuItem, toggleSettingMenuItem, voiceProviderSetting, dashboardSlotSettings, nightscoutSiteUrlSetting, nightscoutApiTokenSetting, screenTimeoutSetting } from "../dashboard-settings";
|
import { batteryDisplayModeSetting, dashboardSlotIds, elevenLabsApiKeySetting, enumSettingMenuItem, rawScreenshotsEnabledSetting, saveVoiceRecordingsSetting, showSignalStrengthSetting, showAndroidNotificationsSetting, showBatteryIndicatorsSetting, showFaceclawLogoSetting, systemCardNameSetting, textSettingMenuItem, toggleSettingMenuItem, voiceProviderSetting, dashboardSlotSettings, nightscoutSiteUrlSetting, nightscoutApiTokenSetting, screenTimeoutSetting } from "../dashboard-settings";
|
||||||
import { MenuLayer } from "../menu";
|
import { MenuLayer } from "../menu";
|
||||||
|
|
||||||
export function createSettingsMenuLayer(): MenuLayer {
|
export function createSettingsMenuLayer(): MenuLayer {
|
||||||
@@ -46,6 +46,7 @@ function createDeveloperSettingsMenuLayer(): MenuLayer {
|
|||||||
"Settings > Developer",
|
"Settings > Developer",
|
||||||
[
|
[
|
||||||
toggleSettingMenuItem(rawScreenshotsEnabledSetting),
|
toggleSettingMenuItem(rawScreenshotsEnabledSetting),
|
||||||
|
toggleSettingMenuItem(saveVoiceRecordingsSetting),
|
||||||
],
|
],
|
||||||
TOP_LEFT_MENU_LAYOUT,
|
TOP_LEFT_MENU_LAYOUT,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user