File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -201,19 +201,19 @@ export class AsyncRunEngine implements RunEngine {
201201 return sampleData ;
202202 }
203203
204+ // Extract from the latest user message only (not tool/function messages without roles)
204205 for ( let idx = conversation . length - 1 ; idx >= 0 ; idx -= 1 ) {
205206 const entry = conversation [ idx ] ;
206- if ( ! entry . role || entry . role === 'user' ) {
207+ if ( entry . role === 'user' ) {
207208 const extracted = this . extractLatestInput ( entry , sampleData ) ;
208209 if ( extracted . trim ( ) . length > 0 ) {
209210 return extracted ;
210211 }
211212 }
212213 }
213214
214- const fallback = conversation [ conversation . length - 1 ] ;
215- const extractedFallback = this . extractLatestInput ( fallback , sampleData ) ;
216- return extractedFallback . trim ( ) . length > 0 ? extractedFallback : sampleData ;
215+ // Fallback: if no user message found, return full sample data
216+ return sampleData ;
217217 }
218218
219219 private guardrailUsesConversationHistory ( guardrail : ConfiguredGuardrail ) : boolean {
You can’t perform that action at this time.
0 commit comments