@fudrouter/fsrouter 0.6.115 → 0.6.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -740,7 +740,7 @@ const PROVIDERS = {
|
|
|
740
740
|
// locally, the user lands on qoder.com/device/selectAccounts in the
|
|
741
741
|
// browser, and we poll openapi.qoder.sh until a `dt-...` token appears.
|
|
742
742
|
requestDeviceCode: async (config) => {
|
|
743
|
-
const { QoderService } = await import(
|
|
743
|
+
const { QoderService } = await import('../../lib/oauth/services/qoder.js');
|
|
744
744
|
const flow = new QoderService().initiateDeviceFlow();
|
|
745
745
|
// Match the device_code shape the rest of the OAuthModal expects
|
|
746
746
|
// (device_code, user_code, verification_uri[_complete], interval).
|
|
@@ -761,7 +761,7 @@ const PROVIDERS = {
|
|
|
761
761
|
};
|
|
762
762
|
},
|
|
763
763
|
pollToken: async (config, deviceCode, codeVerifier, extraData) => {
|
|
764
|
-
const { QoderService } = await import(
|
|
764
|
+
const { QoderService } = await import('../../lib/oauth/services/qoder.js');
|
|
765
765
|
const svc = new QoderService();
|
|
766
766
|
const nonce = deviceCode || extraData?._qoderNonce;
|
|
767
767
|
const verifier = codeVerifier || extraData?._qoderVerifier;
|
|
@@ -1724,7 +1724,7 @@ export async function backfillCodexEmails() {
|
|
|
1724
1724
|
if (codexBackfillDone) return;
|
|
1725
1725
|
codexBackfillDone = true;
|
|
1726
1726
|
try {
|
|
1727
|
-
const { getProviderConnections, updateProviderConnection } = await import(
|
|
1727
|
+
const { getProviderConnections, updateProviderConnection } = await import('../../lib/localDb.js');
|
|
1728
1728
|
const connections = await getProviderConnections();
|
|
1729
1729
|
const targets = connections.filter((c) => {
|
|
1730
1730
|
if (c.provider !== "codex" || c.authType !== "oauth" || !c.idToken) return false;
|
|
@@ -26,7 +26,7 @@ export function getTtsAdapter(provider) {
|
|
|
26
26
|
|
|
27
27
|
// Generic config-driven dispatcher (uses ttsConfig.format)
|
|
28
28
|
export async function synthesizeViaConfig(provider, text, model, credentials) {
|
|
29
|
-
const { AI_PROVIDERS } = await import(
|
|
29
|
+
const { AI_PROVIDERS } = await import('../../../shared/constants/providers.js');
|
|
30
30
|
const cfg = AI_PROVIDERS[provider]?.ttsConfig;
|
|
31
31
|
if (!cfg) return null;
|
|
32
32
|
const handler = FORMAT_HANDLERS[cfg.format];
|
|
@@ -121,10 +121,10 @@ export async function POST_handler(req, res) {
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
if (probeRes.ok)
|
|
124
|
-
return
|
|
124
|
+
return res.json({ valid: true });
|
|
125
125
|
// Auth errors - no point trying chat fallback
|
|
126
126
|
if (probeRes.status === 401 || probeRes.status === 403) {
|
|
127
|
-
return
|
|
127
|
+
return res.json({ valid: false, error: "API key unauthorized" });
|
|
128
128
|
}
|
|
129
129
|
// Fallback: try chat/completions if modelId provided
|
|
130
130
|
if (modelId) {
|
|
@@ -143,15 +143,15 @@ export async function POST_handler(req, res) {
|
|
|
143
143
|
})
|
|
144
144
|
});
|
|
145
145
|
if (chatRes.ok) {
|
|
146
|
-
return
|
|
146
|
+
return res.json({ valid: true, method: "chat" });
|
|
147
147
|
}
|
|
148
|
-
return
|
|
148
|
+
return res.json({
|
|
149
149
|
valid: false,
|
|
150
150
|
error: getChatErrorMessage(chatRes.status),
|
|
151
151
|
method: "chat"
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return res.json({ valid: false, error: getModelsErrorMessage(probeRes.status) });
|
|
155
155
|
}
|
|
156
156
|
// OpenAI Compatible Validation (Default)
|
|
157
157
|
const modelsUrl = `${baseUrl.replace(/\/$/, "")}/models`;
|
|
@@ -159,10 +159,10 @@ export async function POST_handler(req, res) {
|
|
|
159
159
|
headers: { "Authorization": `Bearer ${apiKey}` },
|
|
160
160
|
});
|
|
161
161
|
if (probeRes.ok)
|
|
162
|
-
return
|
|
162
|
+
return res.json({ valid: true });
|
|
163
163
|
// Auth errors - no point trying chat fallback
|
|
164
164
|
if (probeRes.status === 401 || probeRes.status === 403) {
|
|
165
|
-
return
|
|
165
|
+
return res.json({ valid: false, error: "API key unauthorized" });
|
|
166
166
|
}
|
|
167
167
|
// Fallback: try chat/completions if modelId provided
|
|
168
168
|
if (modelId) {
|
|
@@ -179,7 +179,7 @@ export async function POST_handler(req, res) {
|
|
|
179
179
|
})
|
|
180
180
|
});
|
|
181
181
|
if (chatRes.ok) {
|
|
182
|
-
return
|
|
182
|
+
return res.json({ valid: true, method: "chat" });
|
|
183
183
|
}
|
|
184
184
|
return res.json({
|
|
185
185
|
valid: false,
|