From: stduhpf Date: Fri, 24 Jan 2025 08:02:38 +0000 (+0100) Subject: server : (webui) put DeepSeek R1 CoT in a collapsible
element (#11364) X-Git-Tag: upstream/0.0.4631~91 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=c07e87f38bd0c22ec6dbc852ae50aaa1c64632d4;p=pkg%2Fggml%2Fsources%2Fllama.cpp server : (webui) put DeepSeek R1 CoT in a collapsible
element (#11364) * webui : put DeepSeek R1 CoT in a collapsible
element * webui: refactor split * webui: don't use regex to split cot and response * webui: format+qol * webui: no loading icon if the model isn't generating * ui fix, add configs * add jsdoc types * only filter for assistant msg * build * update build --------- Co-authored-by: Xuan Son Nguyen --- diff --git a/examples/server/public/index.html.gz b/examples/server/public/index.html.gz index 26f3583b..582ccc0d 100644 Binary files a/examples/server/public/index.html.gz and b/examples/server/public/index.html.gz differ diff --git a/examples/server/webui/index.html b/examples/server/webui/index.html index 2180ef4a..d3893ea4 100644 --- a/examples/server/webui/index.html +++ b/examples/server/webui/index.html @@ -141,6 +141,7 @@ :msg="pendingMsg" :key="pendingMsg.id" :is-generating="isGenerating" + :show-thought-in-progress="config.showThoughtInProgress" :edit-user-msg-and-regenerate="() => {}" :regenerate-msg="() => {}"> @@ -202,6 +203,20 @@
+ +
+ Reasoning models +
+
+ + Expand though process by default for generating message +
+
+ + Exclude thought process when sending request to API (Recommended for DeepSeek-R1) +
+
+
Advanced config @@ -261,7 +276,17 @@
- +
+ + + + Thinking + + Thought Process + + +
+
`; } + +/** + * filter out redundant fields upon sending to API + * @param {Array} messages + * @returns {Array} + */ +function normalizeMsgsForAPI(messages) { + return messages.map((msg) => { + return { + role: msg.role, + content: msg.content, + }; + }); +} + +/** + * recommended for DeepsSeek-R1, filter out content between and tags + * @param {Array} messages + * @returns {Array} + */ +function filterThoughtFromMsgs(messages) { + return messages.map((msg) => { + return { + role: msg.role, + content: msg.role === 'assistant' + ? msg.content.split('').at(-1).trim() + : msg.content, + }; + }); +}