Skip to content

Commit

Permalink
show an example of the injected script
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansampson committed Dec 11, 2024
1 parent 6313441 commit 5edcc48
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/ai_chat/renderer/page_text_distilling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ void DistillPageTextViaSiteScript(
base::OnceCallback<void(const std::optional<std::string>&)> callback) {
CHECK(ai_chat::features::IsCustomSiteDistillerScriptsEnabled());
// TODO (jonathansampson): Wrap scripts at build/transpile-time instead
// This produces an injected script that resembles the following:
// (() => {
// function distillPrimaryColumn (level) { ... }
// function distill(level) {
// return distillPrimaryColumn(level);
// }
// return distill(3);
// })())
std::string script = absl::StrFormat(
R"((()=> {
%s
Expand Down

0 comments on commit 5edcc48

Please sign in to comment.