( steps: AgentStep[], fallbackTitle: string )
| 41 | }); |
| 42 | |
| 43 | const getOrCreateCurrentStep = ( |
| 44 | steps: AgentStep[], |
| 45 | fallbackTitle: string |
| 46 | ): AgentStep => { |
| 47 | const currentStep = steps[steps.length - 1]; |
| 48 | if (currentStep) { |
| 49 | return currentStep; |
| 50 | } |
| 51 | |
| 52 | const recoveredStep = createAgentStep( |
| 53 | `step-history-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`, |
| 54 | fallbackTitle, |
| 55 | true |
| 56 | ); |
| 57 | steps.push(recoveredStep); |
| 58 | return recoveredStep; |
| 59 | }; |
| 60 | |
| 61 | export function extractAssistantMsgFromResponse( |
| 62 | dialog_msg: ApiMessage, |
no test coverage detected