diff --git a/reasonify-headless/reasonify/core/loop.py b/reasonify-headless/reasonify/core/loop.py index 12e0af0..8e6caa2 100644 --- a/reasonify-headless/reasonify/core/loop.py +++ b/reasonify-headless/reasonify/core/loop.py @@ -30,7 +30,7 @@ def reply(*messages: str): @tool def end_of_turn(): - """end this round of conversation and pass the microphone to the user""" + """end this round of conversation and pass the microphone to the user. NEVER use this until you've seen your response is as your expected""" c["end"] = True diff --git a/reasonify-headless/reasonify/examples/async.yaml b/reasonify-headless/reasonify/examples/async.yaml index 8d8a701..d80f6dd 100644 --- a/reasonify-headless/reasonify/examples/async.yaml +++ b/reasonify-headless/reasonify/examples/async.yaml @@ -25,7 +25,8 @@ print(i) reply("Do you want to know more about async generators?") - end_of_turn() +- + - source: end_of_turn() - Yes! How can I `yield from` an async generator? @@ -46,4 +47,5 @@ await g() reply("This will print 1, 2, 3.") - end_of_turn() +- + - source: end_of_turn() diff --git a/reasonify-headless/reasonify/examples/file.yaml b/reasonify-headless/reasonify/examples/file.yaml index 262bb9b..e93ed97 100644 --- a/reasonify-headless/reasonify/examples/file.yaml +++ b/reasonify-headless/reasonify/examples/file.yaml @@ -7,7 +7,8 @@ - source: | reply(f"I can these files/dirs: {", ".join(map(str, paths))}") - end_of_turn() +- + - source: end_of_turn() - I just uploaded a PNG file, can you find it? diff --git a/reasonify-headless/reasonify/templates/main.j2 b/reasonify-headless/reasonify/templates/main.j2 index 7f7b75a..80c31a8 100644 --- a/reasonify-headless/reasonify/templates/main.j2 +++ b/reasonify-headless/reasonify/templates/main.j2 @@ -55,4 +55,6 @@ Some hints on how to write best code: 15. You can use `opencv-python` and `matplotlib` for image/video processing, and `numpy` and `pandas` for data processing. 16. When asked about programming-related questions, first consider searching GitHub / PyPI +永远不要把 read_page 的内容直接 reply 给用户! + {% chat -%} \ No newline at end of file diff --git a/src/lib/components/Chat.svelte b/src/lib/components/Chat.svelte index 996e122..b44ef26 100644 --- a/src/lib/components/Chat.svelte +++ b/src/lib/components/Chat.svelte @@ -5,11 +5,13 @@ import { type Chain, initChain } from "../py"; import { clearApiCache, getApi } from "../py/api"; import Highlight from "./Highlight.svelte"; + import Intro from "./Intro.svelte"; import Markdown from "./Markdown.svelte"; import { dev } from "$app/environment"; import { addFiles, mount } from "$lib/py/fs"; import { pyodideReady, reasonifyReady, startIconAnimation, stopIconAnimation } from "$lib/stores"; import { toast } from "svelte-sonner"; + import { fly } from "svelte/transition"; export let chain: Chain; @@ -45,8 +47,33 @@ $: running ? startIconAnimation() : stopIconAnimation(); + function startWith(prompt: string) { + content = prompt; + start(); + } +{#if !messages.length} + + + + + + +{/if} +
{#each context?.snapshots ?? [] as ctx, i} diff --git a/src/lib/components/Intro.svelte b/src/lib/components/Intro.svelte new file mode 100644 index 0000000..d068909 --- /dev/null +++ b/src/lib/components/Intro.svelte @@ -0,0 +1,18 @@ + + +
+
+

+ {#each title.split(" ") as char, i} + {#if i} {/if} + {@const t = Math.random() * (i + 1)} + {char} + {/each} +

+ +
+
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index d9dab78..148ad89 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,5 +1,5 @@