mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat(server): audio transcription (#10733)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
mutation submitAudioTranscription($workspaceId: String!, $blobId: String!, $blob: Upload!) {
|
||||
submitAudioTranscription(blob: $blob, blobId: $blobId, workspaceId: $workspaceId) {
|
||||
id
|
||||
status
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
mutation claimAudioTranscription($jobId: String!) {
|
||||
claimAudioTranscription(jobId: $jobId) {
|
||||
id
|
||||
status
|
||||
transcription {
|
||||
speaker
|
||||
start
|
||||
end
|
||||
transcription
|
||||
}
|
||||
summary
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
query getAudioTranscription(
|
||||
$workspaceId: String!
|
||||
$jobId: String!
|
||||
) {
|
||||
currentUser {
|
||||
copilot(workspaceId: $workspaceId) {
|
||||
audioTranscription(jobId: $jobId) {
|
||||
id
|
||||
status
|
||||
transcription {
|
||||
speaker
|
||||
start
|
||||
end
|
||||
transcription
|
||||
}
|
||||
summary
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,6 +349,62 @@ export const getCopilotHistoriesQuery = {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const submitAudioTranscriptionMutation = {
|
||||
id: 'submitAudioTranscriptionMutation' as const,
|
||||
op: 'submitAudioTranscription',
|
||||
query: `mutation submitAudioTranscription($workspaceId: String!, $blobId: String!, $blob: Upload!) {
|
||||
submitAudioTranscription(
|
||||
blob: $blob
|
||||
blobId: $blobId
|
||||
workspaceId: $workspaceId
|
||||
) {
|
||||
id
|
||||
status
|
||||
}
|
||||
}`,
|
||||
file: true,
|
||||
};
|
||||
|
||||
export const claimAudioTranscriptionMutation = {
|
||||
id: 'claimAudioTranscriptionMutation' as const,
|
||||
op: 'claimAudioTranscription',
|
||||
query: `mutation claimAudioTranscription($jobId: String!) {
|
||||
claimAudioTranscription(jobId: $jobId) {
|
||||
id
|
||||
status
|
||||
transcription {
|
||||
speaker
|
||||
start
|
||||
end
|
||||
transcription
|
||||
}
|
||||
summary
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const getAudioTranscriptionQuery = {
|
||||
id: 'getAudioTranscriptionQuery' as const,
|
||||
op: 'getAudioTranscription',
|
||||
query: `query getAudioTranscription($workspaceId: String!, $jobId: String!) {
|
||||
currentUser {
|
||||
copilot(workspaceId: $workspaceId) {
|
||||
audioTranscription(jobId: $jobId) {
|
||||
id
|
||||
status
|
||||
transcription {
|
||||
speaker
|
||||
start
|
||||
end
|
||||
transcription
|
||||
}
|
||||
summary
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const createCopilotMessageMutation = {
|
||||
id: 'createCopilotMessageMutation' as const,
|
||||
op: 'createCopilotMessage',
|
||||
|
||||
@@ -53,6 +53,14 @@ export interface AddRemoveContextCategoryInput {
|
||||
type: ContextCategories;
|
||||
}
|
||||
|
||||
export enum AiJobStatus {
|
||||
claimed = 'claimed',
|
||||
failed = 'failed',
|
||||
finished = 'finished',
|
||||
pending = 'pending',
|
||||
running = 'running',
|
||||
}
|
||||
|
||||
export interface AlreadyInSpaceDataType {
|
||||
__typename?: 'AlreadyInSpaceDataType';
|
||||
spaceId: Scalars['String']['output'];
|
||||
@@ -114,6 +122,7 @@ export interface ContextWorkspaceEmbeddingStatus {
|
||||
|
||||
export interface Copilot {
|
||||
__typename?: 'Copilot';
|
||||
audioTranscription: Array<TranscriptionResultType>;
|
||||
/** Get the context list of a session */
|
||||
contexts: Array<CopilotContext>;
|
||||
histories: Array<CopilotHistories>;
|
||||
@@ -129,6 +138,10 @@ export interface Copilot {
|
||||
workspaceId: Maybe<Scalars['ID']['output']>;
|
||||
}
|
||||
|
||||
export interface CopilotAudioTranscriptionArgs {
|
||||
jobId?: InputMaybe<Scalars['String']['input']>;
|
||||
}
|
||||
|
||||
export interface CopilotContextsArgs {
|
||||
contextId?: InputMaybe<Scalars['String']['input']>;
|
||||
sessionId?: InputMaybe<Scalars['String']['input']>;
|
||||
@@ -550,6 +563,7 @@ export enum ErrorNames {
|
||||
COPILOT_QUOTA_EXCEEDED = 'COPILOT_QUOTA_EXCEEDED',
|
||||
COPILOT_SESSION_DELETED = 'COPILOT_SESSION_DELETED',
|
||||
COPILOT_SESSION_NOT_FOUND = 'COPILOT_SESSION_NOT_FOUND',
|
||||
COPILOT_TRANSCRIPTION_JOB_EXISTS = 'COPILOT_TRANSCRIPTION_JOB_EXISTS',
|
||||
CUSTOMER_PORTAL_CREATE_FAILED = 'CUSTOMER_PORTAL_CREATE_FAILED',
|
||||
DOC_ACTION_DENIED = 'DOC_ACTION_DENIED',
|
||||
DOC_DEFAULT_ROLE_CAN_NOT_BE_OWNER = 'DOC_DEFAULT_ROLE_CAN_NOT_BE_OWNER',
|
||||
@@ -977,6 +991,7 @@ export interface Mutation {
|
||||
cancelSubscription: SubscriptionType;
|
||||
changeEmail: UserType;
|
||||
changePassword: Scalars['Boolean']['output'];
|
||||
claimAudioTranscription: Maybe<TranscriptionResultType>;
|
||||
/** Cleanup sessions */
|
||||
cleanupCopilotSession: Array<Scalars['String']['output']>;
|
||||
/** Create change password url */
|
||||
@@ -1050,6 +1065,7 @@ export interface Mutation {
|
||||
sendVerifyChangeEmail: Scalars['Boolean']['output'];
|
||||
sendVerifyEmail: Scalars['Boolean']['output'];
|
||||
setBlob: Scalars['String']['output'];
|
||||
submitAudioTranscription: Maybe<TranscriptionResultType>;
|
||||
/** Update a copilot prompt */
|
||||
updateCopilotPrompt: CopilotPromptType;
|
||||
/** Update a chat session */
|
||||
@@ -1130,6 +1146,10 @@ export interface MutationChangePasswordArgs {
|
||||
userId?: InputMaybe<Scalars['String']['input']>;
|
||||
}
|
||||
|
||||
export interface MutationClaimAudioTranscriptionArgs {
|
||||
jobId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationCleanupCopilotSessionArgs {
|
||||
options: DeleteSessionInput;
|
||||
}
|
||||
@@ -1352,6 +1372,12 @@ export interface MutationSetBlobArgs {
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationSubmitAudioTranscriptionArgs {
|
||||
blob: Scalars['Upload']['input'];
|
||||
blobId: Scalars['String']['input'];
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationUpdateCopilotPromptArgs {
|
||||
messages: Array<CopilotPromptMessageInput>;
|
||||
name: Scalars['String']['input'];
|
||||
@@ -1878,6 +1904,22 @@ export enum SubscriptionVariant {
|
||||
Onetime = 'Onetime',
|
||||
}
|
||||
|
||||
export interface TranscriptionItemType {
|
||||
__typename?: 'TranscriptionItemType';
|
||||
end: Scalars['String']['output'];
|
||||
speaker: Scalars['String']['output'];
|
||||
start: Scalars['String']['output'];
|
||||
transcription: Scalars['String']['output'];
|
||||
}
|
||||
|
||||
export interface TranscriptionResultType {
|
||||
__typename?: 'TranscriptionResultType';
|
||||
id: Scalars['ID']['output'];
|
||||
status: AiJobStatus;
|
||||
summary: Maybe<Scalars['String']['output']>;
|
||||
transcription: Maybe<Array<TranscriptionItemType>>;
|
||||
}
|
||||
|
||||
export type UnionNotificationBodyType =
|
||||
| InvitationAcceptedNotificationBodyType
|
||||
| InvitationBlockedNotificationBodyType
|
||||
@@ -2651,6 +2693,70 @@ export type GetCopilotHistoriesQuery = {
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type SubmitAudioTranscriptionMutationVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
blobId: Scalars['String']['input'];
|
||||
blob: Scalars['Upload']['input'];
|
||||
}>;
|
||||
|
||||
export type SubmitAudioTranscriptionMutation = {
|
||||
__typename?: 'Mutation';
|
||||
submitAudioTranscription: {
|
||||
__typename?: 'TranscriptionResultType';
|
||||
id: string;
|
||||
status: AiJobStatus;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type ClaimAudioTranscriptionMutationVariables = Exact<{
|
||||
jobId: Scalars['String']['input'];
|
||||
}>;
|
||||
|
||||
export type ClaimAudioTranscriptionMutation = {
|
||||
__typename?: 'Mutation';
|
||||
claimAudioTranscription: {
|
||||
__typename?: 'TranscriptionResultType';
|
||||
id: string;
|
||||
status: AiJobStatus;
|
||||
summary: string | null;
|
||||
transcription: Array<{
|
||||
__typename?: 'TranscriptionItemType';
|
||||
speaker: string;
|
||||
start: string;
|
||||
end: string;
|
||||
transcription: string;
|
||||
}> | null;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type GetAudioTranscriptionQueryVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
jobId: Scalars['String']['input'];
|
||||
}>;
|
||||
|
||||
export type GetAudioTranscriptionQuery = {
|
||||
__typename?: 'Query';
|
||||
currentUser: {
|
||||
__typename?: 'UserType';
|
||||
copilot: {
|
||||
__typename?: 'Copilot';
|
||||
audioTranscription: Array<{
|
||||
__typename?: 'TranscriptionResultType';
|
||||
id: string;
|
||||
status: AiJobStatus;
|
||||
summary: string | null;
|
||||
transcription: Array<{
|
||||
__typename?: 'TranscriptionItemType';
|
||||
speaker: string;
|
||||
start: string;
|
||||
end: string;
|
||||
transcription: string;
|
||||
}> | null;
|
||||
}>;
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type CreateCopilotMessageMutationVariables = Exact<{
|
||||
options: CreateChatMessageInput;
|
||||
}>;
|
||||
@@ -4153,6 +4259,11 @@ export type Queries =
|
||||
variables: GetCopilotHistoriesQueryVariables;
|
||||
response: GetCopilotHistoriesQuery;
|
||||
}
|
||||
| {
|
||||
name: 'getAudioTranscriptionQuery';
|
||||
variables: GetAudioTranscriptionQueryVariables;
|
||||
response: GetAudioTranscriptionQuery;
|
||||
}
|
||||
| {
|
||||
name: 'getPromptsQuery';
|
||||
variables: GetPromptsQueryVariables;
|
||||
@@ -4460,6 +4571,16 @@ export type Mutations =
|
||||
variables: QueueWorkspaceEmbeddingMutationVariables;
|
||||
response: QueueWorkspaceEmbeddingMutation;
|
||||
}
|
||||
| {
|
||||
name: 'submitAudioTranscriptionMutation';
|
||||
variables: SubmitAudioTranscriptionMutationVariables;
|
||||
response: SubmitAudioTranscriptionMutation;
|
||||
}
|
||||
| {
|
||||
name: 'claimAudioTranscriptionMutation';
|
||||
variables: ClaimAudioTranscriptionMutationVariables;
|
||||
response: ClaimAudioTranscriptionMutation;
|
||||
}
|
||||
| {
|
||||
name: 'createCopilotMessageMutation';
|
||||
variables: CreateCopilotMessageMutationVariables;
|
||||
|
||||
Reference in New Issue
Block a user