chore: prepare fork docker deployment
This commit is contained in:
1 parent
eca3b9c3dc
commit
d05b84d377
16 files changed
+397
-1597
No files matched your search
@@ -391,7 +391,7 @@ const PROVIDER_MODELS_CONFIG = {
|
||||
},
|
||||
"grok-cli": {
|
||||
customResolver: async (connection) => {
|
||||
const proxy = await resolveConnectionProxyConfig(connection.providerSpecificData || {});
|
||||
const proxy = await resolveConnectionProxyConfig(connection.providerSpecificData || {}, connection.id);
|
||||
const result = await resolveGrokCliModels({
|
||||
...connection,
|
||||
connectionId: connection.id,
|
||||
|
||||
@@ -33,7 +33,31 @@ function normalizeProxyConfig(body = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
async function normalizeProxyPoolUpdate(proxyPoolIdInput) {
|
||||
async function normalizeProxyPoolUpdate(body) {
|
||||
// Handle new multi-proxy format
|
||||
if (body.proxyPoolIds !== undefined) {
|
||||
const proxyPoolIds = Array.isArray(body.proxyPoolIds) ? body.proxyPoolIds : [];
|
||||
const proxyRotationStrategy = body.proxyRotationStrategy || "none";
|
||||
|
||||
// Validate all proxy pool IDs exist
|
||||
for (const poolId of proxyPoolIds) {
|
||||
if (poolId) {
|
||||
const pool = await getProxyPoolById(poolId);
|
||||
if (!pool) {
|
||||
return { hasProxyPoolField: true, error: `Proxy pool ${poolId} not found` };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
hasProxyPoolField: true,
|
||||
proxyPoolIds: proxyPoolIds.filter(Boolean),
|
||||
proxyRotationStrategy,
|
||||
};
|
||||
}
|
||||
|
||||
// Handle legacy single proxy format
|
||||
const proxyPoolIdInput = body.proxyPoolId;
|
||||
if (proxyPoolIdInput === undefined) {
|
||||
return { hasProxyPoolField: false, proxyPoolId: null };
|
||||
}
|
||||
@@ -111,7 +135,7 @@ export async function PUT(request, { params }) {
|
||||
return NextResponse.json({ error: proxyConfig.error }, { status: 400 });
|
||||
}
|
||||
|
||||
const proxyPoolResult = await normalizeProxyPoolUpdate(body.proxyPoolId);
|
||||
const proxyPoolResult = await normalizeProxyPoolUpdate(body);
|
||||
if (proxyPoolResult.error) {
|
||||
return NextResponse.json({ error: proxyPoolResult.error }, { status: 400 });
|
||||
}
|
||||
@@ -147,10 +171,19 @@ export async function PUT(request, { params }) {
|
||||
}
|
||||
|
||||
if (proxyPoolResult.hasProxyPoolField) {
|
||||
if (proxyPoolResult.proxyPoolId === null) {
|
||||
// Handle new multi-proxy format
|
||||
if (proxyPoolResult.proxyPoolIds !== undefined) {
|
||||
updateData.providerSpecificData.proxyPoolIds = proxyPoolResult.proxyPoolIds;
|
||||
updateData.providerSpecificData.proxyRotationStrategy = proxyPoolResult.proxyRotationStrategy;
|
||||
// Clear legacy field
|
||||
delete updateData.providerSpecificData.proxyPoolId;
|
||||
} else {
|
||||
updateData.providerSpecificData.proxyPoolId = proxyPoolResult.proxyPoolId;
|
||||
// Handle legacy single-proxy format
|
||||
if (proxyPoolResult.proxyPoolId === null) {
|
||||
delete updateData.providerSpecificData.proxyPoolId;
|
||||
} else {
|
||||
updateData.providerSpecificData.proxyPoolId = proxyPoolResult.proxyPoolId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ export async function testSingleConnection(id) {
|
||||
const connection = await getProviderConnectionById(id);
|
||||
if (!connection) return { valid: false, error: "Connection not found", latencyMs: 0, testedAt: new Date().toISOString() };
|
||||
|
||||
const effectiveProxy = await resolveConnectionProxyConfig(connection.providerSpecificData || {});
|
||||
const effectiveProxy = await resolveConnectionProxyConfig(connection.providerSpecificData || {}, connection.id);
|
||||
|
||||
if (effectiveProxy.connectionProxyEnabled && effectiveProxy.connectionProxyUrl && !effectiveProxy.vercelRelayUrl) {
|
||||
const proxyResult = await testProxyUrl({ proxyUrl: effectiveProxy.connectionProxyUrl });
|
||||
|
||||
Reference in new issue
Block a user