mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 12:15:57 +00:00
fix(cliproxy): address code review feedback (attempt 1/5)
- Add composite fields to UpdateVariant type (default_tier, tiers) - Handle forceAuth (--auth) for composite multi-provider variants
This commit is contained in:
@@ -492,6 +492,28 @@ export async function execClaudeWithCLIProxy(
|
||||
|
||||
// Multi-provider auth check for composite variants
|
||||
if (compositeProviders.length > 0) {
|
||||
// Handle forceAuth for composite providers
|
||||
if (forceAuth) {
|
||||
const { triggerOAuth } = await import('../auth-handler');
|
||||
for (const p of compositeProviders) {
|
||||
const authSuccess = await triggerOAuth(p, {
|
||||
verbose,
|
||||
add: addAccount,
|
||||
...(forceHeadless ? { headless: true } : {}),
|
||||
...(setNickname ? { nickname: setNickname } : {}),
|
||||
...(noIncognito ? { noIncognito: true } : {}),
|
||||
...(pasteCallback ? { pasteCallback: true } : {}),
|
||||
...(portForward ? { portForward: true } : {}),
|
||||
});
|
||||
if (!authSuccess) {
|
||||
const pConfig = getProviderConfig(p as CLIProxyProvider);
|
||||
throw new Error(`Authentication failed for ${pConfig.displayName}`);
|
||||
}
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Check for unauthenticated providers
|
||||
const unauthenticatedProviders: string[] = [];
|
||||
for (const p of compositeProviders) {
|
||||
if (!isAuthenticated(p)) {
|
||||
|
||||
@@ -81,6 +81,13 @@ export interface UpdateVariant {
|
||||
provider?: CLIProxyProvider;
|
||||
model?: string;
|
||||
account?: string;
|
||||
type?: 'composite';
|
||||
default_tier?: 'opus' | 'sonnet' | 'haiku';
|
||||
tiers?: {
|
||||
opus: { provider: string; model: string; account?: string; thinking?: string };
|
||||
sonnet: { provider: string; model: string; account?: string; thinking?: string };
|
||||
haiku: { provider: string; model: string; account?: string; thinking?: string };
|
||||
};
|
||||
}
|
||||
|
||||
/** OAuth account info for multi-account support */
|
||||
|
||||
Reference in New Issue
Block a user