hexo-theme-shokax 0.4.23 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.25",
|
4
4
|
"description": "a hexo theme based on shoka",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
|
@@ -28,6 +28,7 @@
|
|
28
28
|
},
|
29
29
|
"dependencies": {
|
30
30
|
"@algolia/client-search": "^5.21.0",
|
31
|
+
"@common.js/p-limit": "^6.1.0",
|
31
32
|
"@waline/client": "^3.5.6",
|
32
33
|
"algoliasearch": "5.21.0",
|
33
34
|
"dompurify": "^3.2.4",
|
@@ -44,7 +45,6 @@
|
|
44
45
|
"js-yaml": "^4.1.0",
|
45
46
|
"katex": "^0.16.21",
|
46
47
|
"mouse-firework": "^0.1.0",
|
47
|
-
"p-limit": "^6.2.0",
|
48
48
|
"quicklink": "^2.3.0",
|
49
49
|
"theme-shokax-anime": "^0.0.8",
|
50
50
|
"theme-shokax-pjax": "^0.0.3",
|
@@ -22,13 +22,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
22
22
|
));
|
23
23
|
var import_node_crypto = require("node:crypto");
|
24
24
|
var import_promises = __toESM(require("node:fs/promises"));
|
25
|
-
const config = hexo.theme.config.summary;
|
26
25
|
async function getSummaryByAPI(content) {
|
27
|
-
const apiKey = config.apiKey;
|
28
|
-
const apiUrl = config.apiUrl;
|
29
|
-
const model = config.model;
|
30
|
-
const temperature = config.temperature ?? 1.3;
|
31
|
-
const initalPrompt = config.initalPrompt;
|
26
|
+
const apiKey = hexo.theme.config.summary.apiKey;
|
27
|
+
const apiUrl = hexo.theme.config.summary.apiUrl;
|
28
|
+
const model = hexo.theme.config.summary.model;
|
29
|
+
const temperature = hexo.theme.config.summary.temperature ?? 1.3;
|
30
|
+
const initalPrompt = hexo.theme.config.summary.initalPrompt;
|
32
31
|
const res = await fetch(apiUrl, {
|
33
32
|
method: "POST",
|
34
33
|
headers: {
|
@@ -109,18 +108,16 @@ hexo.extend.generator.register("summary_ai", async function(locals) {
|
|
109
108
|
const db = new SummaryDatabase();
|
110
109
|
await db.readDB();
|
111
110
|
const postArray = posts.toArray();
|
112
|
-
const pLimit =
|
113
|
-
const concurrencyLimit = pLimit(config.concurrency || 5);
|
111
|
+
const pLimit = require("@common.js/p-limit").default;
|
112
|
+
const concurrencyLimit = pLimit(hexo.theme.config.summary?.concurrency || 5);
|
114
113
|
const processingPromises = postArray.map((post) => concurrencyLimit(async () => {
|
115
114
|
const content = post.content;
|
116
115
|
const path = post.path;
|
117
116
|
const published = post.published;
|
118
|
-
hexo.log.info(`[ShokaX Summary AI] \u6587\u7AE0 ${path} \u7684\u6458\u8981\u5904\u7406\u5F00\u59CB`);
|
119
117
|
if (content && path && published && content.length > 0) {
|
120
118
|
try {
|
121
119
|
const summary = await db.getPostSummary(path, content);
|
122
120
|
post.summary = summary;
|
123
|
-
hexo.log.info(`[ShokaX Summary AI] \u6587\u7AE0 ${path} \u7684\u6458\u8981\u5904\u7406\u5B8C\u6210`);
|
124
121
|
} catch (error) {
|
125
122
|
hexo.log.error(`[ShokaX Summary AI] \u5904\u7406\u6587\u7AE0 ${path} \u65F6\u51FA\u9519:`, error.message);
|
126
123
|
post.summary = `${error.message}`;
|