This commit is contained in:
MomentQYC 2024-10-07 09:04:06 +08:00
parent 167b1849f0
commit e17c3d1ef9
10 changed files with 64 additions and 30 deletions

View File

@ -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: [],

View File

@ -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;

View File

@ -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);
}
}
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;

View File

@ -80,16 +80,16 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="Slice by English punct">Slice by English punct</option>
<option value="Slice by every punct">Slice by every punct</option>
</MkSelect>
<MkInput type="range" v-model.number="hftopK" :min="0" :max="100" :step="1">
<MkInput v-model.number="hftopK" type="range" :min="0" :max="100" :step="1">
<template #label>Set top_k Value: {{ hftopK }}</template>
</MkInput>
<MkInput type="range" v-model.number="hftopP" :min="0" :max="100" :step="5">
<MkInput v-model.number="hftopP" type="range" :min="0" :max="100" :step="5">
<template #label>Set top_p Value: {{ hftopP }}</template>
</MkInput>
<MkInput type="range" v-model.number="hfTemperature" :min="0" :max="100" :step="5">
<MkInput v-model.number="hfTemperature" type="range" :min="0" :max="100" :step="5">
<template #label>Set Temperature Value: {{ hfTemperature }}</template>
</MkInput>
<MkInput type="range" v-model.number="hfSpeedRate" :min="60" :max="165" :step="5">
<MkInput v-model.number="hfSpeedRate" type="range" :min="60" :max="165" :step="5">
<template #label>Set Speed Rate Value: {{ hfSpeedRate }}</template>
</MkInput>
</div>

View File

@ -176,7 +176,7 @@ export function getNoteMenu(props: {
note: Misskey.entities.Note;
translation: Ref<Misskey.entities.NotesTranslateResponse | null>;
translating: Ref<boolean>;
convert: Ref<String | null>;
convert: Ref<string | null>;
converting: Ref<boolean>;
isDeleted: Ref<boolean>;
currentClip?: Misskey.entities.Clip;

View File

@ -1671,8 +1671,8 @@ declare namespace entities {
NotesTimelineResponse,
NotesTranslateRequest,
NotesTranslateResponse,
NotesTTSRequest,
NotesTTSResponse,
NotesTtsRequest,
NotesTtsResponse,
NotesUnrenoteRequest,
NotesUserListTimelineRequest,
NotesUserListTimelineResponse,
@ -2788,10 +2788,10 @@ type NotesTranslateRequest = operations['notes___translate']['requestBody']['con
type NotesTranslateResponse = operations['notes___translate']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesTTSRequest = operations['notes___tts']['requestBody']['content']['application/json'];
type NotesTtsRequest = operations['notes___tts']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesTTSResponse = unknown;
type NotesTtsResponse = operations['notes___tts']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesUnrenoteRequest = operations['notes___unrenote']['requestBody']['content']['application/json'];

View File

@ -3339,6 +3339,17 @@ declare module '../api.js' {
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *Yes* / **Permission**: *read:account*
*/
request<E extends 'notes/tts', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*

View File

@ -450,8 +450,8 @@ import type {
NotesTimelineResponse,
NotesTranslateRequest,
NotesTranslateResponse,
NotesTTSRequest,
NotesTTSResponse,
NotesTtsRequest,
NotesTtsResponse,
NotesUnrenoteRequest,
NotesUserListTimelineRequest,
NotesUserListTimelineResponse,
@ -880,7 +880,7 @@ export type Endpoints = {
'notes/thread-muting/delete': { req: NotesThreadMutingDeleteRequest; res: EmptyResponse };
'notes/timeline': { req: NotesTimelineRequest; res: NotesTimelineResponse };
'notes/translate': { req: NotesTranslateRequest; res: NotesTranslateResponse };
'notes/tts': { req: NotesTTSRequest; res: NotesTTSResponse };
'notes/tts': { req: NotesTtsRequest; res: NotesTtsResponse };
'notes/unrenote': { req: NotesUnrenoteRequest; res: EmptyResponse };
'notes/user-list-timeline': { req: NotesUserListTimelineRequest; res: NotesUserListTimelineResponse };
'notifications/create': { req: NotificationsCreateRequest; res: EmptyResponse };

View File

@ -453,8 +453,8 @@ export type NotesTimelineRequest = operations['notes___timeline']['requestBody']
export type NotesTimelineResponse = operations['notes___timeline']['responses']['200']['content']['application/json'];
export type NotesTranslateRequest = operations['notes___translate']['requestBody']['content']['application/json'];
export type NotesTranslateResponse = operations['notes___translate']['responses']['200']['content']['application/json'];
export type NotesTTSRequest = operations['notes___tts']['requestBody']['content']['application/json'];
export type NotesTTSResponse = unknown;
export type NotesTtsRequest = operations['notes___tts']['requestBody']['content']['application/json'];
export type NotesTtsResponse = operations['notes___tts']['responses']['200']['content']['application/json'];
export type NotesUnrenoteRequest = operations['notes___unrenote']['requestBody']['content']['application/json'];
export type NotesUserListTimelineRequest = operations['notes___user-list-timeline']['requestBody']['content']['application/json'];
export type NotesUserListTimelineResponse = operations['notes___user-list-timeline']['responses']['200']['content']['application/json'];

View File

@ -3745,6 +3745,7 @@ export type components = {
}[];
isBot?: boolean;
isCat?: boolean;
isVI?: boolean;
instance?: {
name: string | null;
softwareName: string | null;
@ -4777,7 +4778,7 @@ export type components = {
RoleCondFormulaValueUserSettingBooleanSchema: {
id: string;
/** @enum {string} */
type: 'isSuspended' | 'isLocked' | 'isBot' | 'isCat' | 'isExplorable';
type: 'isSuspended' | 'isLocked' | 'isBot' | 'isCat' | 'isVI' | 'isExplorable';
};
RoleCondFormulaValueAssignedRole: {
id: string;
@ -5010,7 +5011,7 @@ export type components = {
enableEmail: boolean;
enableServiceWorker: boolean;
translatorAvailable: boolean;
TTSAvailable: boolean;
ttsAvailable: boolean;
mediaProxy: string;
enableUrlPreview: boolean;
backgroundImageUrl: string | null;
@ -5126,7 +5127,7 @@ export type operations = {
enableEmail: boolean;
enableServiceWorker: boolean;
translatorAvailable: boolean;
TTSAvailable: boolean;
ttsAvailable: boolean;
silencedHosts?: string[];
mediaSilencedHosts: string[];
pinnedUsers: string[];
@ -9516,6 +9517,27 @@ export type operations = {
langs?: string[];
deeplAuthKey?: string | null;
deeplIsPro?: boolean;
hfAuthKey?: string | null;
/** @default false */
hfSpace?: boolean;
hfSpaceName?: string | null;
hfexampleAudioURL?: string | null;
hfexampleText?: string | null;
hfexampleLang?: string | null;
/** @default Slice once every 4 sentences */
hfslice?: string | null;
/** @default 15 */
hftopK?: number;
/** @default 100 */
hftopP?: number;
/** @default 100 */
hfTemperature?: number;
/** @default false */
hfnrm?: boolean;
/** @default 125 */
hfSpeedRate?: number;
/** @default false */
hfdas?: boolean;
enableEmail?: boolean;
email?: string | null;
smtpSecure?: boolean;
@ -19851,6 +19873,7 @@ export type operations = {
preventAiLearning?: boolean;
isBot?: boolean;
isCat?: boolean;
isVI?: boolean;
injectFeaturedNote?: boolean;
receiveAnnouncementEmail?: boolean;
alwaysMarkNsfw?: boolean;
@ -23031,9 +23054,7 @@ export type operations = {
/** @description OK (with results) */
200: {
content: {
'audio/flac': {
blob: Blob;
};
'application/json': string;
};
};
/** @description OK (without any results) */