show reasoning in frontend and some other stuff
This commit is contained in:
+7
-3
@@ -22,7 +22,8 @@ const sendMessageValidator = (body) => {
|
||||
if (!chatId) return {error: "chatId is required"};
|
||||
if (!message) return {error: "message is required"};
|
||||
if (body.webSearch !== undefined && typeof body.webSearch !== "boolean") return {error: "webSearch must be a boolean"};
|
||||
return {value: {message, chatId, model: String(body?.model || "qwen3:14b"), webSearch: body.webSearch === true}};
|
||||
if (body.reasoning !== undefined && typeof body.reasoning !== "boolean") return {error: "reasoning must be a boolean"};
|
||||
return {value: {message, chatId, model: String(body?.model || "qwen3:14b"), webSearch: body.webSearch === true, reasoning: body.reasoning === true}};
|
||||
};
|
||||
|
||||
const organizationValidator = (body) => ({
|
||||
@@ -236,7 +237,8 @@ export function createChatsRouter({repositories, chatService, modelService, conf
|
||||
targetMessage,
|
||||
content: req.validatedBody.message,
|
||||
model: req.validatedBody.model,
|
||||
webSearch: req.validatedBody.webSearch
|
||||
webSearch: req.validatedBody.webSearch,
|
||||
reasoning: req.validatedBody.reasoning
|
||||
});
|
||||
if (result.error) return res.status(result.status).json({error: result.error});
|
||||
return res.json(result);
|
||||
@@ -431,7 +433,8 @@ export function createChatsRouter({repositories, chatService, modelService, conf
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "text/event-stream",
|
||||
"Cache-Control": "no-cache, no-transform",
|
||||
Connection: "keep-alive"
|
||||
Connection: "keep-alive",
|
||||
"X-Accel-Buffering": "no"
|
||||
});
|
||||
|
||||
const sendEvent = (event, data) => {
|
||||
@@ -449,6 +452,7 @@ export function createChatsRouter({repositories, chatService, modelService, conf
|
||||
onChunk: (chunk, fullReply) => sendEvent("chunk", {chunk, fullReply}),
|
||||
onThinking: (chunk, fullThinking) => sendEvent("thinking", {chunk, fullThinking}),
|
||||
webSearch: req.validatedBody.webSearch,
|
||||
reasoning: req.validatedBody.reasoning,
|
||||
onStatus: (status) => sendEvent("status", status),
|
||||
signal: generationController.signal
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user