File tree 2 files changed +35
-1
lines changed
2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ def reply_to(post)
420
420
Discourse . redis . setex ( redis_stream_key , 60 , 1 )
421
421
end
422
422
423
- context [ :skip_tool_details ] && = !bot . persona . class . tool_details
423
+ context [ :skip_tool_details ] || = !bot . persona . class . tool_details
424
424
425
425
new_custom_prompts =
426
426
bot . reply ( context ) do |partial , cancel , placeholder |
Original file line number Diff line number Diff line change 590
590
expect ( last_post . raw ) . to include ( "I found stuff" )
591
591
end
592
592
593
+ it "supports disabling tool details" do
594
+ persona =
595
+ AiPersona . find (
596
+ DiscourseAi ::AiBot ::Personas ::Persona . system_personas [
597
+ DiscourseAi ::AiBot ::Personas ::General
598
+ ] ,
599
+ )
600
+
601
+ persona . update! ( tool_details : false )
602
+ playground . bot . persona = persona . class_instance . new
603
+
604
+ response1 = ( <<~TXT ) . strip
605
+ <function_calls>
606
+ <invoke>
607
+ <tool_name>search</tool_name>
608
+ <tool_id>search</tool_id>
609
+ <parameters>
610
+ <search_query>testing various things</search_query>
611
+ </parameters>
612
+ </invoke>
613
+ </function_calls>
614
+ TXT
615
+
616
+ response2 = "I found stuff"
617
+
618
+ DiscourseAi ::Completions ::Llm . with_prepared_responses ( [ response1 , response2 ] ) do
619
+ playground . reply_to ( third_post )
620
+ end
621
+
622
+ last_post = third_post . topic . reload . posts . order ( :post_number ) . last
623
+
624
+ expect ( last_post . raw ) . to eq ( "I found stuff" )
625
+ end
626
+
593
627
it "does not include placeholders in conversation context but includes all completions" do
594
628
response1 = ( <<~TXT ) . strip
595
629
<function_calls>
You can’t perform that action at this time.
0 commit comments