mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 17:37:39 +00:00
refactor(agent): prevent creating autofill and embedding tasks for audio assets
This commit is contained in:
@@ -582,23 +582,25 @@ export interface CreateEmbeddingTaskIfEnabledParams {
|
||||
export async function createEmbeddingTaskIfEnabledActivity(
|
||||
params: CreateEmbeddingTaskIfEnabledParams,
|
||||
): Promise<void> {
|
||||
let teamId = params.teamId
|
||||
let projectId = params.projectId
|
||||
|
||||
// Resolve teamId and projectId from asset if missing
|
||||
if (!teamId || !projectId) {
|
||||
const asset = await prisma.asset.findUnique({
|
||||
where: { id: params.assetId },
|
||||
include: {
|
||||
project: true,
|
||||
},
|
||||
})
|
||||
if (asset) {
|
||||
projectId = projectId || asset.projectId
|
||||
teamId = teamId || asset.project?.teamId || null
|
||||
}
|
||||
const asset = await prisma.asset.findUnique({
|
||||
where: { id: params.assetId },
|
||||
include: {
|
||||
project: true,
|
||||
},
|
||||
})
|
||||
if (!asset) {
|
||||
return
|
||||
}
|
||||
|
||||
const isVideo = asset.mediaType?.startsWith('video/')
|
||||
const isImage = asset.mediaType?.startsWith('image/')
|
||||
if (!isVideo && !isImage) {
|
||||
return
|
||||
}
|
||||
|
||||
const teamId = params.teamId || asset.project?.teamId || null
|
||||
const projectId = params.projectId || asset.projectId
|
||||
|
||||
if (!teamId) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user