Spaces:
Runtime error
Runtime error
Thomas G. Lopes
commited on
Commit
·
881698e
1
Parent(s):
92c8678
update
Browse files
src/routes/canvas/chat-node.svelte
CHANGED
|
@@ -15,6 +15,7 @@
|
|
| 15 |
import ModelPicker from "./model-picker.svelte";
|
| 16 |
import ProviderPicker from "./provider-picker.svelte";
|
| 17 |
import { ElementSize } from "runed";
|
|
|
|
| 18 |
|
| 19 |
type Props = Omit<NodeProps, "data"> & {
|
| 20 |
data: { query: string; response: string; modelId?: Model["id"]; provider?: string };
|
|
@@ -135,6 +136,11 @@
|
|
| 135 |
|
| 136 |
let node = $state<HTMLElement>();
|
| 137 |
const size = new ElementSize(() => node);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
</script>
|
| 139 |
|
| 140 |
<div
|
|
@@ -188,7 +194,7 @@
|
|
| 188 |
</form>
|
| 189 |
|
| 190 |
{#if data.response || isLoading}
|
| 191 |
-
<div class="mt-4
|
| 192 |
<div class="mb-2 flex items-center gap-2 text-xs font-medium text-gray-600">
|
| 193 |
Response
|
| 194 |
{#if isLoading}
|
|
@@ -196,7 +202,9 @@
|
|
| 196 |
{/if}
|
| 197 |
</div>
|
| 198 |
{#if data.response}
|
| 199 |
-
<
|
|
|
|
|
|
|
| 200 |
{:else if isLoading}
|
| 201 |
<div class="text-sm text-gray-500">Generating response...</div>
|
| 202 |
{/if}
|
|
|
|
| 15 |
import ModelPicker from "./model-picker.svelte";
|
| 16 |
import ProviderPicker from "./provider-picker.svelte";
|
| 17 |
import { ElementSize } from "runed";
|
| 18 |
+
import { marked } from "marked";
|
| 19 |
|
| 20 |
type Props = Omit<NodeProps, "data"> & {
|
| 21 |
data: { query: string; response: string; modelId?: Model["id"]; provider?: string };
|
|
|
|
| 136 |
|
| 137 |
let node = $state<HTMLElement>();
|
| 138 |
const size = new ElementSize(() => node);
|
| 139 |
+
|
| 140 |
+
const parsedResponse = $derived.by(() => {
|
| 141 |
+
if (!data.response) return "";
|
| 142 |
+
return marked(data.response);
|
| 143 |
+
});
|
| 144 |
</script>
|
| 145 |
|
| 146 |
<div
|
|
|
|
| 194 |
</form>
|
| 195 |
|
| 196 |
{#if data.response || isLoading}
|
| 197 |
+
<div class="mt-4">
|
| 198 |
<div class="mb-2 flex items-center gap-2 text-xs font-medium text-gray-600">
|
| 199 |
Response
|
| 200 |
{#if isLoading}
|
|
|
|
| 202 |
{/if}
|
| 203 |
</div>
|
| 204 |
{#if data.response}
|
| 205 |
+
<div class="prose prose-sm max-w-none text-gray-800">
|
| 206 |
+
{@html parsedResponse}
|
| 207 |
+
</div>
|
| 208 |
{:else if isLoading}
|
| 209 |
<div class="text-sm text-gray-500">Generating response...</div>
|
| 210 |
{/if}
|