Skip to content

Commit

Permalink
Use Import as a fallback for the WebFetcher tool when `StartWebSess…
Browse files Browse the repository at this point in the history
…ion` fails
  • Loading branch information
rhennigan committed Jan 22, 2024
1 parent 77f7ecc commit d804322
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Source/Chatbook/Tools/DefaultTools.wl
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ fetchWebText[ url_String, session_WebSessionObject ] := Enclose[
shortenWebText @ niceWebText @ Import[ url, { "HTML", "Plaintext" } ] &
];

fetchWebText[ url_String, _Missing | _? FailureQ ] :=
shortenWebText @ niceWebText @ Import[ url, { "HTML", "Plaintext" } ];

fetchWebText // endDefinition;

(* ::**************************************************************************************************************:: *)
Expand Down Expand Up @@ -635,7 +638,13 @@ validWebSessionQ[ ___ ] := False;
(* ::Subsubsection::Closed:: *)
(*startWebSession*)
startWebSession // beginDefinition;
startWebSession[ ] := $currentWebSession = StartWebSession[ Visible -> $webSessionVisible ];

startWebSession[ ] := $currentWebSession =
If[ TrueQ @ $CloudEvaluation,
Missing[ "NotAvailable" ],
StartWebSession[ Visible -> $webSessionVisible ]
];

startWebSession // endDefinition;

(* ::**************************************************************************************************************:: *)
Expand Down

0 comments on commit d804322

Please sign in to comment.