Spaces:
Running
Running
Show error when webpage cannot be reached or parsed (#930)
Browse files
src/lib/components/OpenWebSearchResults.svelte
CHANGED
@@ -9,8 +9,8 @@
|
|
9 |
export let webSearchMessages: WebSearchUpdate[] = [];
|
10 |
|
11 |
$: sources = webSearchMessages.find((m) => m.sources)?.sources;
|
12 |
-
$:
|
13 |
-
$: loading = !sources &&
|
14 |
</script>
|
15 |
|
16 |
<details
|
@@ -44,12 +44,10 @@
|
|
44 |
<dl class="leading-4">
|
45 |
<dd class="text-sm">Web Search</dd>
|
46 |
<dt class="flex items-center gap-1 truncate whitespace-nowrap text-[.82rem] text-gray-400">
|
47 |
-
{#if
|
48 |
-
{error.message}
|
49 |
-
{:else if sources}
|
50 |
Completed
|
51 |
{:else}
|
52 |
-
{
|
53 |
{/if}
|
54 |
</dt>
|
55 |
</dl>
|
|
|
9 |
export let webSearchMessages: WebSearchUpdate[] = [];
|
10 |
|
11 |
$: sources = webSearchMessages.find((m) => m.sources)?.sources;
|
12 |
+
$: lastMessage = webSearchMessages.filter((m) => m.messageType !== "sources").slice(-1)[0];
|
13 |
+
$: loading = !sources && lastMessage.messageType !== "error";
|
14 |
</script>
|
15 |
|
16 |
<details
|
|
|
44 |
<dl class="leading-4">
|
45 |
<dd class="text-sm">Web Search</dd>
|
46 |
<dt class="flex items-center gap-1 truncate whitespace-nowrap text-[.82rem] text-gray-400">
|
47 |
+
{#if sources}
|
|
|
|
|
48 |
Completed
|
49 |
{:else}
|
50 |
+
{lastMessage.message}
|
51 |
{/if}
|
52 |
</dt>
|
53 |
</dl>
|
src/lib/server/websearch/runWebSearch.ts
CHANGED
@@ -128,6 +128,7 @@ export async function runWebSearch(
|
|
128 |
text = await parseWeb(link);
|
129 |
appendUpdate("Browsing webpage", [link]);
|
130 |
} catch (e) {
|
|
|
131 |
// ignore errors
|
132 |
}
|
133 |
}
|
|
|
128 |
text = await parseWeb(link);
|
129 |
appendUpdate("Browsing webpage", [link]);
|
130 |
} catch (e) {
|
131 |
+
appendUpdate("Failed to parse webpage", [(e as Error).message, link], "error");
|
132 |
// ignore errors
|
133 |
}
|
134 |
}
|