style
This commit is contained in:
parent
167b1849f0
commit
e17c3d1ef9
10 changed files with 64 additions and 30 deletions
|
|
@ -78,6 +78,7 @@ function generateDummyUser(override?: Partial<MiUser>): MiUser {
|
|||
isLocked: false,
|
||||
isBot: false,
|
||||
isCat: true,
|
||||
isVI: false,
|
||||
isRoot: false,
|
||||
isExplorable: true,
|
||||
isHibernated: false,
|
||||
|
|
@ -197,6 +198,7 @@ function toPackedUserLite(user: MiUser, override?: Packed<'UserLite'>): Packed<'
|
|||
})),
|
||||
isBot: user.isBot,
|
||||
isCat: user.isCat,
|
||||
isVI: user.isVI,
|
||||
emojis: user.emojis,
|
||||
onlineStatus: 'active',
|
||||
badgeRoles: [],
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export const packedRoleCondFormulaValueUserSettingBooleanSchema = {
|
|||
type: {
|
||||
type: 'string',
|
||||
nullable: false, optional: false,
|
||||
enum: ['isSuspended', 'isLocked', 'isBot', 'isCat','isVI' , 'isExplorable'],
|
||||
enum: ['isSuspended', 'isLocked', 'isBot', 'isCat', 'isVI', 'isExplorable'],
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
try {
|
||||
const example = await fetch(instance.hfexampleAudioURL || '');
|
||||
exampleAudio = await example.blob();
|
||||
} catch {
|
||||
} catch (e) {
|
||||
throw new ApiError(meta.errors.unavailable);
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
try {
|
||||
app = await Client.connect(instance.hfSpaceName, { hf_token: instance.hfAuthKey });
|
||||
} catch {
|
||||
} catch (e) {
|
||||
throw new ApiError(meta.errors.unavailable);
|
||||
}
|
||||
|
||||
|
|
@ -135,19 +135,19 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
instance.hfdas,
|
||||
]);
|
||||
} catch (e) {
|
||||
console.error("An error occurred during prediction:", e);
|
||||
|
||||
const responseMessage = (e as any).message || ((e as any).original_msg && (e as any).original_msg.message);
|
||||
|
||||
if (responseMessage && responseMessage.includes('You have exceeded your GPU quota')) {
|
||||
outofQuota = true;
|
||||
console.log("Fallback to Inference API");
|
||||
console.info("Fallback to Inference API");
|
||||
notcontinue = true;
|
||||
} else {
|
||||
throw new ApiError(meta.errors.unavailable);
|
||||
}
|
||||
notcontinue = true;
|
||||
}
|
||||
|
||||
if (!notcontinue) {
|
||||
let resurl = result.data[0].url;
|
||||
const resurl = result.data[0].url;
|
||||
|
||||
const res = await this.httpRequestService.send(resurl, {
|
||||
method: 'GET',
|
||||
|
|
@ -157,7 +157,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
timeout: 60000,
|
||||
});
|
||||
|
||||
let contentType = res.headers.get('Content-Type') || 'application/octet-stream';
|
||||
const contentType = res.headers.get('Content-Type') || 'application/octet-stream';
|
||||
|
||||
if (contentType === 'audio/x-wav') {
|
||||
return res.body;
|
||||
|
|
@ -183,7 +183,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
timeout: 60000,
|
||||
});
|
||||
|
||||
let contentType = res.headers.get('Content-Type') || 'application/octet-stream';
|
||||
const contentType = res.headers.get('Content-Type') || 'application/octet-stream';
|
||||
|
||||
if (contentType === 'audio/flac') {
|
||||
return res.body;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue