From fa225a423afcb476b5e51a4c1a29e1cb86b44302 Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Thu, 23 Jan 2025 23:41:54 +0100 Subject: [PATCH] ui fix, add configs --- examples/server/webui/index.html | 26 ++++++++++++++++++++++---- examples/server/webui/src/main.js | 17 ++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/examples/server/webui/index.html b/examples/server/webui/index.html index 3f4a9cd93..d3893ea4e 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,10 +276,13 @@
-
- - Thinking - Thought Process +
+ + + + Thinking + + Thought Process
diff --git a/examples/server/webui/src/main.js b/examples/server/webui/src/main.js index bd6a3ffaf..f9eebc417 100644 --- a/examples/server/webui/src/main.js +++ b/examples/server/webui/src/main.js @@ -50,6 +50,8 @@ const CONFIG_DEFAULT = { apiKey: '', systemMessage: 'You are a helpful assistant.', showTokensPerSecond: false, + showThoughtInProgress: false, + excludeThoughtOnReq: true, // make sure these default values are in sync with `common.h` samplers: 'edkypmxt', temperature: 0.8, @@ -172,6 +174,7 @@ const MessageBubble = defineComponent({ config: Object, msg: Object, isGenerating: Boolean, + showThoughtInProgress: Boolean, editUserMsgAndRegenerate: Function, regenerateMsg: Function, }, @@ -191,27 +194,27 @@ const MessageBubble = defineComponent({ }, splitMsgContent() { const content = this.msg.content; - if (this.msg.role !== "assistant") { + if (this.msg.role !== 'assistant') { return { content }; } - let actualContent = ""; - let cot = ""; + let actualContent = ''; + let cot = ''; let isThinking = false; - let thinkSplit = content.split("", 2); + let thinkSplit = content.split('', 2); actualContent += thinkSplit[0]; while (thinkSplit[1] !== undefined) { // tag found - thinkSplit = thinkSplit[1].split("", 2); + thinkSplit = thinkSplit[1].split('', 2); cot += thinkSplit[0]; isThinking = true; if (thinkSplit[1] !== undefined) { // closing tag found isThinking = false; - thinkSplit = thinkSplit[1].split("", 2); + thinkSplit = thinkSplit[1].split('', 2); actualContent += thinkSplit[0]; } } - return { content: actualContent, cot , isThinking}; + return { content: actualContent, cot, isThinking }; }, }, methods: {