2026-05-20 22:43:31 +08:00
|
|
|
import { agentService } from '@/services/agent/agent'
|
|
|
|
|
import type { AutofillField } from '@/agent'
|
2026-05-19 16:05:09 +08:00
|
|
|
|
|
|
|
|
export interface AutofillAiParams {
|
|
|
|
|
teamId: string
|
|
|
|
|
images: string[]
|
|
|
|
|
fields: AutofillField[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function autofillAiActivity(params: AutofillAiParams) {
|
|
|
|
|
const prompt = 'Analyze the provided images and extract metadata.'
|
2026-05-20 22:43:31 +08:00
|
|
|
return agentService.autofill(params.teamId, prompt, params.images, params.fields)
|
2026-05-19 16:05:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface AiChatParams {
|
|
|
|
|
teamId: string
|
|
|
|
|
agentId: string
|
|
|
|
|
message: string
|
|
|
|
|
imageUrls: string[]
|
|
|
|
|
projectId: string
|
|
|
|
|
folderId: string
|
|
|
|
|
agentsInstruction?: string
|
2026-05-22 09:49:22 +08:00
|
|
|
sessionId: string
|
2026-05-19 16:05:09 +08:00
|
|
|
userId?: string
|
2026-05-21 22:51:40 +08:00
|
|
|
explicitMention?: boolean
|
2026-05-19 16:05:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function aiChatActivity(params: AiChatParams) {
|
|
|
|
|
const cleanMessage = params.message.replace(/<@[A-Z0-9]+>/g, '').trim()
|
2026-05-22 09:49:22 +08:00
|
|
|
const sessionId = params.sessionId
|
2026-05-21 22:51:40 +08:00
|
|
|
|
2026-05-20 22:43:31 +08:00
|
|
|
return agentService.chatWithAgent(
|
2026-05-19 16:05:09 +08:00
|
|
|
params.teamId,
|
|
|
|
|
params.agentId,
|
|
|
|
|
cleanMessage,
|
|
|
|
|
params.imageUrls,
|
|
|
|
|
params.agentsInstruction || '',
|
2026-05-21 22:51:40 +08:00
|
|
|
sessionId,
|
2026-05-19 16:05:09 +08:00
|
|
|
params.userId,
|
|
|
|
|
)
|
|
|
|
|
}
|