| @@ -43,7 +43,6 @@ | |||
| 43 | "ip-matching": "^2.1.2", | 43 | "ip-matching": "^2.1.2", |
| 44 | "ipaddr.js": "^2.0.1", | 44 | "ipaddr.js": "^2.0.1", |
| 45 | "jimp": "^0.22.10", | 45 | "jimp": "^0.22.10", |
| 46 | "js-sha256": "^0.11.0", | ||
| 47 | "localforage": "^1.10.0", | 46 | "localforage": "^1.10.0", |
| 48 | "lodash": "^4.17.21", | 47 | "lodash": "^4.17.21", |
| 49 | "mime-types": "^2.1.35", | 48 | "mime-types": "^2.1.35", |
| @@ -4883,12 +4882,6 @@ | |||
| 4883 | "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==", | 4882 | "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==", |
| 4884 | "license": "BSD-3-Clause" | 4883 | "license": "BSD-3-Clause" |
| 4885 | }, | 4884 | }, |
| 4886 | "node_modules/js-sha256": { | ||
| 4887 | "version": "0.11.0", | ||
| 4888 | "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.11.0.tgz", | ||
| 4889 | "integrity": "sha512-6xNlKayMZvds9h1Y1VWc0fQHQ82BxTXizWPEtEeGvmOUYpBRy4gbWroHLpzowe6xiQhHpelCQiE7HEdznyBL9Q==", | ||
| 4890 | "license": "MIT" | ||
| 4891 | }, | ||
| 4892 | "node_modules/js-yaml": { | 4885 | "node_modules/js-yaml": { |
| 4893 | "version": "4.1.0", | 4886 | "version": "4.1.0", |
| 4894 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", | 4887 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", |
| @@ -33,7 +33,6 @@ | |||
| 33 | "ip-matching": "^2.1.2", | 33 | "ip-matching": "^2.1.2", |
| 34 | "ipaddr.js": "^2.0.1", | 34 | "ipaddr.js": "^2.0.1", |
| 35 | "jimp": "^0.22.10", | 35 | "jimp": "^0.22.10", |
| 36 | "js-sha256": "^0.11.0", | ||
| 37 | "localforage": "^1.10.0", | 36 | "localforage": "^1.10.0", |
| 38 | "lodash": "^4.17.21", | 37 | "lodash": "^4.17.21", |
| 39 | "mime-types": "^2.1.35", | 38 | "mime-types": "^2.1.35", |
| @@ -16,7 +16,7 @@ import { | |||
| 16 | } from '../../constants.js'; | 16 | } from '../../constants.js'; |
| 17 | import { forwardFetchResponse, trimV1, getConfigValue } from '../../util.js'; | 17 | import { forwardFetchResponse, trimV1, getConfigValue } from '../../util.js'; |
| 18 | import { setAdditionalHeaders } from '../../additional-headers.js'; | 18 | import { setAdditionalHeaders } from '../../additional-headers.js'; |
| 19 | import { sha256 } from 'js-sha256'; | 19 | import { createHash } from 'crypto'; |
| 20 | 20 | ||
| 21 | export const router = express.Router(); | 21 | export const router = express.Router(); |
| 22 | 22 | ||
| @@ -261,7 +261,7 @@ router.post('/chat_template', jsonParser, async function (request, response) { | |||
| 261 | 261 | ||
| 262 | /** @type {any} */ | 262 | /** @type {any} */ |
| 263 | const chatTemplate = await chatTemplateReply.json(); | 263 | const chatTemplate = await chatTemplateReply.json(); |
| 264 | chatTemplate['chat_template_hash'] = sha256.create().update(chatTemplate['chat_template']).hex(); | 264 | chatTemplate['chat_template_hash'] = createHash('sha256').update(chatTemplate['chat_template']).digest('hex'); |
| 265 | return response.send(chatTemplate); | 265 | return response.send(chatTemplate); |
| 266 | } catch (error) { | 266 | } catch (error) { |
| 267 | console.error(error); | 267 | console.error(error); |