improve reasoning toggle tests and refactor model capability checks

This commit is contained in:
2026-09-21 21:46:22 +02:00
parent 6cb0cbcee0
commit a8e348e0c7
8 changed files with 217 additions and 75 deletions
+6 -5
View File
@@ -414,10 +414,11 @@ export function createChatsRouter({repositories, chatService, modelService, conf
chatId: req.validatedBody.chatId,
message: 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({reply: result.reply, ...(result.sources ? {sources: result.sources} : {})});
if (result.error) return res.status(result.status).json({error: result.error, ...(result.searchState ? {searchState: result.searchState} : {})});
return res.json({reply: result.reply, searchState: result.searchState, ...(result.sources ? {sources: result.sources} : {})});
} catch (error) {
const mapped = modelService.mapError(error);
return res.status(mapped.status).json(mapped.body);
@@ -457,9 +458,9 @@ export function createChatsRouter({repositories, chatService, modelService, conf
signal: generationController.signal
});
if (result.error) {
sendEvent("error", {error: result.error});
sendEvent("error", {error: result.error, ...(result.searchState ? {searchState: result.searchState} : {})});
} else {
sendEvent("done", {reply: result.reply, ...(result.sources ? {sources: result.sources} : {})});
sendEvent("done", {reply: result.reply, searchState: result.searchState, ...(result.sources ? {sources: result.sources} : {})});
}
} catch (error) {
const mapped = modelService.mapError(error);