feat: web search tool details #4208
ClosedYash-Singh1(GitHub profile, opens in a new tab)wants to merge 2 commits into
main fromyash/web-search-tool-detailsopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -0,0 +65,21 @@65+ }66+ return pattern ?? url;67+}68+69+function formatWebSearchExpandedBody(toolData: unknown): string | null {70+ try {71+ return JSON.stringify(toolData, null, 2);72+ } catch {73+ return null;74+ }75+}76+77+export function workEntryPreview(78+ workEntry: Pick<WorkLogEntry, "detail" | "command" | "changedFiles" | "itemType" | "toolData">,79+ workspaceRoot: string | undefined,80+) {81+ if (workEntry.command) return workEntry.command;82+ if (workEntry.itemType === "web_search") {83+ const preview = webSearchPreview(workEntry.toolData);84+ if (preview) return preview;85+ }@@ -0,0 +45,21 @@45+ return [itemQuery];46+ }47+ return [];48+}49+50+function webSearchPreview(toolData: unknown): string | null {51+ const action = webSearchActionRecord(toolData);52+ const actionType = asTrimmedPlainString(action?.type);53+ const queries = webSearchQueries(toolData);54+ if (queries.length > 0) {55+ const [firstQuery] = queries;56+ if (!firstQuery) {57+ return null;58+ }59+ return queries.length === 1 ? firstQuery : `${firstQuery} +${queries.length - 1} more`;60+ }61+ const url = asTrimmedPlainString(action?.url);62+ const pattern = asTrimmedPlainString(action?.pattern);63+ if ((actionType === "findInPage" || actionType === "find_in_page") && pattern && url) {64+ return `${pattern} in ${url}`;65+ }
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
551c9aaf-c5b3-4f12-941e-c5fa128e017bYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share