11import { defineCommand , detectOutputFormat , unwrapResponse } from "bailian-cli-core" ;
22import { emitResult } from "bailian-cli-runtime" ;
33import {
4- FREE_TIER_API ,
54 FREE_TIER_ONLY_STATUS_API ,
65 extractFreeTierOnlyStatuses ,
7- extractQuotas ,
86 fetchAllModels ,
97 pollFreeTierBatch ,
108} from "./shared.ts" ;
@@ -101,15 +99,9 @@ export default defineCommand({
10199 }
102100
103101 if ( off ) {
104- const [ quotaResult , stopResult ] = await Promise . all ( [
105- ctx . client . console ( FREE_TIER_API , { queryFreeTierQuotaRequest : { models } } ) ,
106- ctx . client . console ( FREE_TIER_ONLY_STATUS_API , {
107- queryFreeTierOnlyStatusRequest : { models } ,
108- } ) ,
109- ] ) ;
110-
111- const quotas = extractQuotas ( quotaResult ) ;
112- const quotaMap = new Map ( quotas . map ( ( quota ) => [ quota . model , quota ] ) ) ;
102+ const stopResult = await ctx . client . console ( FREE_TIER_ONLY_STATUS_API , {
103+ queryFreeTierOnlyStatusRequest : { models } ,
104+ } ) ;
113105
114106 const stopStatuses = extractFreeTierOnlyStatuses ( stopResult ) ;
115107 const stopMap = new Map ( stopStatuses . map ( ( status ) => [ status . model , status . freeTierOnly ] ) ) ;
@@ -119,13 +111,6 @@ export default defineCommand({
119111 process . stderr . write ( `Auto-stop is already disabled for "${ name } ".\n` ) ;
120112 continue ;
121113 }
122- const quota = quotaMap . get ( name ) ;
123- if ( quota && quota . quotaTotal > 0 && stopMap . get ( name ) === true ) {
124- process . stderr . write (
125- `Cannot disable auto-stop for "${ name } ": free-tier quota has not been fully consumed. Please disable auto-stop after the quota is exhausted.\n` ,
126- ) ;
127- continue ;
128- }
129114 await pollFreeTierBatch ( ctx . client , api , requestKey , [ name ] ) ;
130115 process . stdout . write ( `Disabled auto-stop for "${ name } ".\n` ) ;
131116 }
0 commit comments