forked from Blendman974/faceclaw
Port assistant integration (with cloud AIs) to iOS
This commit is contained in:
1 parent
9e18745e53
commit
617cdc39eb
25 files changed
+508
-63
No files matched your search
@@ -10,7 +10,7 @@ import {
|
||||
import { getDefaultSmallFont } from "~/graphics/ui-fonts";
|
||||
import { wrapText } from "~/graphics/textwrap";
|
||||
import {
|
||||
ASSISTANT_MODEL_VALUES,
|
||||
ASSISTANT_MODEL_CHOICES,
|
||||
assistantModelLabel,
|
||||
assistantModelProvider,
|
||||
type AssistantModel,
|
||||
@@ -595,7 +595,7 @@ export const assistantSkipConfirmationSetting = new ConfigSettingBoolean({
|
||||
export type AssistantBackendKind = "direct" | "external";
|
||||
|
||||
const assistantBackendLabels: Record<AssistantBackendKind, string> = {
|
||||
direct: "On-phone",
|
||||
direct: global.isIOS ? "Cloud API" : "On-phone",
|
||||
external: "My own agent (bridge)",
|
||||
};
|
||||
|
||||
@@ -604,10 +604,10 @@ export const assistantBackendSetting = new ConfigSettingEnum<AssistantBackendKin
|
||||
label: "Assistant backend",
|
||||
storageKey: "assistant.backend",
|
||||
defaultValue: "direct",
|
||||
values: ["direct", "external"],
|
||||
values: global.isIOS ? ["direct"] : ["direct", "external"],
|
||||
formatValue: (value) => assistantBackendLabels[value] ?? value,
|
||||
description:
|
||||
"Who answers assistant queries: an LLM called from the phone (a cloud API with your key, or the downloaded on-phone model), or your own long-running agent (e.g. OpenClaw) reached through the faceclaw-agent-bridge plugin.",
|
||||
global.isIOS ? "Cloud models called with your OpenAI or Anthropic API key." : "Who answers assistant queries: an LLM called from the phone (a cloud API with your key, or the downloaded on-phone model), or your own long-running agent (e.g. OpenClaw) reached through the faceclaw-agent-bridge plugin.",
|
||||
});
|
||||
|
||||
export const assistantBridgeHostSetting = new ConfigSettingString({
|
||||
@@ -700,7 +700,7 @@ export const assistantModelSetting = new ConfigSettingEnum<AssistantModel>({
|
||||
label: "Assistant model",
|
||||
storageKey: "assistant.model",
|
||||
defaultValue: "auto",
|
||||
values: ASSISTANT_MODEL_VALUES,
|
||||
values: ASSISTANT_MODEL_CHOICES,
|
||||
formatValue: assistantModelLabel,
|
||||
isDisabled: (value) => {
|
||||
const provider = assistantModelProvider(value);
|
||||
@@ -710,7 +710,7 @@ export const assistantModelSetting = new ConfigSettingEnum<AssistantModel>({
|
||||
return false;
|
||||
},
|
||||
description:
|
||||
"Model used by the voice assistant. Auto prefers Terra when an OpenAI key is set, then Sonnet when an Anthropic key is set, then the downloaded on-phone model.",
|
||||
global.isIOS ? "Model used by the voice assistant. Auto prefers Terra with an OpenAI key, then Sonnet with an Anthropic key." : "Model used by the voice assistant. Auto prefers Terra when an OpenAI key is set, then Sonnet when an Anthropic key is set, then the downloaded on-phone model.",
|
||||
});
|
||||
|
||||
export const mapboxApiKeySetting = new ConfigSettingString({
|
||||
|
||||
@@ -130,14 +130,16 @@ function settingsSections(): SettingsSection[] {
|
||||
// On-phone LLM loop vs the user's own agent via the bridge plugin.
|
||||
enumSettingMenuItem(assistantBackendSetting),
|
||||
enumSettingMenuItem(assistantModelSetting),
|
||||
localModelMenuItem(),
|
||||
...(!global.isIOS ? [localModelMenuItem()] : []),
|
||||
// When on, a wakeword utterance goes straight to the assistant with no
|
||||
// Send/Type menu step.
|
||||
toggleSettingMenuItem(assistantSkipConfirmationSetting),
|
||||
...(!global.isIOS ? [
|
||||
textSettingMenuItem(assistantBridgeHostSetting),
|
||||
textSettingMenuItem(assistantBridgePortSetting),
|
||||
textSettingMenuItem(assistantBridgeTokenSetting),
|
||||
toggleSettingMenuItem(assistantAllowProactiveSetting),
|
||||
] : []),
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1067,7 +1067,7 @@ class Shell {
|
||||
*/
|
||||
private buildVoiceSendTargets(): VoiceSendTarget[] {
|
||||
const targets: VoiceSendTarget[] = [];
|
||||
if (!global.isIOS && this.isAssistantAvailable()) {
|
||||
if (this.isAssistantAvailable()) {
|
||||
targets.push({
|
||||
id: "assistant",
|
||||
label: "Send to Assistant",
|
||||
@@ -1254,7 +1254,7 @@ class Shell {
|
||||
this.showAlert(
|
||||
assistantBackendSetting.get() === "external"
|
||||
? "Configure the agent bridge host and token in Settings."
|
||||
: "Set an API key or download the on-phone model in Settings.",
|
||||
: global.isIOS ? "Set an OpenAI or Anthropic API key in Settings." : "Set an API key or download the on-phone model in Settings.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ export class VoiceInputLayer implements Layer {
|
||||
private menuRows(): Array<{ label: string; dim: boolean; onSelect: () => void }> {
|
||||
const text = this.displayText().trim();
|
||||
const hasText = text.length > 0 && !this.stoppingCapture;
|
||||
const hasLlmKey = !global.isIOS && anthropicApiKeySetting.get().trim().length > 0;
|
||||
const hasLlmKey = anthropicApiKeySetting.get().trim().length > 0;
|
||||
const rows: Array<{ label: string; dim: boolean; onSelect: () => void }> = [];
|
||||
for (const target of this.sendTargets) {
|
||||
rows.push({
|
||||
@@ -238,7 +238,7 @@ export class VoiceInputLayer implements Layer {
|
||||
});
|
||||
}
|
||||
rows.push({
|
||||
label: global.isIOS ? "Continue (Not available on iOS)" : hasLlmKey ? "Continue" : "Continue (Needs LLM API key)",
|
||||
label: hasLlmKey ? "Continue" : "Continue (Needs LLM API key)",
|
||||
dim: !hasLlmKey || this.stoppingCapture,
|
||||
onSelect: () => {
|
||||
if (hasLlmKey && !this.stoppingCapture) this.startContinuation();
|
||||
|
||||
Reference in new issue
Block a user