feat(agent): replace isAi with sessionId & implement admin logs UI

This commit is contained in:
yiling
2026-05-21 14:58:31 +08:00
parent 2a4594d986
commit 161ba3a466
24 changed files with 781 additions and 91 deletions
+10 -2
View File
@@ -421,7 +421,7 @@ export class AgentService {
prompt: string,
images: string[],
fields: AutofillField[],
): Promise<{ text: string; usage: Usage }> {
): Promise<{ text: string; usage: Usage; sessionId: string }> {
const agent = await this.prismaClient.agent.findFirst({
where: {
type: 'autofill',
@@ -457,7 +457,7 @@ export class AgentService {
const fullPrompt = `${prompt}\n\nPlease use the "autofill_metadata" tool to provide the extracted metadata.`
const { usage } = await this.chatWithAgent(
const { usage, sessionId } = await this.chatWithAgent(
teamId,
agent.id,
fullPrompt,
@@ -471,8 +471,16 @@ export class AgentService {
return {
text: capturedData ? JSON.stringify(capturedData) : '{}',
usage,
sessionId,
}
}
async getSessionEntries(params: { sessionId: string }) {
return this.prismaClient.agentSessionEntry.findMany({
where: { sessionId: params.sessionId },
orderBy: { id: 'asc' },
})
}
}
export const agentService = new AgentService()