mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 14:49:04 +00:00
feat(chat): add chatbot session name generation
This commit is contained in:
@@ -15,6 +15,8 @@ import {
|
||||
updateAssetMetadataActivity,
|
||||
getAssetPathContextActivity,
|
||||
executeAgentToolActivity,
|
||||
generateSessionNameActivity,
|
||||
type GenerateSessionNameParams,
|
||||
} from './agent'
|
||||
import * as piAgent from '../index'
|
||||
import { type AgentHarness, type Session } from '@earendil-works/pi-agent-core'
|
||||
@@ -741,4 +743,176 @@ describe('Agent Database Activities Integration', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('generateSessionNameActivity', () => {
|
||||
it('should generate and save session name for chat sessions', async () => {
|
||||
await prisma.team.create({
|
||||
data: { id: 't1', name: 'Test Team' },
|
||||
})
|
||||
const user = await prisma.user.create({
|
||||
data: { id: 'u1', name: 'Test User', email: 'u1@test.com' },
|
||||
})
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
id: 'agent-123',
|
||||
name: 'Chat Agent User',
|
||||
email: 'agent@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
const agent = await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: 't1',
|
||||
type: 'chat',
|
||||
config: { provider: 'openai', model: 'gpt-4' },
|
||||
},
|
||||
})
|
||||
await prisma.agentSession.create({
|
||||
data: {
|
||||
id: 'session-123',
|
||||
agentId: 'agent-123',
|
||||
userId: user.id,
|
||||
cwd: process.cwd(),
|
||||
type: 'chat',
|
||||
name: null,
|
||||
},
|
||||
})
|
||||
|
||||
const mockHarness = {
|
||||
prompt: vi.fn().mockResolvedValue({
|
||||
content: [{ type: 'text', text: ' "Summarized Chat Title" ' }],
|
||||
}),
|
||||
}
|
||||
vi.mocked(piAgent.createAgentSession).mockResolvedValue({
|
||||
session: {} as unknown as Session<DatabaseSessionMetadata>,
|
||||
harness: mockHarness as unknown as AgentHarness,
|
||||
})
|
||||
|
||||
await generateSessionNameActivity({
|
||||
teamId: 't1',
|
||||
agentId: 'agent-123',
|
||||
prompt: 'hello world prompt',
|
||||
sessionId: 'session-123',
|
||||
context: {
|
||||
agent: {
|
||||
...agent,
|
||||
provider: { name: 'openai' },
|
||||
modelRef: {
|
||||
id: 'm1',
|
||||
providerName: 'openai',
|
||||
modelId: 'gpt-4',
|
||||
name: 'GPT-4',
|
||||
config: {},
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
} as unknown as GenerateSessionNameParams['context']['agent'],
|
||||
dbProviders: [
|
||||
{
|
||||
name: 'openai',
|
||||
config: { api: 'openai-responses', apiKey: 'fake-key' },
|
||||
models: [
|
||||
{
|
||||
modelId: 'gpt-4',
|
||||
name: 'GPT-4',
|
||||
config: {
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
contextWindow: 4096,
|
||||
maxTokens: 4096,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
const updatedSession = await prisma.agentSession.findUnique({
|
||||
where: { id: 'session-123' },
|
||||
})
|
||||
|
||||
expect(updatedSession?.name).toBe('Summarized Chat Title')
|
||||
expect(mockHarness.prompt).toHaveBeenCalledWith('hello world prompt')
|
||||
|
||||
// Verify that transient naming session was cleaned up (deleted)
|
||||
const namingSessions = await prisma.agentSession.findMany({
|
||||
where: { type: 'naming' },
|
||||
})
|
||||
expect(namingSessions).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('should skip name generation for comment sessions or if name is already set', async () => {
|
||||
await prisma.team.create({
|
||||
data: { id: 't1', name: 'Test Team' },
|
||||
})
|
||||
const user = await prisma.user.create({
|
||||
data: { id: 'u1', name: 'Test User', email: 'u1@test.com' },
|
||||
})
|
||||
const agentUser = await prisma.user.create({
|
||||
data: {
|
||||
id: 'agent-123',
|
||||
name: 'Chat Agent User',
|
||||
email: 'agent2@shumai.ai',
|
||||
type: 'agent',
|
||||
},
|
||||
})
|
||||
await prisma.agent.create({
|
||||
data: {
|
||||
id: agentUser.id,
|
||||
teamId: 't1',
|
||||
type: 'chat',
|
||||
config: { provider: 'openai', model: 'gpt-4' },
|
||||
},
|
||||
})
|
||||
await prisma.agentSession.create({
|
||||
data: {
|
||||
id: 'session-comment',
|
||||
agentId: 'agent-123',
|
||||
userId: user.id,
|
||||
cwd: process.cwd(),
|
||||
type: 'comment',
|
||||
name: null,
|
||||
},
|
||||
})
|
||||
await prisma.agentSession.create({
|
||||
data: {
|
||||
id: 'session-named',
|
||||
agentId: 'agent-123',
|
||||
userId: user.id,
|
||||
cwd: process.cwd(),
|
||||
type: 'chat',
|
||||
name: 'Existing Name',
|
||||
},
|
||||
})
|
||||
|
||||
vi.mocked(piAgent.createAgentSession).mockClear()
|
||||
|
||||
await generateSessionNameActivity({
|
||||
teamId: 't1',
|
||||
agentId: 'agent-123',
|
||||
prompt: 'hello comment',
|
||||
sessionId: 'session-comment',
|
||||
context: {
|
||||
agent: {} as unknown as GenerateSessionNameParams['context']['agent'],
|
||||
dbProviders: [],
|
||||
},
|
||||
})
|
||||
|
||||
await generateSessionNameActivity({
|
||||
teamId: 't1',
|
||||
agentId: 'agent-123',
|
||||
prompt: 'hello named',
|
||||
sessionId: 'session-named',
|
||||
context: {
|
||||
agent: {} as unknown as GenerateSessionNameParams['context']['agent'],
|
||||
dbProviders: [],
|
||||
},
|
||||
})
|
||||
|
||||
expect(piAgent.createAgentSession).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
import { createAgentSession, fieldsToTypeBoxSchema, type AutofillField } from '../index'
|
||||
import { DatabaseSessionStorage } from '../database-session-storage'
|
||||
import { prisma, AssetType, Prisma, type Skill } from '@shumai/db'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import {
|
||||
type AgentTool,
|
||||
type AgentMessage,
|
||||
type SessionTreeEntry,
|
||||
type AgentMessage,
|
||||
type AgentTool,
|
||||
type SessionTreeEntry,
|
||||
} from '@earendil-works/pi-agent-core'
|
||||
import { type ImageContent } from '@earendil-works/pi-ai'
|
||||
import { ApplicationFailure } from '@temporalio/activity'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { VersionStackService } from '@shumai/core/src/versionStack/versionStack'
|
||||
import { uploadService } from '@shumai/core/src/upload/upload'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { generateKeyBetween } from 'jittered-fractional-indexing'
|
||||
import { paginateQuery, encodeCursor } from '@shumai/core/src/pagination'
|
||||
import { ulid } from 'ulid'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { encodeCursor, paginateQuery } from '@shumai/core/src/pagination'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { uploadService } from '@shumai/core/src/upload/upload'
|
||||
import { VersionStackService } from '@shumai/core/src/versionStack/versionStack'
|
||||
import { AssetType, prisma, Prisma, type Skill } from '@shumai/db'
|
||||
import { ApplicationFailure } from '@temporalio/activity'
|
||||
import { generateKeyBetween } from 'jittered-fractional-indexing'
|
||||
import { ulid } from 'ulid'
|
||||
import { DatabaseSessionStorage } from '../database-session-storage'
|
||||
import {
|
||||
createAgentSession,
|
||||
fieldsToTypeBoxSchema,
|
||||
type AutofillField,
|
||||
type DbProviderInfo,
|
||||
} from '../index'
|
||||
|
||||
import { UpdateAssetMetadataRequest } from '@shumai/dtos'
|
||||
|
||||
@@ -1138,3 +1143,117 @@ export async function executeAgentToolActivity(params: ExecuteAgentToolParams):
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export interface GenerateSessionNameParams {
|
||||
teamId: string
|
||||
agentId: string
|
||||
prompt: string
|
||||
sessionId: string
|
||||
context: {
|
||||
agent: Prisma.AgentGetPayload<{ include: { modelRef: true; provider: true } }>
|
||||
dbProviders: DbProviderInfo[]
|
||||
}
|
||||
}
|
||||
|
||||
export async function generateSessionNameActivity(
|
||||
params: GenerateSessionNameParams,
|
||||
): Promise<void> {
|
||||
const { sessionId, prompt, teamId, agentId } = params
|
||||
const { agent, dbProviders } = params.context
|
||||
|
||||
// 1. Fetch current session and verify it is a chatbot session and unnamed
|
||||
const sessionRecord = await prisma.agentSession.findUnique({
|
||||
where: { id: sessionId },
|
||||
})
|
||||
|
||||
if (!sessionRecord || sessionRecord.type !== 'chat' || sessionRecord.name !== null) {
|
||||
logger.info({ sessionId }, 'Skipping session name generation: not an unnamed chatbot session')
|
||||
return
|
||||
}
|
||||
|
||||
if (!agent || !agent.modelRef || !agent.provider) {
|
||||
logger.warn(
|
||||
{ sessionId },
|
||||
'Skipping session name generation: Agent, model, or provider configuration not found',
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const providerName = agent.provider.name
|
||||
const modelId = agent.modelRef.modelId
|
||||
|
||||
let namingSessionId: string | undefined
|
||||
|
||||
try {
|
||||
// 2. Create transient naming session in database
|
||||
const namingSession = await prisma.agentSession.create({
|
||||
data: {
|
||||
agentId,
|
||||
userId: sessionRecord.userId,
|
||||
cwd: process.cwd(),
|
||||
assetId: sessionRecord.assetId,
|
||||
type: 'naming',
|
||||
},
|
||||
})
|
||||
namingSessionId = namingSession.id
|
||||
|
||||
const systemInstruction =
|
||||
"You are a helpful assistant. Generate a short 2 to 4 words title/name for a chat session based on the user's first message. " +
|
||||
'Do NOT include quotation marks, markdown formatting, or any extra conversational text. Return only the title.'
|
||||
|
||||
// 3. Create agent session and harness using the naming session
|
||||
const { harness } = await createAgentSession({
|
||||
teamId,
|
||||
agentId,
|
||||
providerName,
|
||||
modelId,
|
||||
systemPrompt: systemInstruction,
|
||||
teamSkills: [],
|
||||
allowedDomains: [],
|
||||
sessionId: namingSessionId,
|
||||
userId: sessionRecord.userId || undefined,
|
||||
providers: dbProviders,
|
||||
})
|
||||
|
||||
const result = await harness.prompt(prompt)
|
||||
const resultText = result.content
|
||||
.filter((c) => c.type === 'text')
|
||||
.map((c) => {
|
||||
if ('text' in c && typeof c.text === 'string') {
|
||||
return c.text
|
||||
}
|
||||
return ''
|
||||
})
|
||||
.join('\n')
|
||||
|
||||
let chatName = resultText.trim()
|
||||
|
||||
// Clean up quotes if returned
|
||||
if (
|
||||
(chatName.startsWith('"') && chatName.endsWith('"')) ||
|
||||
(chatName.startsWith("'") && chatName.endsWith("'"))
|
||||
) {
|
||||
chatName = chatName.slice(1, -1).trim()
|
||||
}
|
||||
|
||||
if (chatName) {
|
||||
await prisma.agentSession.update({
|
||||
where: { id: sessionId },
|
||||
data: { name: chatName },
|
||||
})
|
||||
logger.info({ sessionId, chatName }, 'Session name generated successfully')
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error({ sessionId, err }, 'Failed to generate session name')
|
||||
} finally {
|
||||
if (namingSessionId) {
|
||||
await prisma.agentSession
|
||||
.delete({
|
||||
where: { id: namingSessionId },
|
||||
})
|
||||
.catch((deleteErr) => {
|
||||
logger.error({ namingSessionId, deleteErr }, 'Failed to delete naming session')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+74
-65
@@ -23,6 +23,75 @@ import { createListAssetsTool } from './tools/list-assets'
|
||||
import { createReadSkillTool } from './tools/read-skill'
|
||||
import { createSandboxedBashTool } from './tools/sandboxed-bash'
|
||||
|
||||
export interface DbModelInfo {
|
||||
modelId: string
|
||||
name: string | null
|
||||
config: PrismaJson.ModelConfig
|
||||
}
|
||||
|
||||
export interface DbProviderInfo {
|
||||
name: string
|
||||
config: PrismaJson.ProviderConfig
|
||||
models: DbModelInfo[]
|
||||
}
|
||||
|
||||
export function getModelFromDb(providers: DbProviderInfo[], providerName: string, modelId: string) {
|
||||
const dbProvider = providers.find((p) => p.name === providerName)
|
||||
const dbModel = dbProvider?.models.find((m) => m.modelId === modelId)
|
||||
|
||||
if (!dbProvider || !dbModel) return undefined
|
||||
|
||||
// Model contains complex internal types from pi-ai
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let m: any
|
||||
try {
|
||||
// Try to get built-in model as template
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
m = { ...(getModel as any)(providerName, modelId) }
|
||||
} catch {
|
||||
// Not a built-in model
|
||||
m = {
|
||||
id: modelId,
|
||||
name: dbModel.name || modelId,
|
||||
provider: providerName,
|
||||
api: 'openai-responses',
|
||||
baseUrl: '',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 4096,
|
||||
maxTokens: 4096,
|
||||
}
|
||||
}
|
||||
|
||||
// Override with database config
|
||||
if (dbProvider.config.baseUrl) {
|
||||
m.baseUrl = dbProvider.config.baseUrl
|
||||
}
|
||||
if (dbProvider.config.api) {
|
||||
m.api = dbProvider.config.api
|
||||
}
|
||||
Object.assign(m, dbModel.config)
|
||||
if (dbModel.name) {
|
||||
m.name = dbModel.name
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
export function getApiKeyAndHeadersFromDb(providers: DbProviderInfo[], providerName: string) {
|
||||
// Helper to resolve key from ENV if it matches an ENV var name
|
||||
const resolveKey = (key: string | undefined) => (key ? process.env[key] || key : undefined)
|
||||
|
||||
// Look up the provider in our providers list
|
||||
const dbProvider = providers.find((p) => p.name === providerName)
|
||||
const providerApiKey = dbProvider?.config?.apiKey
|
||||
if (providerApiKey) {
|
||||
return { apiKey: resolveKey(providerApiKey)! }
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
export interface CreateAgentSessionParams {
|
||||
teamId: string
|
||||
agentId: string
|
||||
@@ -36,15 +105,7 @@ export interface CreateAgentSessionParams {
|
||||
userCommentId?: string | null
|
||||
customTools?: AgentTool[]
|
||||
thinkingLevel?: string
|
||||
providers: Array<{
|
||||
name: string
|
||||
config: PrismaJson.ProviderConfig
|
||||
models: Array<{
|
||||
modelId: string
|
||||
name: string | null
|
||||
config: PrismaJson.ModelConfig
|
||||
}>
|
||||
}>
|
||||
providers: DbProviderInfo[]
|
||||
}
|
||||
|
||||
export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
@@ -74,52 +135,10 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
const agentDir = path.join(process.cwd(), '.pi', 'agents', agentId)
|
||||
if (!fs.existsSync(agentDir)) fs.mkdirSync(agentDir, { recursive: true })
|
||||
|
||||
// Helper to construct a Model object from database providers list
|
||||
const getModelFromDb = (pName: string, mId: string) => {
|
||||
const dbProvider = params.providers.find((p) => p.name === pName)
|
||||
const dbModel = dbProvider?.models.find((m) => m.modelId === mId)
|
||||
|
||||
if (!dbProvider || !dbModel) return undefined
|
||||
|
||||
// Model contains complex internal types from pi-ai
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let m: any
|
||||
try {
|
||||
// Try to get built-in model as template
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
m = { ...(getModel as any)(pName, mId) }
|
||||
} catch {
|
||||
// Not a built-in model
|
||||
m = {
|
||||
id: mId,
|
||||
name: dbModel.name || mId,
|
||||
provider: pName,
|
||||
api: 'openai-responses',
|
||||
baseUrl: '',
|
||||
reasoning: false,
|
||||
input: ['text'],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 4096,
|
||||
maxTokens: 4096,
|
||||
}
|
||||
}
|
||||
|
||||
// Override with database config
|
||||
if (dbProvider.config.baseUrl) {
|
||||
m.baseUrl = dbProvider.config.baseUrl
|
||||
}
|
||||
if (dbProvider.config.api) {
|
||||
m.api = dbProvider.config.api
|
||||
}
|
||||
Object.assign(m, dbModel.config)
|
||||
if (dbModel.name) {
|
||||
m.name = dbModel.name
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const model = getModelFromDb(providerName, modelId) || (getModel as any)(providerName, modelId)
|
||||
const model =
|
||||
getModelFromDb(params.providers, providerName, modelId) ||
|
||||
(getModel as any)(providerName, modelId)
|
||||
|
||||
const piDir = path.join(process.cwd(), '.pi')
|
||||
if (!fs.existsSync(piDir)) fs.mkdirSync(piDir, { recursive: true })
|
||||
@@ -269,17 +288,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
|
||||
return prompt
|
||||
},
|
||||
getApiKeyAndHeaders: async (targetModel) => {
|
||||
// Helper to resolve key from ENV if it matches an ENV var name
|
||||
const resolveKey = (key: string | undefined) => (key ? process.env[key] || key : undefined)
|
||||
|
||||
// Look up the provider in our providers list
|
||||
const dbProvider = params.providers.find((p) => p.name === targetModel.provider)
|
||||
const providerApiKey = dbProvider?.config?.apiKey
|
||||
if (providerApiKey) {
|
||||
return { apiKey: resolveKey(providerApiKey)! }
|
||||
}
|
||||
|
||||
return undefined
|
||||
return getApiKeyAndHeadersFromDb(params.providers, targetModel.provider)
|
||||
},
|
||||
tools: [...mediaTools, readSkill, sandboxedBash, ...systemTools, ...customTools],
|
||||
})
|
||||
|
||||
@@ -46,11 +46,15 @@ describe('Agent Chat Workflow', () => {
|
||||
getAssetPathContextActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'getAssetPathContextActivity',
|
||||
}),
|
||||
generateSessionNameActivity: Object.assign(vi.fn(), {
|
||||
_activityName: 'generateSessionNameActivity',
|
||||
}),
|
||||
}
|
||||
|
||||
mockActivities.getAgentWorkerQueueActivity.mockResolvedValue('agent_queue')
|
||||
mockActivities.updateTaskStatusActivity.mockResolvedValue({})
|
||||
mockActivities.createCommentActivity.mockResolvedValue({ id: 'comment-placeholder-id' })
|
||||
mockActivities.generateSessionNameActivity.mockResolvedValue(undefined)
|
||||
mockActivities.getAssetActivity.mockResolvedValue({
|
||||
id: 'a1',
|
||||
project: { teamId: 't1' },
|
||||
@@ -166,6 +170,15 @@ describe('Agent Chat Workflow', () => {
|
||||
status: 'completed',
|
||||
output: { sessionId: 'session-123' },
|
||||
})
|
||||
|
||||
// Verify session name generation triggered
|
||||
expect(mockActivities.generateSessionNameActivity).toHaveBeenCalledWith({
|
||||
teamId: 't1',
|
||||
agentId: 'b1',
|
||||
prompt: 'hello agent',
|
||||
sessionId: 'session-123',
|
||||
context: expect.any(Object),
|
||||
})
|
||||
})
|
||||
|
||||
it('should skip session initialization if sessionId is already provided', async () => {
|
||||
@@ -198,6 +211,9 @@ describe('Agent Chat Workflow', () => {
|
||||
agentsInstruction: expectedInstruction2,
|
||||
}),
|
||||
)
|
||||
|
||||
// Verify session name generation is skipped
|
||||
expect(mockActivities.generateSessionNameActivity).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should delete placeholder comment and finish when AI responds with __NO_REPLY__', async () => {
|
||||
|
||||
@@ -17,6 +17,7 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
deleteCommentActivity,
|
||||
initializeAgentSessionActivity,
|
||||
getAssetPathContextActivity,
|
||||
generateSessionNameActivity,
|
||||
} = getActivities()
|
||||
|
||||
let placeholderCommentId: string | undefined
|
||||
@@ -193,6 +194,18 @@ export async function agentChat(task: WorkflowTask): Promise<void> {
|
||||
attachedAssets,
|
||||
})
|
||||
|
||||
if (isNewChat) {
|
||||
await executeActivity(agentWorkerQueue, generateSessionNameActivity, {
|
||||
teamId,
|
||||
agentId,
|
||||
prompt,
|
||||
sessionId,
|
||||
context,
|
||||
}).catch((err) => {
|
||||
console.error('Failed to run generateSessionNameActivity:', err)
|
||||
})
|
||||
}
|
||||
|
||||
// 7. Update Placeholder Comment
|
||||
if (placeholderCommentId) {
|
||||
if (aiResult.text.trim() === '__NO_REPLY__') {
|
||||
|
||||
@@ -337,6 +337,7 @@ export class ChatService {
|
||||
userId: s.userId,
|
||||
assetId: s.assetId,
|
||||
userCommentId: s.userCommentId,
|
||||
name: s.name,
|
||||
createdAt: s.createdAt.toISOString(),
|
||||
updatedAt: s.updatedAt.toISOString(),
|
||||
}))
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "agent_sessions" ADD COLUMN "name" TEXT;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterEnum
|
||||
ALTER TYPE "AgentSessionType" ADD VALUE 'naming';
|
||||
@@ -648,6 +648,7 @@ enum AgentType {
|
||||
enum AgentSessionType {
|
||||
comment
|
||||
chat
|
||||
naming
|
||||
}
|
||||
|
||||
model Agent {
|
||||
@@ -699,6 +700,7 @@ model AgentSession {
|
||||
asset Asset? @relation("AssetToAgentSession", fields: [assetId], references: [id], onDelete: Cascade)
|
||||
userCommentId String? @map("user_comment_id")
|
||||
type AgentSessionType @default(comment)
|
||||
name String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
entries AgentSessionEntry[]
|
||||
|
||||
+2
-1
@@ -157,7 +157,8 @@ export type AgentType = (typeof AgentType)[keyof typeof AgentType]
|
||||
|
||||
export const AgentSessionType = {
|
||||
comment: 'comment',
|
||||
chat: 'chat'
|
||||
chat: 'chat',
|
||||
naming: 'naming'
|
||||
} as const
|
||||
|
||||
export type AgentSessionType = (typeof AgentSessionType)[keyof typeof AgentSessionType]
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
@@ -3309,6 +3309,7 @@ export const AgentSessionScalarFieldEnum = {
|
||||
assetId: 'assetId',
|
||||
userCommentId: 'userCommentId',
|
||||
type: 'type',
|
||||
name: 'name',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
@@ -494,6 +494,7 @@ export const AgentSessionScalarFieldEnum = {
|
||||
assetId: 'assetId',
|
||||
userCommentId: 'userCommentId',
|
||||
type: 'type',
|
||||
name: 'name',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
+56
-1
@@ -35,6 +35,7 @@ export type AgentSessionMinAggregateOutputType = {
|
||||
assetId: string | null
|
||||
userCommentId: string | null
|
||||
type: $Enums.AgentSessionType | null
|
||||
name: string | null
|
||||
createdAt: Date | null
|
||||
updatedAt: Date | null
|
||||
}
|
||||
@@ -48,6 +49,7 @@ export type AgentSessionMaxAggregateOutputType = {
|
||||
assetId: string | null
|
||||
userCommentId: string | null
|
||||
type: $Enums.AgentSessionType | null
|
||||
name: string | null
|
||||
createdAt: Date | null
|
||||
updatedAt: Date | null
|
||||
}
|
||||
@@ -61,6 +63,7 @@ export type AgentSessionCountAggregateOutputType = {
|
||||
assetId: number
|
||||
userCommentId: number
|
||||
type: number
|
||||
name: number
|
||||
createdAt: number
|
||||
updatedAt: number
|
||||
_all: number
|
||||
@@ -76,6 +79,7 @@ export type AgentSessionMinAggregateInputType = {
|
||||
assetId?: true
|
||||
userCommentId?: true
|
||||
type?: true
|
||||
name?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
}
|
||||
@@ -89,6 +93,7 @@ export type AgentSessionMaxAggregateInputType = {
|
||||
assetId?: true
|
||||
userCommentId?: true
|
||||
type?: true
|
||||
name?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
}
|
||||
@@ -102,6 +107,7 @@ export type AgentSessionCountAggregateInputType = {
|
||||
assetId?: true
|
||||
userCommentId?: true
|
||||
type?: true
|
||||
name?: true
|
||||
createdAt?: true
|
||||
updatedAt?: true
|
||||
_all?: true
|
||||
@@ -188,6 +194,7 @@ export type AgentSessionGroupByOutputType = {
|
||||
assetId: string | null
|
||||
userCommentId: string | null
|
||||
type: $Enums.AgentSessionType
|
||||
name: string | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
_count: AgentSessionCountAggregateOutputType | null
|
||||
@@ -222,6 +229,7 @@ export type AgentSessionWhereInput = {
|
||||
assetId?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
userCommentId?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFilter<"AgentSession"> | $Enums.AgentSessionType
|
||||
name?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"AgentSession"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"AgentSession"> | Date | string
|
||||
agent?: Prisma.XOR<Prisma.AgentScalarRelationFilter, Prisma.AgentWhereInput>
|
||||
@@ -240,6 +248,7 @@ export type AgentSessionOrderByWithRelationInput = {
|
||||
assetId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
agent?: Prisma.AgentOrderByWithRelationInput
|
||||
@@ -261,6 +270,7 @@ export type AgentSessionWhereUniqueInput = Prisma.AtLeast<{
|
||||
assetId?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
userCommentId?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFilter<"AgentSession"> | $Enums.AgentSessionType
|
||||
name?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"AgentSession"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"AgentSession"> | Date | string
|
||||
agent?: Prisma.XOR<Prisma.AgentScalarRelationFilter, Prisma.AgentWhereInput>
|
||||
@@ -279,6 +289,7 @@ export type AgentSessionOrderByWithAggregationInput = {
|
||||
assetId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
_count?: Prisma.AgentSessionCountOrderByAggregateInput
|
||||
@@ -298,6 +309,7 @@ export type AgentSessionScalarWhereWithAggregatesInput = {
|
||||
assetId?: Prisma.StringNullableWithAggregatesFilter<"AgentSession"> | string | null
|
||||
userCommentId?: Prisma.StringNullableWithAggregatesFilter<"AgentSession"> | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeWithAggregatesFilter<"AgentSession"> | $Enums.AgentSessionType
|
||||
name?: Prisma.StringNullableWithAggregatesFilter<"AgentSession"> | string | null
|
||||
createdAt?: Prisma.DateTimeWithAggregatesFilter<"AgentSession"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"AgentSession"> | Date | string
|
||||
}
|
||||
@@ -308,6 +320,7 @@ export type AgentSessionCreateInput = {
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
@@ -326,6 +339,7 @@ export type AgentSessionUncheckedCreateInput = {
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -338,6 +352,7 @@ export type AgentSessionUpdateInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
@@ -356,6 +371,7 @@ export type AgentSessionUncheckedUpdateInput = {
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -371,6 +387,7 @@ export type AgentSessionCreateManyInput = {
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
@@ -381,6 +398,7 @@ export type AgentSessionUpdateManyMutationInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -394,6 +412,7 @@ export type AgentSessionUncheckedUpdateManyInput = {
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -422,6 +441,7 @@ export type AgentSessionCountOrderByAggregateInput = {
|
||||
assetId?: Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
}
|
||||
@@ -435,6 +455,7 @@ export type AgentSessionMaxOrderByAggregateInput = {
|
||||
assetId?: Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
}
|
||||
@@ -448,6 +469,7 @@ export type AgentSessionMinOrderByAggregateInput = {
|
||||
assetId?: Prisma.SortOrder
|
||||
userCommentId?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
createdAt?: Prisma.SortOrder
|
||||
updatedAt?: Prisma.SortOrder
|
||||
}
|
||||
@@ -623,6 +645,7 @@ export type AgentSessionCreateWithoutUserInput = {
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
@@ -639,6 +662,7 @@ export type AgentSessionUncheckedCreateWithoutUserInput = {
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -683,6 +707,7 @@ export type AgentSessionScalarWhereInput = {
|
||||
assetId?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
userCommentId?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFilter<"AgentSession"> | $Enums.AgentSessionType
|
||||
name?: Prisma.StringNullableFilter<"AgentSession"> | string | null
|
||||
createdAt?: Prisma.DateTimeFilter<"AgentSession"> | Date | string
|
||||
updatedAt?: Prisma.DateTimeFilter<"AgentSession"> | Date | string
|
||||
}
|
||||
@@ -693,6 +718,7 @@ export type AgentSessionCreateWithoutAssetInput = {
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
@@ -709,6 +735,7 @@ export type AgentSessionUncheckedCreateWithoutAssetInput = {
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -747,6 +774,7 @@ export type AgentSessionCreateWithoutCommentsInput = {
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
@@ -764,6 +792,7 @@ export type AgentSessionUncheckedCreateWithoutCommentsInput = {
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -791,6 +820,7 @@ export type AgentSessionUpdateWithoutCommentsInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
@@ -808,6 +838,7 @@ export type AgentSessionUncheckedUpdateWithoutCommentsInput = {
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -819,6 +850,7 @@ export type AgentSessionCreateWithoutAgentInput = {
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
user?: Prisma.UserCreateNestedOneWithoutAgentSessionsInput
|
||||
@@ -835,6 +867,7 @@ export type AgentSessionUncheckedCreateWithoutAgentInput = {
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -873,6 +906,7 @@ export type AgentSessionCreateWithoutEntriesInput = {
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
agent: Prisma.AgentCreateNestedOneWithoutAgentSessionsInput
|
||||
@@ -890,6 +924,7 @@ export type AgentSessionUncheckedCreateWithoutEntriesInput = {
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutSessionInput
|
||||
@@ -917,6 +952,7 @@ export type AgentSessionUpdateWithoutEntriesInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
@@ -934,6 +970,7 @@ export type AgentSessionUncheckedUpdateWithoutEntriesInput = {
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -947,6 +984,7 @@ export type AgentSessionCreateManyUserInput = {
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
@@ -957,6 +995,7 @@ export type AgentSessionUpdateWithoutUserInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
@@ -973,6 +1012,7 @@ export type AgentSessionUncheckedUpdateWithoutUserInput = {
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -987,6 +1027,7 @@ export type AgentSessionUncheckedUpdateManyWithoutUserInput = {
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -999,6 +1040,7 @@ export type AgentSessionCreateManyAssetInput = {
|
||||
leafId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
@@ -1009,6 +1051,7 @@ export type AgentSessionUpdateWithoutAssetInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
agent?: Prisma.AgentUpdateOneRequiredWithoutAgentSessionsNestedInput
|
||||
@@ -1025,6 +1068,7 @@ export type AgentSessionUncheckedUpdateWithoutAssetInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -1039,6 +1083,7 @@ export type AgentSessionUncheckedUpdateManyWithoutAssetInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -1051,6 +1096,7 @@ export type AgentSessionCreateManyAgentInput = {
|
||||
assetId?: string | null
|
||||
userCommentId?: string | null
|
||||
type?: $Enums.AgentSessionType
|
||||
name?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
}
|
||||
@@ -1061,6 +1107,7 @@ export type AgentSessionUpdateWithoutAgentInput = {
|
||||
leafId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
user?: Prisma.UserUpdateOneWithoutAgentSessionsNestedInput
|
||||
@@ -1077,6 +1124,7 @@ export type AgentSessionUncheckedUpdateWithoutAgentInput = {
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
entries?: Prisma.AgentSessionEntryUncheckedUpdateManyWithoutSessionNestedInput
|
||||
@@ -1091,6 +1139,7 @@ export type AgentSessionUncheckedUpdateManyWithoutAgentInput = {
|
||||
assetId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
userCommentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumAgentSessionTypeFieldUpdateOperationsInput | $Enums.AgentSessionType
|
||||
name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -1144,6 +1193,7 @@ export type AgentSessionSelect<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
assetId?: boolean
|
||||
userCommentId?: boolean
|
||||
type?: boolean
|
||||
name?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
@@ -1163,6 +1213,7 @@ export type AgentSessionSelectCreateManyAndReturn<ExtArgs extends runtime.Types.
|
||||
assetId?: boolean
|
||||
userCommentId?: boolean
|
||||
type?: boolean
|
||||
name?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
@@ -1179,6 +1230,7 @@ export type AgentSessionSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.
|
||||
assetId?: boolean
|
||||
userCommentId?: boolean
|
||||
type?: boolean
|
||||
name?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
@@ -1195,11 +1247,12 @@ export type AgentSessionSelectScalar = {
|
||||
assetId?: boolean
|
||||
userCommentId?: boolean
|
||||
type?: boolean
|
||||
name?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
}
|
||||
|
||||
export type AgentSessionOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "agentId" | "userId" | "cwd" | "leafId" | "assetId" | "userCommentId" | "type" | "createdAt" | "updatedAt", ExtArgs["result"]["agentSession"]>
|
||||
export type AgentSessionOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "agentId" | "userId" | "cwd" | "leafId" | "assetId" | "userCommentId" | "type" | "name" | "createdAt" | "updatedAt", ExtArgs["result"]["agentSession"]>
|
||||
export type AgentSessionInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
agent?: boolean | Prisma.AgentDefaultArgs<ExtArgs>
|
||||
user?: boolean | Prisma.AgentSession$userArgs<ExtArgs>
|
||||
@@ -1237,6 +1290,7 @@ export type $AgentSessionPayload<ExtArgs extends runtime.Types.Extensions.Intern
|
||||
assetId: string | null
|
||||
userCommentId: string | null
|
||||
type: $Enums.AgentSessionType
|
||||
name: string | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}, ExtArgs["result"]["agentSession"]>
|
||||
@@ -1675,6 +1729,7 @@ export interface AgentSessionFieldRefs {
|
||||
readonly assetId: Prisma.FieldRef<"AgentSession", 'String'>
|
||||
readonly userCommentId: Prisma.FieldRef<"AgentSession", 'String'>
|
||||
readonly type: Prisma.FieldRef<"AgentSession", 'AgentSessionType'>
|
||||
readonly name: Prisma.FieldRef<"AgentSession", 'String'>
|
||||
readonly createdAt: Prisma.FieldRef<"AgentSession", 'DateTime'>
|
||||
readonly updatedAt: Prisma.FieldRef<"AgentSession", 'DateTime'>
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ export const chatSessionInfoSchema = z.object({
|
||||
userId: z.string().nullable(),
|
||||
assetId: z.string().nullable(),
|
||||
userCommentId: z.string().nullable(),
|
||||
name: z.string().nullable().optional(),
|
||||
createdAt: z.string(),
|
||||
updatedAt: z.string(),
|
||||
})
|
||||
|
||||
@@ -256,7 +256,7 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
|
||||
>
|
||||
<div onClick={() => loadSession(sess.id)} className="flex-1 min-w-0 pr-6">
|
||||
<div className="text-sm font-semibold text-foreground truncate">
|
||||
{m.shumai_agent()}
|
||||
{sess.name || m.new_chat()}
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground mt-0.5">
|
||||
{new Date(sess.createdAt).toLocaleString()}
|
||||
|
||||
Reference in New Issue
Block a user