diff --git a/pages/index.tsx b/pages/index.tsx index 5d16933..02f2ebd 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -263,6 +263,7 @@ const Markdown = ({ children }: { children: string }) => { const ask = async ( query: string, context: [string, string][], + model: string, jwt?: string ) => { const res = await fetch(`/ai/ask`, { @@ -276,6 +277,7 @@ const ask = async ( .slice(1) .filter((c) => c[1] !== p429) .map((c) => ({ query: c[0], answer: c[1] })), + model, }), }); if (res.status === 429) { @@ -291,7 +293,10 @@ let contexts = [ ], ]; +const models = ["chatyuan", "chatvaala", "chatglm"]; + function Home() { + const [model, setModel] = useState(models[0]); const [query, setQuery] = useState(""); const [question, setQuestion] = useState(""); const [answer, setAnswer] = useState(""); @@ -323,7 +328,7 @@ function Home() { setTimeout(() => document.querySelector("#anchor")?.scrollIntoView(), 100); (async () => { - const ans = await ask(query, context, jwt || "").finally(() => { + const ans = await ask(query, context, model, jwt || "").finally(() => { setTimeout( () => document.querySelector("#anchor")?.scrollIntoView(), 300 @@ -377,6 +382,23 @@ pre > code { className={cn(styles.main, "px-2 md:px-16 xl:px-64")} style={{ width: "100dvw", height: "100dvh" }} > +