fix(opencode): enable usage auto-query for providers in config

For OpenCode (additive mode), use isInConfig instead of isCurrent to
determine whether to enable usage auto-query. This allows providers
that have been added to the config to have their usage queried
automatically.
This commit is contained in:
Jason
2026-01-17 15:48:44 +08:00
parent b70de25de4
commit 882c73234f
2 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -136,7 +136,9 @@ export function ProviderCard({
const usageEnabled = provider.meta?.usage_script?.enabled ?? false;
// 获取用量数据以判断是否有多套餐
const autoQueryInterval = isCurrent
// OpenCode(累加模式):使用 isInConfig 代替 isCurrent
const shouldAutoQuery = appId === "opencode" ? isInConfig : isCurrent;
const autoQueryInterval = shouldAutoQuery
? provider.meta?.usage_script?.autoQueryInterval || 0
: 0;
@@ -333,6 +335,7 @@ export function ProviderCard({
appId={appId}
usageEnabled={usageEnabled}
isCurrent={isCurrent}
isInConfig={isInConfig}
inline={true}
/>
)}
@@ -398,6 +401,7 @@ export function ProviderCard({
appId={appId}
usageEnabled={usageEnabled}
isCurrent={isCurrent}
isInConfig={isInConfig}
inline={false}
/>
</div>