feat(usage-query): decouple credentials from provider config
Add independent credential fields for usage query to support different query endpoints and authentication methods. Changes: - Add `apiKey` and `baseUrl` fields to UsageScript struct - Remove dependency on provider config credentials in query_usage - Update test_usage_script to accept independent credential parameters - Add credential input fields in UsageScriptModal based on template: * General: apiKey + baseUrl * NewAPI: baseUrl + accessToken + userId * Custom: no additional fields (full freedom) - Auto-clear irrelevant fields when switching templates - Add i18n text for "credentialsConfig" Benefits: - Query API can use different endpoint/key than provider config - Better separation of concerns - More flexible for various usage query scenarios
This commit is contained in:
@@ -32,6 +32,8 @@ export const usageApi = {
|
||||
appId: AppId,
|
||||
scriptCode: string,
|
||||
timeout?: number,
|
||||
apiKey?: string,
|
||||
baseUrl?: string,
|
||||
accessToken?: string,
|
||||
userId?: string,
|
||||
): Promise<UsageResult> {
|
||||
@@ -41,6 +43,8 @@ export const usageApi = {
|
||||
app: appId,
|
||||
scriptCode: scriptCode,
|
||||
timeout: timeout,
|
||||
apiKey: apiKey,
|
||||
baseUrl: baseUrl,
|
||||
accessToken: accessToken,
|
||||
userId: userId,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user