agent-rev 0.4.11 → 0.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/qwen-auth.js +4 -2
- package/package.json +1 -1
package/dist/utils/qwen-auth.js
CHANGED
|
@@ -235,7 +235,8 @@ export async function fetchQwenModels() {
|
|
|
235
235
|
if (!token)
|
|
236
236
|
return [];
|
|
237
237
|
try {
|
|
238
|
-
const
|
|
238
|
+
const host = token.resourceUrl ? `https://${token.resourceUrl}` : 'https://chat.qwen.ai';
|
|
239
|
+
const res = await fetch(`${host}/api/models`, {
|
|
239
240
|
headers: { Authorization: `Bearer ${token.accessToken}` },
|
|
240
241
|
});
|
|
241
242
|
if (!res.ok)
|
|
@@ -252,7 +253,8 @@ export async function getQwenAccessToken() {
|
|
|
252
253
|
return token?.accessToken || null;
|
|
253
254
|
}
|
|
254
255
|
async function callQwenAPIWithToken(token, prompt, model, onData) {
|
|
255
|
-
const
|
|
256
|
+
const host = token.resourceUrl ? `https://${token.resourceUrl}` : 'https://chat.qwen.ai';
|
|
257
|
+
const baseUrl = `${host}/api/v1`;
|
|
256
258
|
const useStream = !!onData;
|
|
257
259
|
const response = await fetch(`${baseUrl}/chat/completions`, {
|
|
258
260
|
method: 'POST',
|