Reuse Athena router key for OpenClaw dictation
This commit is contained in:
@@ -114,10 +114,18 @@ function resolveModelProvider(cfg: unknown, requested?: unknown): Record<string,
|
||||
function resolveConfig(req: any): Required<ProviderConfig> {
|
||||
const raw = record(req.providerConfig);
|
||||
const modelProvider = resolveModelProvider(req.cfg, raw.modelProvider);
|
||||
const baseUrl = String(raw.baseUrl || modelProvider.baseUrl || "http://192.168.1.212:8081/v1").replace(/\/$/, "");
|
||||
const tts = record(record(record(req.cfg).tts).providers).openai;
|
||||
let sharedTtsKey = "";
|
||||
try {
|
||||
if (new URL(String(record(tts).baseUrl)).origin === new URL(baseUrl).origin) {
|
||||
sharedTtsKey = typeof record(tts).apiKey === "string" ? record(tts).apiKey : "";
|
||||
}
|
||||
} catch { /* The TTS provider may be absent or use another URL. */ }
|
||||
return {
|
||||
modelProvider: String(raw.modelProvider || ""),
|
||||
baseUrl: String(raw.baseUrl || modelProvider.baseUrl || "http://192.168.1.212:8081/v1").replace(/\/$/, ""),
|
||||
apiKey: String(raw.apiKey || modelProvider.apiKey || ""),
|
||||
baseUrl,
|
||||
apiKey: String(raw.apiKey || modelProvider.apiKey || sharedTtsKey || ""),
|
||||
voice: String(raw.voice || req.voice || "alloy"),
|
||||
language: String(raw.language || req.language || "de"),
|
||||
vadThreshold: Number(raw.vadThreshold ?? 0.018),
|
||||
|
||||
Reference in New Issue
Block a user