switch to crypto lib

This commit is contained in:
Karl-Johan Alm
2024-11-19 21:39:35 +09:00
parent f25ea9f6d6
commit c2eaae3d42
3 changed files with 2 additions and 10 deletions

View File

@@ -16,7 +16,7 @@ import {
} from '../../constants.js';
import { forwardFetchResponse, trimV1, getConfigValue } from '../../util.js';
import { setAdditionalHeaders } from '../../additional-headers.js';
import { sha256 } from 'js-sha256';
import { createHash } from 'crypto';
export const router = express.Router();
@@ -261,7 +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();
chatTemplate['chat_template_hash'] = createHash('sha256').update(chatTemplate['chat_template']).digest('hex');
return response.send(chatTemplate);
} catch (error) {
console.error(error);