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" ;
@@ -92,15 +90,9 @@ export default defineCommand({
9290 }
9391
9492 if ( off ) {
95- const [ quotaResult , stopResult ] = await Promise . all ( [
96- ctx . client . console ( FREE_TIER_API , { queryFreeTierQuotaRequest : { models } } ) ,
97- ctx . client . console ( FREE_TIER_ONLY_STATUS_API , {
98- queryFreeTierOnlyStatusRequest : { models } ,
99- } ) ,
100- ] ) ;
101-
102- const quotas = extractQuotas ( quotaResult ) ;
103- const quotaMap = new Map ( quotas . map ( ( quota ) => [ quota . model , quota ] ) ) ;
93+ const stopResult = await ctx . client . console ( FREE_TIER_ONLY_STATUS_API , {
94+ queryFreeTierOnlyStatusRequest : { models } ,
95+ } ) ;
10496
10597 const stopStatuses = extractFreeTierOnlyStatuses ( stopResult ) ;
10698 const stopMap = new Map ( stopStatuses . map ( ( status ) => [ status . model , status . freeTierOnly ] ) ) ;
@@ -110,13 +102,6 @@ export default defineCommand({
110102 process . stderr . write ( `Auto-stop is already disabled for "${ name } ".\n` ) ;
111103 continue ;
112104 }
113- const quota = quotaMap . get ( name ) ;
114- if ( quota && quota . quotaTotal > 0 && stopMap . get ( name ) === true ) {
115- process . stderr . write (
116- `Cannot disable auto-stop for "${ name } ": free-tier quota has not been fully consumed. Please disable auto-stop after the quota is exhausted.\n` ,
117- ) ;
118- continue ;
119- }
120105 await pollFreeTierBatch ( ctx . client , api , requestKey , [ name ] ) ;
121106 process . stdout . write ( `Disabled auto-stop for "${ name } ".\n` ) ;
122107 }
0 commit comments