mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 04:44:28 +00:00
refactor(api/chat): remove direct Prisma query from API layer
API layer routes in packages/api/src/chat.ts accessed the database directly via prisma, violating communication layer boundaries. This refactoring migrates these queries to packages/core/src/chat/chat.ts: - Added getNewSessionMessages to fetch mapped SSE entries. - Added getChatWorkflowStatus to check task completions. - Added abortSession to handle workflow cancellation and task updates in core. - Updated both core and API tests to match refactored signatures and mock boundaries.
This commit is contained in:
@@ -195,7 +195,10 @@ describe('Agent Activities', () => {
|
||||
} as unknown as AgentExecutionContext
|
||||
|
||||
const addEventListenerSpy = vi.spyOn(mockTemporalContext.cancellationSignal, 'addEventListener')
|
||||
const removeEventListenerSpy = vi.spyOn(mockTemporalContext.cancellationSignal, 'removeEventListener')
|
||||
const removeEventListenerSpy = vi.spyOn(
|
||||
mockTemporalContext.cancellationSignal,
|
||||
'removeEventListener',
|
||||
)
|
||||
|
||||
const executionPromise = agentChatActivity({
|
||||
teamId: 't1',
|
||||
|
||||
Reference in New Issue
Block a user