mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-04 07:35:19 +02:00
Updated the usage of Qwen api
This commit is contained in:
parent
0f926727f5
commit
5393f2d0d9
1 changed files with 8 additions and 2 deletions
|
@ -27,7 +27,10 @@ export class Qwen {
|
|||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (!response.ok) throw new Error(`Request failed with status ${response.status}: ${response.statusText}`);
|
||||
if (!response.ok) {
|
||||
console.error(`Request failed with status ${response.status}: ${response.statusText}`);
|
||||
return `Request failed with status ${response.status}: ${response.statusText}`;
|
||||
}
|
||||
|
||||
const responseData = await response.json();
|
||||
const choice = responseData?.output?.choices?.[0];
|
||||
|
@ -69,7 +72,10 @@ export class Qwen {
|
|||
body: JSON.stringify(data),
|
||||
});
|
||||
|
||||
if (!response.ok) throw new Error(`Request failed with status ${response.status}: ${response.statusText}`);
|
||||
if (!response.ok) {
|
||||
console.error(`Request failed with status ${response.status}: ${response.statusText}`);
|
||||
return `Request failed with status ${response.status}: ${response.statusText}`;
|
||||
}
|
||||
|
||||
const responseData = await response.json();
|
||||
if (!responseData?.output?.embeddings) {
|
||||
|
|
Loading…
Add table
Reference in a new issue