diff --git a/_build_client.ts b/_build_client.ts index 074c423..7b5c073 100644 --- a/_build_client.ts +++ b/_build_client.ts @@ -3,9 +3,19 @@ import { build } from "@char/aftercare/esbuild"; if (import.meta.main) { const watch = Deno.args.includes("--watch"); await build({ - in: ["./client/main.tsx"], + in: ["./client/main.tsx", "./client/deps/hljs.ts"], outDir: "./client/web/dist", watch, + plugins: [ + { + name: "deps-external", + setup: build => { + build.onResolve({ filter: /^deps\// }, args => { + return { path: args.path.replace(/.ts$/, ".js"), external: true }; + }); + }, + }, + ], extraOptions: { splitting: true, }, diff --git a/client/deps/hljs.ts b/client/deps/hljs.ts new file mode 100644 index 0000000..1fcb8f3 --- /dev/null +++ b/client/deps/hljs.ts @@ -0,0 +1,19 @@ +import hljs from "npm:highlight.js/lib/core"; + +import bash from "npm:highlight.js/lib/languages/bash"; +import css from "npm:highlight.js/lib/languages/css"; +import javascript from "npm:highlight.js/lib/languages/javascript"; +import python from "npm:highlight.js/lib/languages/python"; +import rust from "npm:highlight.js/lib/languages/rust"; +import typescript from "npm:highlight.js/lib/languages/typescript"; +import xml from "npm:highlight.js/lib/languages/xml"; + +hljs.registerLanguage("bash", bash); +hljs.registerLanguage("css", css); +hljs.registerLanguage("javascript", javascript); +hljs.registerLanguage("python", python); +hljs.registerLanguage("rust", rust); +hljs.registerLanguage("typescript", typescript); +hljs.registerLanguage("html", xml); + +export default hljs; diff --git a/client/response.tsx b/client/response.tsx index 05c817f..e6ba06a 100644 --- a/client/response.tsx +++ b/client/response.tsx @@ -1,13 +1,4 @@ -import hljs from "npm:highlight.js/lib/core"; -import javascript from "npm:highlight.js/lib/languages/javascript"; -import python from "npm:highlight.js/lib/languages/python"; -import rust from "npm:highlight.js/lib/languages/rust"; -import typescript from "npm:highlight.js/lib/languages/typescript"; - -hljs.registerLanguage("javascript", javascript); -hljs.registerLanguage("rust", rust); -hljs.registerLanguage("python", python); -hljs.registerLanguage("typescript", typescript); +import hljs from "deps/hljs.ts"; export class ChatResponse { element = (
); diff --git a/client/web/css/styles.css b/client/web/css/styles.css index 4db26de..6af56d0 100644 --- a/client/web/css/styles.css +++ b/client/web/css/styles.css @@ -30,7 +30,6 @@ nav { form input { width: 100%; - font-size: 16px; } :is(section, article, header) { diff --git a/client/web/index.html b/client/web/index.html index 1e42582..7097464 100644 --- a/client/web/index.html +++ b/client/web/index.html @@ -10,4 +10,11 @@ + diff --git a/deno.json b/deno.json index 877a9d4..d465cd2 100644 --- a/deno.json +++ b/deno.json @@ -8,7 +8,8 @@ "run": "deno task client:build --watch & deno task server:run" }, "imports": { - "@char/aftercare": "jsr:@char/aftercare@^0.3.0" + "@char/aftercare": "jsr:@char/aftercare@^0.3.0", + "deps/": "./client/deps/" }, "compilerOptions": { "lib": ["deno.window", "deno.unstable", "dom"], diff --git a/server/inference.py b/server/inference.py index 8437175..c872454 100644 --- a/server/inference.py +++ b/server/inference.py @@ -72,5 +72,8 @@ async def connect_to_conversation(ws: WebSocket): await ws.send_text(json({"d": response_tid})) # done (await response.to_sync_response()).log_to_db(db) - if conversation.name: - await ws.send_text(json({"n": conversation.name})) + if not conversation.name: + new_conversation_name = llm.cli.load_conversation(conversation.id).name + if new_conversation_name: + conversation.name = new_conversation_name + await ws.send_text(json({"n": new_conversation_name}))