This commit is contained in:
MomentQYC 2024-10-07 09:23:39 +08:00
parent e17c3d1ef9
commit 7363bcbf36
3 changed files with 17 additions and 15 deletions

View File

@ -66,6 +66,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private httpRequestService: HttpRequestService,
private roleService: RoleService,
) {
// @ts-ignore
super(meta, paramDef, async (ps, me) => {
const policies = await this.roleService.getUserPolicies(me.id);
if (!policies.canUseTTS) {
@ -82,7 +83,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
if (note.text == null) {
return;
throw new ApiError(meta.errors.cannotConvertInvisibleNote);
}
const instance = await this.metaService.fetch();
@ -160,6 +161,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const contentType = res.headers.get('Content-Type') || 'application/octet-stream';
if (contentType === 'audio/x-wav') {
// @ts-ignore
return res.body;
} else {
throw new ApiError(meta.errors.unavailable);
@ -186,6 +188,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const contentType = res.headers.get('Content-Type') || 'application/octet-stream';
if (contentType === 'audio/flac') {
// @ts-ignore
return res.body;
} else {
throw new ApiError(meta.errors.unavailable);

View File

@ -132,24 +132,23 @@ const hfnrm = ref<boolean>(false);
const hfSpeedRate = ref<number>(125);
const hfdas = ref<boolean>(false);
async function init() {
const meta = await misskeyApi('admin/meta');
deeplAuthKey.value = meta.deeplAuthKey;
deeplIsPro.value = meta.deeplIsPro;
hfAuthKey.value = meta.hfAuthkey;
hfSpace.value = meta.hfSpace,
hfSpaceName.value = meta.hfSpaceName,
hfexampleAudioURL.value = meta.hfexampleAudioURL,
hfexampleText.value = meta.hfexampleText,
hfexampleLang.value = meta.hfexampleLang,
hfslice.value = meta.hfslice,
hftopK.value = meta.hftopK,
hftopP.value = meta.hftopP,
hfTemperature.value = meta.hfTemperature,
hfnrm.value = meta.hfnrm,
hfSpeedRate.value = meta.hfSpeedRate,
hfdas.value = meta.hfdas
hfSpace.value = meta.hfSpace;
hfSpaceName.value = meta.hfSpaceName;
hfexampleAudioURL.value = meta.hfexampleAudioURL;
hfexampleText.value = meta.hfexampleText;
hfexampleLang.value = meta.hfexampleLang;
hfslice.value = meta.hfslice;
hftopK.value = meta.hftopK;
hftopP.value = meta.hftopP;
hfTemperature.value = meta.hfTemperature;
hfnrm.value = meta.hfnrm;
hfSpeedRate.value = meta.hfSpeedRate;
hfdas.value = meta.hfdas;
}
function save_deepl() {

View File

@ -324,7 +324,7 @@ export function getNoteMenu(props: {
} else {
console.error('Response body is not a ReadableStream');
}
} catch (e) {
} catch (errors) {
console.error('Failed to create Blob or Object URL:', e);
}