File tree Expand file tree Collapse file tree 3 files changed +16
-24
lines changed
frontend/internal-packages/agent/src Expand file tree Collapse file tree 3 files changed +16
-24
lines changed Original file line number Diff line number Diff line change 1- import type { BaseMessage } from '@langchain/core/messages'
21import type { WorkflowState } from '../../chat/workflow/types'
2+ import { hasToolCalls } from '../../utils/hasToolCalls'
33
44/**
55 * Determines the next node based on whether the last message contains tool calls
@@ -16,14 +16,3 @@ export const routeAfterDesignSchema = (
1616
1717 return 'generateTestcase'
1818}
19-
20- /**
21- * Checks if a message contains tool calls
22- */
23- const hasToolCalls = ( message : BaseMessage ) : boolean => {
24- return (
25- 'tool_calls' in message &&
26- Array . isArray ( message . tool_calls ) &&
27- message . tool_calls . length > 0
28- )
29- }
Original file line number Diff line number Diff line change 1- import type { BaseMessage } from '@langchain/core/messages'
21import { WorkflowTerminationError } from '../../shared/errorHandling'
2+ import { hasToolCalls } from '../../utils/hasToolCalls'
33import type { PmAgentState } from '../pmAgentAnnotations'
44
55const MAX_ANALYSIS_RETRY_COUNT = 3
@@ -39,14 +39,3 @@ export const routeAfterAnalyzeRequirements = (
3939 // 4. No tool calls and requirements not set -> re-analyze
4040 return 'analyzeRequirements'
4141}
42-
43- /**
44- * Checks if a message contains tool calls
45- */
46- const hasToolCalls = ( message : BaseMessage ) : boolean => {
47- return (
48- 'tool_calls' in message &&
49- Array . isArray ( message . tool_calls ) &&
50- message . tool_calls . length > 0
51- )
52- }
Original file line number Diff line number Diff line change 1+ import type { BaseMessage } from '@langchain/core/messages'
2+
3+ /**
4+ * Check if a message contains tool calls
5+ * @param message - The BaseMessage to check
6+ * @returns true if the message has non-empty tool_calls array
7+ */
8+ export const hasToolCalls = ( message : BaseMessage ) : boolean => {
9+ return (
10+ 'tool_calls' in message &&
11+ Array . isArray ( message . tool_calls ) &&
12+ message . tool_calls . length > 0
13+ )
14+ }
You can’t perform that action at this time.
0 commit comments