mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 10:15:40 +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:
1 parent
e0ae5f20ff
commit
854b198b64
2 files changed
+29
No files matched your search
@@ -492,6 +492,28 @@ export async function execClaudeWithCLIProxy(
|
|||||||
|
|
||||||
// Multi-provider auth check for composite variants
|
// Multi-provider auth check for composite variants
|
||||||
if (compositeProviders.length > 0) {
|
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[] = [];
|
const unauthenticatedProviders: string[] = [];
|
||||||
for (const p of compositeProviders) {
|
for (const p of compositeProviders) {
|
||||||
if (!isAuthenticated(p)) {
|
if (!isAuthenticated(p)) {
|
||||||
|
|||||||
@@ -81,6 +81,13 @@ export interface UpdateVariant {
|
|||||||
provider?: CLIProxyProvider;
|
provider?: CLIProxyProvider;
|
||||||
model?: string;
|
model?: string;
|
||||||
account?: 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 */
|
/** OAuth account info for multi-account support */
|
||||||
|
|||||||
Reference in new issue
Block a user