mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 22:14:50 +00:00
feat(video): generate transcripts with the local embedding server
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
-- AlterEnum
|
||||
ALTER TYPE "WorkflowTaskType" ADD VALUE 'ai_transcription';
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "asset_transcripts" (
|
||||
"id" TEXT NOT NULL,
|
||||
"asset_id" TEXT NOT NULL,
|
||||
"language" TEXT NOT NULL,
|
||||
"model" TEXT NOT NULL,
|
||||
"workflow_task_id" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "asset_transcripts_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "asset_transcript_segments" (
|
||||
"id" TEXT NOT NULL,
|
||||
"transcript_id" TEXT NOT NULL,
|
||||
"position" INTEGER NOT NULL,
|
||||
"start_ms" INTEGER NOT NULL,
|
||||
"end_ms" INTEGER NOT NULL,
|
||||
"text" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "asset_transcript_segments_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "asset_transcripts_asset_id_language_key" ON "asset_transcripts"("asset_id", "language");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "asset_transcript_segments_transcript_id_position_key" ON "asset_transcript_segments"("transcript_id", "position");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_transcripts" ADD CONSTRAINT "asset_transcripts_asset_id_fkey" FOREIGN KEY ("asset_id") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_transcript_segments" ADD CONSTRAINT "asset_transcript_segments_transcript_id_fkey" FOREIGN KEY ("transcript_id") REFERENCES "asset_transcripts"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -129,6 +129,7 @@ enum WorkflowTaskType {
|
||||
ai_metadata_autofill
|
||||
chat
|
||||
ai_embedding
|
||||
ai_transcription
|
||||
query_embedding_for_search
|
||||
agent_tool_call // @deprecated: Agent tools now execute directly in-process via Core services
|
||||
kanban_agent_run
|
||||
@@ -619,6 +620,7 @@ model Asset {
|
||||
commentAttachments AssetCommentAttachment[] @relation("AssetToCommentAttachment")
|
||||
notifications Notification[] @relation("AssetToNotification")
|
||||
embeddings AssetEmbedding[] @relation("AssetToEmbedding")
|
||||
transcripts AssetTranscript[]
|
||||
|
||||
teamRootFolder Team? @relation("TeamToRootFolder")
|
||||
projectRootFolder Project? @relation("ProjectToRootFolder")
|
||||
@@ -775,6 +777,34 @@ model AssetEmbedding {
|
||||
@@map("asset_embeddings")
|
||||
}
|
||||
|
||||
model AssetTranscript {
|
||||
id String @id @default(ulid())
|
||||
assetId String @map("asset_id")
|
||||
asset Asset @relation(fields: [assetId], references: [id], onDelete: Cascade)
|
||||
language String
|
||||
model String
|
||||
workflowTaskId String @map("workflow_task_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
segments AssetTranscriptSegment[]
|
||||
|
||||
@@unique([assetId, language], name: "assetIdLanguage")
|
||||
@@map("asset_transcripts")
|
||||
}
|
||||
|
||||
model AssetTranscriptSegment {
|
||||
id String @id @default(ulid())
|
||||
transcriptId String @map("transcript_id")
|
||||
transcript AssetTranscript @relation(fields: [transcriptId], references: [id], onDelete: Cascade)
|
||||
position Int
|
||||
startMs Int @map("start_ms")
|
||||
endMs Int @map("end_ms")
|
||||
text String @db.Text
|
||||
|
||||
@@unique([transcriptId, position], name: "transcriptIdPosition")
|
||||
@@map("asset_transcript_segments")
|
||||
}
|
||||
|
||||
model Invite {
|
||||
id String @id @default(ulid())
|
||||
code String @unique
|
||||
|
||||
+10
@@ -137,6 +137,16 @@ export type AssetCommentReaction = Prisma.AssetCommentReactionModel
|
||||
*
|
||||
*/
|
||||
export type AssetEmbedding = Prisma.AssetEmbeddingModel
|
||||
/**
|
||||
* Model AssetTranscript
|
||||
*
|
||||
*/
|
||||
export type AssetTranscript = Prisma.AssetTranscriptModel
|
||||
/**
|
||||
* Model AssetTranscriptSegment
|
||||
*
|
||||
*/
|
||||
export type AssetTranscriptSegment = Prisma.AssetTranscriptSegmentModel
|
||||
/**
|
||||
* Model Invite
|
||||
*
|
||||
|
||||
+10
@@ -161,6 +161,16 @@ export type AssetCommentReaction = Prisma.AssetCommentReactionModel
|
||||
*
|
||||
*/
|
||||
export type AssetEmbedding = Prisma.AssetEmbeddingModel
|
||||
/**
|
||||
* Model AssetTranscript
|
||||
*
|
||||
*/
|
||||
export type AssetTranscript = Prisma.AssetTranscriptModel
|
||||
/**
|
||||
* Model AssetTranscriptSegment
|
||||
*
|
||||
*/
|
||||
export type AssetTranscriptSegment = Prisma.AssetTranscriptSegmentModel
|
||||
/**
|
||||
* Model Invite
|
||||
*
|
||||
|
||||
+1
@@ -158,6 +158,7 @@ export const WorkflowTaskType = {
|
||||
ai_metadata_autofill: 'ai_metadata_autofill',
|
||||
chat: 'chat',
|
||||
ai_embedding: 'ai_embedding',
|
||||
ai_transcription: 'ai_transcription',
|
||||
query_embedding_for_search: 'query_embedding_for_search',
|
||||
agent_tool_call: 'agent_tool_call',
|
||||
kanban_agent_run: 'kanban_agent_run',
|
||||
|
||||
+24
-4
File diff suppressed because one or more lines are too long
+178
-1
@@ -421,6 +421,8 @@ export const ModelName = {
|
||||
AssetCommentAttachment: 'AssetCommentAttachment',
|
||||
AssetCommentReaction: 'AssetCommentReaction',
|
||||
AssetEmbedding: 'AssetEmbedding',
|
||||
AssetTranscript: 'AssetTranscript',
|
||||
AssetTranscriptSegment: 'AssetTranscriptSegment',
|
||||
Invite: 'Invite',
|
||||
MetadataField: 'MetadataField',
|
||||
Notification: 'Notification',
|
||||
@@ -474,7 +476,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "runner" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "shareActivity" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionCommit" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "runner" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "shareActivity" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "assetTranscript" | "assetTranscriptSegment" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionCommit" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -2254,6 +2256,154 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
AssetTranscript: {
|
||||
payload: Prisma.$AssetTranscriptPayload<ExtArgs>
|
||||
fields: Prisma.AssetTranscriptFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.AssetTranscriptFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.AssetTranscriptFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.AssetTranscriptFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.AssetTranscriptFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.AssetTranscriptFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.AssetTranscriptCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.AssetTranscriptCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.AssetTranscriptCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.AssetTranscriptDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.AssetTranscriptUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.AssetTranscriptDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.AssetTranscriptUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.AssetTranscriptUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.AssetTranscriptUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.AssetTranscriptAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateAssetTranscript>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.AssetTranscriptGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AssetTranscriptGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.AssetTranscriptCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AssetTranscriptCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
AssetTranscriptSegment: {
|
||||
payload: Prisma.$AssetTranscriptSegmentPayload<ExtArgs>
|
||||
fields: Prisma.AssetTranscriptSegmentFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.AssetTranscriptSegmentFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.AssetTranscriptSegmentFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.AssetTranscriptSegmentFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.AssetTranscriptSegmentFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.AssetTranscriptSegmentFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.AssetTranscriptSegmentCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.AssetTranscriptSegmentCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.AssetTranscriptSegmentCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.AssetTranscriptSegmentDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.AssetTranscriptSegmentUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.AssetTranscriptSegmentDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.AssetTranscriptSegmentUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.AssetTranscriptSegmentUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.AssetTranscriptSegmentUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AssetTranscriptSegmentPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.AssetTranscriptSegmentAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateAssetTranscriptSegment>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.AssetTranscriptSegmentGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AssetTranscriptSegmentGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.AssetTranscriptSegmentCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AssetTranscriptSegmentCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
Invite: {
|
||||
payload: Prisma.$InvitePayload<ExtArgs>
|
||||
fields: Prisma.InviteFieldRefs
|
||||
@@ -5455,6 +5605,31 @@ export const AssetEmbeddingScalarFieldEnum = {
|
||||
export type AssetEmbeddingScalarFieldEnum = (typeof AssetEmbeddingScalarFieldEnum)[keyof typeof AssetEmbeddingScalarFieldEnum]
|
||||
|
||||
|
||||
export const AssetTranscriptScalarFieldEnum = {
|
||||
id: 'id',
|
||||
assetId: 'assetId',
|
||||
language: 'language',
|
||||
model: 'model',
|
||||
workflowTaskId: 'workflowTaskId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type AssetTranscriptScalarFieldEnum = (typeof AssetTranscriptScalarFieldEnum)[keyof typeof AssetTranscriptScalarFieldEnum]
|
||||
|
||||
|
||||
export const AssetTranscriptSegmentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
transcriptId: 'transcriptId',
|
||||
position: 'position',
|
||||
startMs: 'startMs',
|
||||
endMs: 'endMs',
|
||||
text: 'text'
|
||||
} as const
|
||||
|
||||
export type AssetTranscriptSegmentScalarFieldEnum = (typeof AssetTranscriptSegmentScalarFieldEnum)[keyof typeof AssetTranscriptSegmentScalarFieldEnum]
|
||||
|
||||
|
||||
export const InviteScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
@@ -6747,6 +6922,8 @@ export type GlobalOmitConfig = {
|
||||
assetCommentAttachment?: Prisma.AssetCommentAttachmentOmit
|
||||
assetCommentReaction?: Prisma.AssetCommentReactionOmit
|
||||
assetEmbedding?: Prisma.AssetEmbeddingOmit
|
||||
assetTranscript?: Prisma.AssetTranscriptOmit
|
||||
assetTranscriptSegment?: Prisma.AssetTranscriptSegmentOmit
|
||||
invite?: Prisma.InviteOmit
|
||||
metadataField?: Prisma.MetadataFieldOmit
|
||||
notification?: Prisma.NotificationOmit
|
||||
|
||||
@@ -75,6 +75,8 @@ export const ModelName = {
|
||||
AssetCommentAttachment: 'AssetCommentAttachment',
|
||||
AssetCommentReaction: 'AssetCommentReaction',
|
||||
AssetEmbedding: 'AssetEmbedding',
|
||||
AssetTranscript: 'AssetTranscript',
|
||||
AssetTranscriptSegment: 'AssetTranscriptSegment',
|
||||
Invite: 'Invite',
|
||||
MetadataField: 'MetadataField',
|
||||
Notification: 'Notification',
|
||||
@@ -481,6 +483,31 @@ export const AssetEmbeddingScalarFieldEnum = {
|
||||
export type AssetEmbeddingScalarFieldEnum = (typeof AssetEmbeddingScalarFieldEnum)[keyof typeof AssetEmbeddingScalarFieldEnum]
|
||||
|
||||
|
||||
export const AssetTranscriptScalarFieldEnum = {
|
||||
id: 'id',
|
||||
assetId: 'assetId',
|
||||
language: 'language',
|
||||
model: 'model',
|
||||
workflowTaskId: 'workflowTaskId',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type AssetTranscriptScalarFieldEnum = (typeof AssetTranscriptScalarFieldEnum)[keyof typeof AssetTranscriptScalarFieldEnum]
|
||||
|
||||
|
||||
export const AssetTranscriptSegmentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
transcriptId: 'transcriptId',
|
||||
position: 'position',
|
||||
startMs: 'startMs',
|
||||
endMs: 'endMs',
|
||||
text: 'text'
|
||||
} as const
|
||||
|
||||
export type AssetTranscriptSegmentScalarFieldEnum = (typeof AssetTranscriptSegmentScalarFieldEnum)[keyof typeof AssetTranscriptSegmentScalarFieldEnum]
|
||||
|
||||
|
||||
export const InviteScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
|
||||
+2
@@ -32,6 +32,8 @@ export type * from './models/AssetComment.ts'
|
||||
export type * from './models/AssetCommentAttachment.ts'
|
||||
export type * from './models/AssetCommentReaction.ts'
|
||||
export type * from './models/AssetEmbedding.ts'
|
||||
export type * from './models/AssetTranscript.ts'
|
||||
export type * from './models/AssetTranscriptSegment.ts'
|
||||
export type * from './models/Invite.ts'
|
||||
export type * from './models/MetadataField.ts'
|
||||
export type * from './models/Notification.ts'
|
||||
|
||||
+346
File diff suppressed because it is too large
Load Diff
+1568
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,10 @@ export function registerWorkflowTrigger(cb: WorkflowTriggerCallback) {
|
||||
onWorkflowTaskCreated = cb
|
||||
}
|
||||
|
||||
export async function notifyWorkflowTaskCreated(task: WorkflowTask): Promise<void> {
|
||||
if (task.status === 'pending') await onWorkflowTaskCreated?.(task)
|
||||
}
|
||||
|
||||
// Global callback for workflow task cancellation (decouples db/core packages from workflow engine)
|
||||
type WorkflowCancelCallback = (taskId: string) => Promise<void>
|
||||
let onWorkflowTaskCancelled: WorkflowCancelCallback | null = null
|
||||
@@ -149,9 +153,7 @@ function createPrismaClient() {
|
||||
workflowTask: {
|
||||
async create({ args, query }) {
|
||||
const result = await query(args)
|
||||
if (onWorkflowTaskCreated && (result as WorkflowTask).status === 'pending') {
|
||||
onWorkflowTaskCreated(result as WorkflowTask).catch(console.error)
|
||||
}
|
||||
notifyWorkflowTaskCreated(result as WorkflowTask).catch(console.error)
|
||||
return result
|
||||
},
|
||||
},
|
||||
|
||||
@@ -377,6 +377,7 @@ declare global {
|
||||
imageAnnotation?: ImageAnnotationSpec
|
||||
pdfPages?: PdfPagesSpec
|
||||
videoChunks?: VideoChunksSpec
|
||||
transcription?: { language: string | null; model: string }
|
||||
/** Render that produced this result, if any (set by the read_asset pipeline). */
|
||||
assetRead?: AssetReadRequest
|
||||
watermark?: WatermarkTaskPayload
|
||||
@@ -403,6 +404,7 @@ declare global {
|
||||
|
||||
export interface WorkflowTaskOutput {
|
||||
error?: string
|
||||
transcription?: { transcriptId: string; language: string } | { noSpeech: true }
|
||||
recoveryAttempts?: number
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user