refac: tools url param handling

This commit is contained in:
Timothy J. Baek 2024-10-06 22:00:23 -07:00
parent 9193c9bd7d
commit 57df49274c

View File

@ -352,16 +352,22 @@
webSearchEnabled = true;
}
if ($page.url.searchParams.get('q')) {
prompt = $page.url.searchParams.get('q') ?? '';
selectedToolIds = (
$page.url.searchParams.get('tools') ??
$page.url.searchParams.get('tool-ids') ??
''
)
.split(',')
if ($page.url.searchParams.get('tools')) {
selectedToolIds = $page.url.searchParams
.get('tools')
?.split(',')
.map((id) => id.trim())
.filter((id) => id);
} else if ($page.url.searchParams.get('tool-ids')) {
selectedToolIds = $page.url.searchParams
.get('tool-ids')
?.split(',')
.map((id) => id.trim())
.filter((id) => id);
}
if ($page.url.searchParams.get('q')) {
prompt = $page.url.searchParams.get('q') ?? '';
if (prompt) {
await tick();