@@ -81,22 +81,10 @@ void AIChatUIPageHandler::SetClientPage(
81
81
82
82
void AIChatUIPageHandler::SubmitHumanConversationEntry (
83
83
const std::string& input) {
84
- // TODO(nullhook): Avoid copy
85
- std::string input_copy = input;
86
-
87
- // Prevent indirect prompt injections being sent to the AI model.
88
- // TODO(nullhook): Abstract prompt injection cleanups to a central place
89
- base::ReplaceSubstringsAfterOffset (&input_copy, 0 , ai_chat::kHumanPrompt , " " );
90
- base::ReplaceSubstringsAfterOffset (&input_copy, 0 , ai_chat::kAIPrompt , " " );
91
- base::ReplaceSubstringsAfterOffset (&input_copy, 0 , " <article>" , " " );
92
- base::ReplaceSubstringsAfterOffset (&input_copy, 0 , " </article>" , " " );
93
- base::ReplaceSubstringsAfterOffset (&input_copy, 0 , " <history>" , " " );
94
- base::ReplaceSubstringsAfterOffset (&input_copy, 0 , " </history>" , " " );
95
- base::ReplaceSubstringsAfterOffset (&input_copy, 0 , " <question>" , " " );
96
- base::ReplaceSubstringsAfterOffset (&input_copy, 0 , " </question>" , " " );
97
-
84
+ mojom::ConversationTurn turn = {CharacterType::HUMAN,
85
+ ConversationTurnVisibility::VISIBLE, input};
98
86
active_chat_tab_helper_->MakeAPIRequestWithConversationHistoryUpdate (
99
- {CharacterType::HUMAN, ConversationTurnVisibility::VISIBLE, input_copy} );
87
+ std::move (turn) );
100
88
}
101
89
102
90
void AIChatUIPageHandler::GetConversationHistory (
0 commit comments