template derivation: move hash part to backend

This commit is contained in:
Karl-Johan Alm
2024-11-19 20:09:29 +09:00
parent 0e2fdf37a8
commit f25ea9f6d6
5 changed files with 13 additions and 15 deletions

View File

@@ -16,6 +16,7 @@ import {
} from '../../constants.js';
import { forwardFetchResponse, trimV1, getConfigValue } from '../../util.js';
import { setAdditionalHeaders } from '../../additional-headers.js';
import { sha256 } from 'js-sha256';
export const router = express.Router();
@@ -260,6 +261,7 @@ router.post('/chat_template', jsonParser, async function (request, response) {
/** @type {any} */
const chatTemplate = await chatTemplateReply.json();
chatTemplate['chat_template_hash'] = sha256.create().update(chatTemplate['chat_template']).hex();
return response.send(chatTemplate);
} catch (error) {
console.error(error);