feat: macOS architecture, cloud ASR/LLM providers, and 6-step iOS onboarding

- Add macOS menu-bar dictation app with local ASR models (SenseVoice/Qwen3),
  global Option hotkey, and bottom overlay
- Add cloud ASR/LLM providers (Anthropic, Volcengine, Bailian, and more) with
  provider logos, model listing, and connection checks
- Add shared 7-day usage stats UI (UsageStatsCluster / SevenDayUsageChart)
- Add iOS onboarding step 6 for polish LLM setup; hide custom-language-model
  diagnostic toggle behind DEBUG
- Unify iOS onboarding tagline with the macOS brand line ("开口即文字。")
- Rewrite README (Chinese-first, product-oriented) and refresh GitHub Pages
This commit is contained in:
Rocky
2026-07-11 19:10:20 +08:00
parent cdf833935a
commit cc8dd1070a
116 changed files with 6659 additions and 2634 deletions
@@ -27,6 +27,7 @@ public protocol ConfigurationStore: Sendable {
var engineMode: String { get }
var polishIntensity: PolishIntensity { get }
var llmThinkingEnabled: Bool { get }
var personalDictionary: PersonalDictionary { get }
/// Foreground-app context for polish prompts (keyboard extension publishes this).
@@ -0,0 +1,114 @@
// LiveConfigurationStore.swift
// OSGKeyboard · Shared
//
// In-memory settings snapshot for connection checks and model probes.
// Reads the values the user is editing not a delayed Keychain re-fetch.
import Foundation
public struct LiveConfigurationSnapshot {
public let providerId: String
public let baseURL: String
public let apiKey: String
public let model: String
public let asrProviderId: String
public let asrBaseURL: String
public let asrApiKey: String
public let asrModel: String
public let engineMode: String
public let polishIntensity: PolishIntensity
public let llmThinkingEnabled: Bool
public let personalDictionary: PersonalDictionary
public let detectedAppContext: (context: AppContext, observedAt: Date)?
public let cloudASRPersistence: UserDefaults
public init(
providerId: String,
baseURL: String,
apiKey: String,
model: String,
asrProviderId: String,
asrBaseURL: String,
asrApiKey: String,
asrModel: String,
engineMode: String,
polishIntensity: PolishIntensity,
llmThinkingEnabled: Bool,
personalDictionary: PersonalDictionary,
detectedAppContext: (context: AppContext, observedAt: Date)?,
cloudASRPersistence: UserDefaults
) {
self.providerId = providerId
self.baseURL = baseURL
self.apiKey = apiKey
self.model = model
self.asrProviderId = asrProviderId
self.asrBaseURL = asrBaseURL
self.asrApiKey = asrApiKey
self.asrModel = asrModel
self.engineMode = engineMode
self.polishIntensity = polishIntensity
self.llmThinkingEnabled = llmThinkingEnabled
self.personalDictionary = personalDictionary
self.detectedAppContext = detectedAppContext
self.cloudASRPersistence = cloudASRPersistence
}
/// Build from live `ProviderConfig` plus persisted App Group extras.
public init(config: ProviderConfig, fallback: AppGroupStore) {
self.init(
providerId: config.providerId,
baseURL: config.baseURL,
apiKey: config.apiKey,
model: config.model,
asrProviderId: config.asrProviderId,
asrBaseURL: config.asrBaseURL,
asrApiKey: config.asrApiKey,
asrModel: config.asrModel,
engineMode: config.engineMode,
polishIntensity: config.polishIntensity,
llmThinkingEnabled: config.llmThinkingEnabled,
personalDictionary: fallback.personalDictionary,
detectedAppContext: fallback.detectedAppContext,
cloudASRPersistence: fallback.defaults
)
}
}
/// Ephemeral `ConfigurationStore` backed by a user-edited snapshot.
public struct LiveConfigurationStore: ConfigurationStore, @unchecked Sendable {
private let snapshot: LiveConfigurationSnapshot
public init(snapshot: LiveConfigurationSnapshot) {
self.snapshot = snapshot
}
public init(config: ProviderConfig, fallback: AppGroupStore) {
self.init(snapshot: LiveConfigurationSnapshot(config: config, fallback: fallback))
}
public var providerId: String { snapshot.providerId }
public var baseURL: String { snapshot.baseURL }
public var apiKey: String { snapshot.apiKey }
public var model: String { snapshot.model }
public var asrProviderId: String { snapshot.asrProviderId }
public var asrBaseURL: String { snapshot.asrBaseURL }
public var asrApiKey: String { snapshot.asrApiKey }
public var asrModel: String { snapshot.asrModel }
public var engineMode: String { snapshot.engineMode }
public var polishIntensity: PolishIntensity { snapshot.polishIntensity }
public var llmThinkingEnabled: Bool { snapshot.llmThinkingEnabled }
public var personalDictionary: PersonalDictionary { snapshot.personalDictionary }
public var detectedAppContext: (context: AppContext, observedAt: Date)? { snapshot.detectedAppContext }
public var cloudASRPersistence: UserDefaults { snapshot.cloudASRPersistence }
public func makeClient() -> LLMClient {
LLMClientFactory.make(
providerId: providerId,
baseURL: baseURL,
apiKey: apiKey,
model: model,
thinkingEnabled: llmThinkingEnabled
)
}
}