mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-23 04:09:49 +00:00
Enhance image and embedding provider support
- Added new image models for GPT 5.2, 5.3, and 5.4, including capabilities for text-to-image and editing. - Updated embedding handling to include optional dimensions in requests. - Introduced support for custom embedding providers, allowing dynamic fetching and validation of custom nodes. - Improved image generation handling with Codex integration, including progress tracking and error handling. - Enhanced UI components to support adding custom embeddings and displaying their status.
This commit is contained in:
@@ -15,11 +15,12 @@ let selectionMutex = Promise.resolve();
|
||||
* @param {Set<string>|string|null} excludeConnectionIds - Connection ID(s) to exclude (for retry with next account)
|
||||
* @param {string|null} model - Model name for per-model rate limit filtering
|
||||
*/
|
||||
export async function getProviderCredentials(provider, excludeConnectionIds = null, model = null) {
|
||||
export async function getProviderCredentials(provider, excludeConnectionIds = null, model = null, options = {}) {
|
||||
// Normalize to Set for consistent handling
|
||||
const excludeSet = excludeConnectionIds instanceof Set
|
||||
? excludeConnectionIds
|
||||
: (excludeConnectionIds ? new Set([excludeConnectionIds]) : new Set());
|
||||
const preferredConnectionId = options?.preferredConnectionId || null;
|
||||
// Acquire mutex to prevent race conditions
|
||||
const currentMutex = selectionMutex;
|
||||
let resolveMutex;
|
||||
@@ -87,7 +88,16 @@ export async function getProviderCredentials(provider, excludeConnectionIds = nu
|
||||
const strategy = providerOverride.fallbackStrategy || settings.fallbackStrategy || "fill-first";
|
||||
|
||||
let connection;
|
||||
if (strategy === "round-robin") {
|
||||
// Pin to preferred connection if specified and available
|
||||
if (preferredConnectionId) {
|
||||
connection = availableConnections.find((c) => c.id === preferredConnectionId);
|
||||
if (connection) {
|
||||
log.info("AUTH", `${provider} | pinned to ${connection.id?.slice(0, 8)} (${connection.name || connection.email || "unnamed"})`);
|
||||
}
|
||||
}
|
||||
if (connection) {
|
||||
// skip strategy
|
||||
} else if (strategy === "round-robin") {
|
||||
const stickyLimit = providerOverride.stickyRoundRobinLimit || settings.stickyRoundRobinLimit || 3;
|
||||
|
||||
// Sort by lastUsed (most recent first) to find current candidate
|
||||
|
||||
Reference in New Issue
Block a user