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,
|
||||
onAnySettingChanged,
|
||||
rawScreenshotsEnabledSetting,
|
||||
saveVoiceRecordingsSetting,
|
||||
systemCardNameSetting,
|
||||
voiceProviderSetting,
|
||||
type ConfigSettingString,
|
||||
@@ -280,8 +281,15 @@ class DashboardController {
|
||||
|
||||
setActiveTextSettingValue(value: string): void {
|
||||
noteDashboardPhoneTextInput();
|
||||
if (!this.activeTextSetting) return;
|
||||
this.updateTextSetting(this.activeTextSetting, value);
|
||||
const setting = this.activeTextSetting;
|
||||
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> {
|
||||
@@ -574,6 +582,7 @@ class DashboardController {
|
||||
communicator: communicator.getNativeCommunicator(),
|
||||
provider: voiceProviderSetting.get(),
|
||||
elevenLabsApiKey: elevenLabsApiKeySetting.get(),
|
||||
saveRecording: saveVoiceRecordingsSetting.get(),
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -61,7 +61,9 @@ export class ElevenLabsSttClient {
|
||||
});
|
||||
try {
|
||||
// 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...");
|
||||
} catch (error) {
|
||||
this.options.onError(`ElevenLabs connection failed: ${String((error as Error)?.message ?? error)}`);
|
||||
|
||||
@@ -122,7 +122,7 @@ export class G2MirrorClient {
|
||||
},
|
||||
});
|
||||
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) {
|
||||
this.ws = null;
|
||||
this.handleConnectionLost(`Connection failed: ${shortenError(String((error as Error)?.message ?? error))}`);
|
||||
|
||||
@@ -24,6 +24,7 @@ export type PushToTalkOptions = {
|
||||
communicator: any;
|
||||
provider: VoiceProviderKind;
|
||||
elevenLabsApiKey: string;
|
||||
saveRecording: boolean;
|
||||
};
|
||||
|
||||
export class FaceclawVoiceControlBridge {
|
||||
@@ -59,6 +60,7 @@ export class FaceclawVoiceControlBridge {
|
||||
if (this.started) this.stop();
|
||||
this.ensureController();
|
||||
this.controller?.setCommunicator(options.communicator);
|
||||
this.controller?.setSaveRecordings(options.saveRecording);
|
||||
|
||||
if (options.provider === "elevenlabs" && options.elevenLabsApiKey.trim()) {
|
||||
this.cloudClient = new ElevenLabsSttClient({
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
textChange="{{ onTextSettingTextChange }}"
|
||||
returnPress="{{ onTextSettingReturnPress }}"
|
||||
autocorrect="false"
|
||||
autocapitalizationType="words"
|
||||
autocapitalizationType="none"
|
||||
returnKeyType="done" />
|
||||
</StackLayout>
|
||||
</GridLayout>
|
||||
|
||||
@@ -344,7 +344,13 @@ export class MainViewModel extends Observable {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -278,6 +278,13 @@ export const voiceProviderSetting = new ConfigSettingEnum<VoiceProvider>({
|
||||
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({
|
||||
id: "elevenlabs-api-key",
|
||||
label: "ElevenLabs key",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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";
|
||||
|
||||
export function createSettingsMenuLayer(): MenuLayer {
|
||||
@@ -46,6 +46,7 @@ function createDeveloperSettingsMenuLayer(): MenuLayer {
|
||||
"Settings > Developer",
|
||||
[
|
||||
toggleSettingMenuItem(rawScreenshotsEnabledSetting),
|
||||
toggleSettingMenuItem(saveVoiceRecordingsSetting),
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user