@lmcc-dev/mult-fetch-mcp-server 1.2.1 → 1.3.1
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/README.md +80 -29
- package/README.zh.md +80 -29
- package/dist/i18n-test-report.json +2 -2
- package/dist/i18n-unused-keys-report.json +4 -4
- package/dist/src/client.js +522 -131
- package/dist/src/index.js +0 -0
- package/dist/src/lib/fetch.js +8 -0
- package/dist/src/lib/fetchers/browser/BrowserFetcher.js +139 -199
- package/dist/src/lib/fetchers/common/BaseFetcher.js +203 -0
- package/dist/src/lib/fetchers/common/types.js +4 -0
- package/dist/src/lib/fetchers/common/utils.js +1 -1
- package/dist/src/lib/fetchers/index.js +11 -0
- package/dist/src/lib/fetchers/node/NodeFetcher.js +91 -66
- package/dist/src/lib/i18n/keys/browser.js +40 -2
- package/dist/src/lib/i18n/keys/chunkManager.js +43 -0
- package/dist/src/lib/i18n/keys/client.js +53 -1
- package/dist/src/lib/i18n/keys/contentSize.js +20 -0
- package/dist/src/lib/i18n/keys/fetcher.js +88 -79
- package/dist/src/lib/i18n/keys/index.js +4 -0
- package/dist/src/lib/i18n/keys/node.js +7 -1
- package/dist/src/lib/i18n/keys/processor.js +30 -0
- package/dist/src/lib/i18n/keys/tools.js +5 -1
- package/dist/src/lib/i18n/keys/url.js +45 -0
- package/dist/src/lib/i18n/keys.js +25 -0
- package/dist/src/lib/i18n/locales/en/browser.js +52 -14
- package/dist/src/lib/i18n/locales/en/chunkManager.js +41 -0
- package/dist/src/lib/i18n/locales/en/client.js +62 -9
- package/dist/src/lib/i18n/locales/en/contentSize.js +17 -0
- package/dist/src/lib/i18n/locales/en/fetcher.js +50 -30
- package/dist/src/lib/i18n/locales/en/index.js +9 -1
- package/dist/src/lib/i18n/locales/en/node.js +26 -20
- package/dist/src/lib/i18n/locales/en/processor.js +28 -0
- package/dist/src/lib/i18n/locales/en/tools.js +5 -1
- package/dist/src/lib/i18n/locales/en/url.js +40 -0
- package/dist/src/lib/i18n/locales/en.js +51 -0
- package/dist/src/lib/i18n/locales/zh/browser.js +85 -47
- package/dist/src/lib/i18n/locales/zh/chunkManager.js +41 -0
- package/dist/src/lib/i18n/locales/zh/client.js +53 -1
- package/dist/src/lib/i18n/locales/zh/contentSize.js +17 -0
- package/dist/src/lib/i18n/locales/zh/fetcher.js +67 -47
- package/dist/src/lib/i18n/locales/zh/index.js +9 -1
- package/dist/src/lib/i18n/locales/zh/node.js +50 -44
- package/dist/src/lib/i18n/locales/zh/processor.js +28 -0
- package/dist/src/lib/i18n/locales/zh/tools.js +5 -1
- package/dist/src/lib/i18n/locales/zh/url.js +40 -0
- package/dist/src/lib/i18n/locales/zh.js +51 -0
- package/dist/src/lib/logger.js +11 -2
- package/dist/src/lib/server/fetcher.js +15 -5
- package/dist/src/lib/server/tools.js +202 -52
- package/dist/src/lib/types.js +5 -0
- package/dist/src/lib/utils/ChunkManager.js +177 -0
- package/dist/src/lib/utils/ContentProcessor.js +134 -0
- package/dist/src/lib/utils/ContentSizeManager.js +123 -0
- package/dist/src/lib/utils/TemplateUtils.js +71 -0
- package/dist/src/lib/utils/errors.js +2 -8
- package/dist/src/mcp-server.js +0 -0
- package/dist/src/test-i18n.js +0 -0
- package/dist/tests/BrowserFetcher.test.js +0 -0
- package/dist/tests/NodeFetcher.test.js +0 -0
- package/dist/tests/client.test.js +0 -0
- package/dist/tests/fetch.test.js +0 -0
- package/dist/tests/fetchers/plain-text.test.js +146 -0
- package/dist/tests/i18n-missing-keys.js +0 -0
- package/dist/tests/i18n-remove-unused-keys.js +0 -0
- package/dist/tests/i18n-unused-keys.js +0 -0
- package/dist/tests/i18n.test.js +0 -0
- package/dist/tests/logger.test.js +0 -0
- package/dist/tests/mcp-server.test.js +0 -0
- package/dist/tests/server/fetcher.test.js +69 -15
- package/dist/tests/server/tools.test.js +165 -16
- package/dist/tests/setup.js +0 -0
- package/dist/tests/test-direct-client.js +113 -5
- package/dist/tests/test-i18n.js +0 -0
- package/dist/tests/test-mcp-methods.js +67 -1
- package/dist/tests/test-mcp.js +83 -3
- package/dist/tests/test-mini4k.js +90 -3
- package/dist/tests/types.test.js +0 -0
- package/dist/tests/utils/ChunkManager.test.js +163 -0
- package/dist/tests/utils/ContentSizeManager.test.js +170 -0
- package/dist/vitest.config.js +0 -0
- package/package.json +28 -23
|
@@ -28,6 +28,48 @@ export default {
|
|
|
28
28
|
[CLIENT_KEYS.fetchingMarkdown]: '正在获取 Markdown: {{url}}',
|
|
29
29
|
[CLIENT_KEYS.fetchSuccessful]: '获取成功',
|
|
30
30
|
[CLIENT_KEYS.contentLength]: '内容长度: {{length}} 字节',
|
|
31
|
+
// 分段内容相关 (Chunked content related)
|
|
32
|
+
[CLIENT_KEYS.hasMoreChunks]: '内容已分段: {{current}}/{{total}} 段',
|
|
33
|
+
[CLIENT_KEYS.nextChunkCommand]: '获取下一段内容,请运行: {{command}}',
|
|
34
|
+
[CLIENT_KEYS.chunkInfoSaved]: '分段信息已保存到 {{file}}',
|
|
35
|
+
[CLIENT_KEYS.chunkInfoSaveError]: '保存分段信息失败: {{error}}',
|
|
36
|
+
[CLIENT_KEYS.chunkInfoLoaded]: '已从 {{file}} 加载分段信息',
|
|
37
|
+
[CLIENT_KEYS.chunkInfoLoadError]: '加载分段信息失败: {{error}}',
|
|
38
|
+
[CLIENT_KEYS.noChunkInfo]: '未找到之前的分段信息',
|
|
39
|
+
[CLIENT_KEYS.fetchingNextChunk]: '正在获取下一段内容 ({{chunkIndex}}/{{total}})',
|
|
40
|
+
[CLIENT_KEYS.chunkUsageInfo]: '对于分段内容: 使用 --all-chunks 一次性获取所有分段',
|
|
41
|
+
[CLIENT_KEYS.invalidChunkIndex]: '无效的分段索引: {{index}}',
|
|
42
|
+
[CLIENT_KEYS.missingMethodOrUrl]: '缺少方法或URL参数',
|
|
43
|
+
[CLIENT_KEYS.fetchingAllChunks]: '正在获取所有分段内容,共 {{total}} 段',
|
|
44
|
+
[CLIENT_KEYS.fetchingChunk]: '正在获取第 {{index}}/{{total}} 段内容',
|
|
45
|
+
[CLIENT_KEYS.fetchChunkFailed]: '获取第 {{index}} 段内容失败: {{error}}',
|
|
46
|
+
[CLIENT_KEYS.allChunksFetched]: '所有分段内容获取完成,共 {{total}} 段',
|
|
47
|
+
[CLIENT_KEYS.allChunksCommand]: '一次性获取所有分段内容,请运行: {{command}}',
|
|
48
|
+
[CLIENT_KEYS.allChunksUsageInfo]: '使用 --all-chunks 参数一次性获取所有分段内容',
|
|
49
|
+
[CLIENT_KEYS.limitingChunks]: '限制获取分段数量为 {{limit}} (总计: {{total}})',
|
|
50
|
+
[CLIENT_KEYS.maxChunksUsageInfo]: '使用 --max-chunks=N 参数限制获取的分段数量 (默认: {{default}})',
|
|
51
|
+
// 新增的分段内容相关键 (New chunked content related keys)
|
|
52
|
+
[CLIENT_KEYS.responseStructure]: '\n--- 响应结构 (Response structure) ---\n{{structure}}\n--- 响应结构结束 (End of response structure) ---\n',
|
|
53
|
+
[CLIENT_KEYS.parsedByteChunkInfo]: '\n--- 解析后的字节级分段信息 (Parsed byte-level chunk information) ---\nchunkId: {{chunkId}}\nfetchedBytes: {{fetchedBytes}}\ntotalBytes: {{totalBytes}}\nremainingBytes: {{remainingBytes}}\nestimatedRemainingRequests: {{estimatedRemainingRequests}}\n--- 解析后的字节级分段信息结束 (End of parsed byte-level chunk information) ---\n',
|
|
54
|
+
[CLIENT_KEYS.parsedChunkInfo]: '\n--- 解析后的分段信息 (Parsed chunk information) ---\nchunkId: {{chunkId}}\ncurrentChunk: {{currentChunk}}\ntotalChunks: {{totalChunks}}\nhasMoreChunks: {{hasMoreChunks}}\n--- 解析后的分段信息结束 (End of parsed chunk information) ---\n',
|
|
55
|
+
[CLIENT_KEYS.chunkLimitNotice]: '\n注意:内容共有 {{total}} 段,但只获取前 {{fetching}} 段',
|
|
56
|
+
[CLIENT_KEYS.chunkLimitHint]: '要获取更多分段,请使用 --max-chunks=N 参数 (To fetch more chunks, use --max-chunks=N parameter)\n',
|
|
57
|
+
[CLIENT_KEYS.fetchingChunkProgress]: '\n正在获取第 {{current}}/{{total}} 段内容...',
|
|
58
|
+
[CLIENT_KEYS.fetchChunkFailedError]: '\n获取第 {{index}} 段内容失败: {{error}}\n',
|
|
59
|
+
[CLIENT_KEYS.chunkContent]: '\n--- 第 {{index}} 段内容 ---\n',
|
|
60
|
+
[CLIENT_KEYS.chunkSeparator]: '\n' + '-'.repeat(80),
|
|
61
|
+
[CLIENT_KEYS.partialChunksFetched]: '\n已获取 {{fetched}}/{{total}} 段内容\n',
|
|
62
|
+
[CLIENT_KEYS.completeChunksFetched]: '\n所有分段内容获取完成,共 {{total}} 段\n',
|
|
63
|
+
[CLIENT_KEYS.fetchingChunksErrorMessage]: '\n获取分块内容时出错: {{error}}\n',
|
|
64
|
+
[CLIENT_KEYS.contentChunkedBytes]: '\n内容已分段: 已获取 {{fetched}} 字节,总共 {{total}} 字节',
|
|
65
|
+
[CLIENT_KEYS.contentChunkedCount]: '\n内容已分段: {{current}}/{{total}} 段',
|
|
66
|
+
[CLIENT_KEYS.fetchAllChunksHint]: '获取所有分段内容,请运行:\n{{command}}\n',
|
|
67
|
+
[CLIENT_KEYS.fetchLimitedChunksHint]: '获取前 {{limit}} 段内容,请运行:\n{{command}}\n',
|
|
68
|
+
[CLIENT_KEYS.firstChunkCompleted]: '\n第一段内容已完成: {{index}}/{{total}}\n',
|
|
69
|
+
[CLIENT_KEYS.chunkProgress]: '\n第 {{current}}/{{total}} 段完成,已获取 {{fetchedBytes}}/{{totalBytes}} 字节 ({{percent}}%)\n',
|
|
70
|
+
[CLIENT_KEYS.chunkCompleted]: '\n第 {{current}}/{{total}} 段完成\n',
|
|
71
|
+
[CLIENT_KEYS.recalculatedTotalChunks]: '重新计算总块数: {{totalChunks}} (基于总字节数: {{totalBytes}}, 已获取字节数: {{fetchedBytes}}, 剩余字节数: {{remainingBytes}}, 内容大小限制: {{contentSizeLimit}})',
|
|
72
|
+
[CLIENT_KEYS.fetchingChunksError]: '获取分块内容时发生错误: {{error}}',
|
|
31
73
|
// 调试相关 (Debug related)
|
|
32
74
|
[CLIENT_KEYS.debugMode]: '调试模式: {{enabled}}',
|
|
33
75
|
[CLIENT_KEYS.debugInfo]: '调试信息: {{info}}',
|
|
@@ -39,6 +81,7 @@ export default {
|
|
|
39
81
|
[CLIENT_KEYS.statusCodeDetected]: '检测到状态码: {{code}}',
|
|
40
82
|
[CLIENT_KEYS.usageInfo]: '使用信息: {{info}}',
|
|
41
83
|
[CLIENT_KEYS.exampleUsage]: '使用示例: {{example}}',
|
|
84
|
+
[CLIENT_KEYS.alternateUsageInfo]: '对于替代格式,使用 --plaintext 或 --markdown 标志',
|
|
42
85
|
[CLIENT_KEYS.invalidJson]: '无效的 JSON: {{error}}',
|
|
43
86
|
[CLIENT_KEYS.usingCommandLineProxy]: '使用命令行代理: {{proxy}}',
|
|
44
87
|
[CLIENT_KEYS.invalidProxyFormat]: '无效的代理格式: {{proxy}}',
|
|
@@ -60,5 +103,14 @@ export default {
|
|
|
60
103
|
[CLIENT_KEYS.browserModeFetchFailed]: '浏览器模式获取失败: {{error}}',
|
|
61
104
|
[CLIENT_KEYS.browserModeFetchSuccess]: '浏览器模式获取成功',
|
|
62
105
|
[CLIENT_KEYS.serverClosed]: '服务器已关闭',
|
|
63
|
-
[CLIENT_KEYS.proxySet]: '代理已设置: {{proxy}}'
|
|
106
|
+
[CLIENT_KEYS.proxySet]: '代理已设置: {{proxy}}',
|
|
107
|
+
// 模式相关 (Mode related)
|
|
108
|
+
[CLIENT_KEYS.usingStandardMode]: '使用标准模式',
|
|
109
|
+
[CLIENT_KEYS.usingBrowserMode]: '使用浏览器模式',
|
|
110
|
+
[CLIENT_KEYS.switchingToBrowserMode]: '正在切换至浏览器模式',
|
|
111
|
+
// 参数相关 (Parameters related)
|
|
112
|
+
[CLIENT_KEYS.sendingParameters]: '正在发送参数到 MCP: {{params}}',
|
|
113
|
+
[CLIENT_KEYS.invalidUrl]: '无效的 URL: {{url}}',
|
|
114
|
+
[CLIENT_KEYS.missingUrl]: '缺少 URL 参数',
|
|
115
|
+
[CLIENT_KEYS.missingStartCursor]: '缺少 startCursor 参数'
|
|
64
116
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
import { CONTENT_SIZE_KEYS } from '../../keys/contentSize.js';
|
|
7
|
+
/**
|
|
8
|
+
* 内容大小相关的中文文本 (Chinese texts related to content size)
|
|
9
|
+
*/
|
|
10
|
+
export const contentSizeZh = {
|
|
11
|
+
[CONTENT_SIZE_KEYS.checking]: '检查内容大小: {{contentSize}}, 限制: {{limit}}, 是否超过限制: {{exceedsLimit}}',
|
|
12
|
+
[CONTENT_SIZE_KEYS.truncating]: '内容大小超过限制,正在截断。原始大小: {{originalSize}}, 限制: {{limit}}',
|
|
13
|
+
[CONTENT_SIZE_KEYS.truncated]: '内容已截断。最终大小: {{finalSize}}, 限制: {{limit}}',
|
|
14
|
+
[CONTENT_SIZE_KEYS.splitting]: '内容大小超过限制,正在分段。原始大小: {{originalSize}}, 分段大小: {{chunkSize}}',
|
|
15
|
+
[CONTENT_SIZE_KEYS.splitComplete]: '内容分段完成。共{{chunks}}个分段,平均大小: {{avgChunkSize}}',
|
|
16
|
+
[CONTENT_SIZE_KEYS.splitIntoChunks]: '正在将内容分割成{{chunkCount}}个分块,每个分块约{{chunkSize}}字节'
|
|
17
|
+
};
|
|
@@ -4,71 +4,91 @@
|
|
|
4
4
|
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
5
|
*/
|
|
6
6
|
import { FETCHER_KEYS } from '../../keys/fetcher.js';
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 获取器相关的中文文本 (Chinese texts related to fetcher)
|
|
9
|
+
*/
|
|
8
10
|
export default {
|
|
9
|
-
|
|
10
|
-
[FETCHER_KEYS.
|
|
11
|
+
// 内容大小相关 (Content size related)
|
|
12
|
+
[FETCHER_KEYS.contentLength]: "内容长度: {{length}} 字节",
|
|
13
|
+
[FETCHER_KEYS.contentTooLarge]: "内容过大: {{size}} 字节,限制: {{limit}} 字节",
|
|
14
|
+
[FETCHER_KEYS.contentTruncated]: "内容已从 {{originalSize}} 截断至 {{truncatedSize}} 字节",
|
|
15
|
+
// 分块处理相关 (Chunk processing related)
|
|
16
|
+
[FETCHER_KEYS.chunkRetrievalFailed]: "获取分块失败: {{error}}",
|
|
17
|
+
[FETCHER_KEYS.gettingChunkBySize]: "按大小获取内容分块,起始: {{start}},结束: {{end}}",
|
|
18
|
+
[FETCHER_KEYS.chunkNotFound]: "未找到分块: {{chunkId}}",
|
|
19
|
+
// 获取类型相关 (Fetch type related)
|
|
20
|
+
[FETCHER_KEYS.fetchingPlainText]: "获取纯文本内容",
|
|
21
|
+
// 延迟相关 (Delay related)
|
|
22
|
+
[FETCHER_KEYS.addingDelay]: "添加延迟: {{delay}}毫秒",
|
|
23
|
+
[FETCHER_KEYS.delayCompleted]: "延迟完成",
|
|
24
|
+
// 代理相关 (Proxy related)
|
|
11
25
|
[FETCHER_KEYS.usingProxy]: "使用代理: {{proxy}}",
|
|
12
|
-
[FETCHER_KEYS.usingSpecifiedProxy]: "
|
|
26
|
+
[FETCHER_KEYS.usingSpecifiedProxy]: "使用指定的代理: {{proxy}}",
|
|
13
27
|
[FETCHER_KEYS.attemptingToUseSystemProxy]: "尝试使用系统代理",
|
|
14
|
-
[FETCHER_KEYS.notUsingProxy]: "
|
|
28
|
+
[FETCHER_KEYS.notUsingProxy]: "不使用代理",
|
|
15
29
|
[FETCHER_KEYS.finalProxyUsed]: "最终使用的代理: {{proxy}}",
|
|
16
|
-
[FETCHER_KEYS.noProxy]: "
|
|
17
|
-
[FETCHER_KEYS.foundNoProxy]: "
|
|
30
|
+
[FETCHER_KEYS.noProxy]: "无代理",
|
|
31
|
+
[FETCHER_KEYS.foundNoProxy]: "找到NO_PROXY设置: {{noProxy}}",
|
|
32
|
+
[FETCHER_KEYS.usingHttpsProxy]: "使用HTTPS代理",
|
|
33
|
+
[FETCHER_KEYS.usingHttpProxy]: "使用HTTP代理",
|
|
18
34
|
[FETCHER_KEYS.systemProxyDisabled]: "系统代理已禁用",
|
|
19
|
-
|
|
20
|
-
[FETCHER_KEYS.
|
|
21
|
-
[FETCHER_KEYS.
|
|
22
|
-
[FETCHER_KEYS.usingHttpProxy]: "使用 HTTP 代理",
|
|
35
|
+
// 请求相关 (Request related)
|
|
36
|
+
[FETCHER_KEYS.fetchingUrl]: "获取URL: {{url}}",
|
|
37
|
+
[FETCHER_KEYS.usingUserAgent]: "使用User-Agent: {{userAgent}}",
|
|
23
38
|
[FETCHER_KEYS.requestOptions]: "请求选项: {{options}}",
|
|
24
|
-
[FETCHER_KEYS.startingFetch]: "
|
|
25
|
-
[FETCHER_KEYS.fetchCompleted]: "
|
|
26
|
-
|
|
27
|
-
[FETCHER_KEYS.
|
|
28
|
-
[FETCHER_KEYS.
|
|
39
|
+
[FETCHER_KEYS.startingFetch]: "开始获取: {{url}}",
|
|
40
|
+
[FETCHER_KEYS.fetchCompleted]: "获取完成",
|
|
41
|
+
// 响应相关 (Response related)
|
|
42
|
+
[FETCHER_KEYS.responseStatus]: "响应状态: {{status}}",
|
|
43
|
+
[FETCHER_KEYS.redirectingTo]: "重定向到: {{url}}",
|
|
44
|
+
[FETCHER_KEYS.constructedFullRedirectUrl]: "构建完整重定向URL: {{url}}",
|
|
29
45
|
[FETCHER_KEYS.requestSuccess]: "请求成功",
|
|
30
|
-
|
|
31
|
-
[FETCHER_KEYS.
|
|
32
|
-
[FETCHER_KEYS.
|
|
46
|
+
// 错误相关 (Error related)
|
|
47
|
+
[FETCHER_KEYS.errorResponse]: "错误响应: {{status}}",
|
|
48
|
+
[FETCHER_KEYS.errorResponseBody]: "错误响应体: {{body}}",
|
|
49
|
+
[FETCHER_KEYS.errorReadingBody]: "读取响应体出错: {{error}}",
|
|
33
50
|
[FETCHER_KEYS.fetchError]: "获取错误: {{error}}",
|
|
34
|
-
[FETCHER_KEYS.requestAborted]: "
|
|
35
|
-
[FETCHER_KEYS.networkError]: "
|
|
36
|
-
[FETCHER_KEYS.requestTimeout]: "
|
|
51
|
+
[FETCHER_KEYS.requestAborted]: "请求已中止",
|
|
52
|
+
[FETCHER_KEYS.networkError]: "网络错误: {{error}}",
|
|
53
|
+
[FETCHER_KEYS.requestTimeout]: "请求超时: {{timeout}}毫秒",
|
|
37
54
|
[FETCHER_KEYS.fetchFailed]: "获取失败: {{error}}",
|
|
38
|
-
[FETCHER_KEYS.tooManyRedirects]: "重定向次数过多
|
|
39
|
-
|
|
40
|
-
[FETCHER_KEYS.
|
|
41
|
-
[FETCHER_KEYS.
|
|
42
|
-
[FETCHER_KEYS.
|
|
43
|
-
[FETCHER_KEYS.
|
|
55
|
+
[FETCHER_KEYS.tooManyRedirects]: "重定向次数过多",
|
|
56
|
+
// 内容类型相关 (Content type related)
|
|
57
|
+
[FETCHER_KEYS.startingHtmlFetch]: "开始获取HTML",
|
|
58
|
+
[FETCHER_KEYS.fetchingHtml]: "获取HTML",
|
|
59
|
+
[FETCHER_KEYS.fetchingJson]: "获取JSON",
|
|
60
|
+
[FETCHER_KEYS.fetchingTxt]: "获取文本",
|
|
61
|
+
[FETCHER_KEYS.fetchingMarkdown]: "获取Markdown",
|
|
44
62
|
[FETCHER_KEYS.readingText]: "读取文本内容",
|
|
45
|
-
[FETCHER_KEYS.htmlContentLength]: "HTML
|
|
46
|
-
[FETCHER_KEYS.startingJsonFetch]: "开始获取
|
|
47
|
-
[FETCHER_KEYS.parsingJson]: "解析
|
|
48
|
-
[FETCHER_KEYS.jsonParsed]: "JSON
|
|
49
|
-
[FETCHER_KEYS.jsonParseError]: "JSON
|
|
63
|
+
[FETCHER_KEYS.htmlContentLength]: "HTML内容长度: {{length}} 字节",
|
|
64
|
+
[FETCHER_KEYS.startingJsonFetch]: "开始获取JSON",
|
|
65
|
+
[FETCHER_KEYS.parsingJson]: "解析JSON",
|
|
66
|
+
[FETCHER_KEYS.jsonParsed]: "JSON解析成功",
|
|
67
|
+
[FETCHER_KEYS.jsonParseError]: "JSON解析错误: {{error}}",
|
|
50
68
|
[FETCHER_KEYS.startingTxtFetch]: "开始获取文本",
|
|
51
69
|
[FETCHER_KEYS.textContentLength]: "文本内容长度: {{length}} 字节",
|
|
52
|
-
[FETCHER_KEYS.startingMarkdownFetch]: "开始获取
|
|
53
|
-
[FETCHER_KEYS.creatingTurndown]: "创建
|
|
54
|
-
[FETCHER_KEYS.convertingToMarkdown]: "转换为
|
|
55
|
-
[FETCHER_KEYS.markdownContentLength]: "Markdown
|
|
70
|
+
[FETCHER_KEYS.startingMarkdownFetch]: "开始获取Markdown",
|
|
71
|
+
[FETCHER_KEYS.creatingTurndown]: "创建Turndown服务",
|
|
72
|
+
[FETCHER_KEYS.convertingToMarkdown]: "将HTML转换为Markdown",
|
|
73
|
+
[FETCHER_KEYS.markdownContentLength]: "Markdown内容长度: {{length}} 字节",
|
|
74
|
+
// 系统代理相关 (System proxy related)
|
|
56
75
|
[FETCHER_KEYS.checkingProxyEnv]: "检查代理环境变量",
|
|
57
|
-
[FETCHER_KEYS.envVarValue]: "环境变量 {{
|
|
76
|
+
[FETCHER_KEYS.envVarValue]: "环境变量 {{name}}: {{value}}",
|
|
58
77
|
[FETCHER_KEYS.foundSystemProxy]: "找到系统代理: {{proxy}}",
|
|
59
78
|
[FETCHER_KEYS.systemCommandProxySettings]: "系统命令代理设置: {{output}}",
|
|
60
79
|
[FETCHER_KEYS.foundProxyFromCommand]: "从命令中找到代理: {{proxy}}",
|
|
61
|
-
[FETCHER_KEYS.errorGettingProxyFromCommand]: "
|
|
62
|
-
[FETCHER_KEYS.checkingSystemEnvVars]: "
|
|
63
|
-
[FETCHER_KEYS.windowsEnvVars]: "Windows
|
|
64
|
-
[FETCHER_KEYS.foundWindowsEnvProxy]: "找到
|
|
65
|
-
[FETCHER_KEYS.errorGettingWindowsEnvVars]: "获取
|
|
66
|
-
[FETCHER_KEYS.unixEnvVars]: "Unix
|
|
67
|
-
[FETCHER_KEYS.foundUnixEnvProxy]: "找到
|
|
68
|
-
[FETCHER_KEYS.errorGettingUnixEnvVars]: "获取
|
|
80
|
+
[FETCHER_KEYS.errorGettingProxyFromCommand]: "获取命令代理时出错: {{error}}",
|
|
81
|
+
[FETCHER_KEYS.checkingSystemEnvVars]: "检查系统环境变量",
|
|
82
|
+
[FETCHER_KEYS.windowsEnvVars]: "Windows环境变量: {{vars}}",
|
|
83
|
+
[FETCHER_KEYS.foundWindowsEnvProxy]: "找到Windows环境代理: {{proxy}}",
|
|
84
|
+
[FETCHER_KEYS.errorGettingWindowsEnvVars]: "获取Windows环境变量时出错: {{error}}",
|
|
85
|
+
[FETCHER_KEYS.unixEnvVars]: "Unix环境变量: {{vars}}",
|
|
86
|
+
[FETCHER_KEYS.foundUnixEnvProxy]: "找到Unix环境代理: {{proxy}}",
|
|
87
|
+
[FETCHER_KEYS.errorGettingUnixEnvVars]: "获取Unix环境变量时出错: {{error}}",
|
|
69
88
|
[FETCHER_KEYS.errorGettingSystemEnvVars]: "获取系统环境变量时出错: {{error}}",
|
|
70
89
|
[FETCHER_KEYS.noSystemProxyFound]: "未找到系统代理",
|
|
90
|
+
// 通用 (General)
|
|
71
91
|
[FETCHER_KEYS.notSet]: "未设置",
|
|
72
|
-
[FETCHER_KEYS.debug]: "{{message}}",
|
|
92
|
+
[FETCHER_KEYS.debug]: "调试: {{message}}",
|
|
73
93
|
[FETCHER_KEYS.none]: "无"
|
|
74
94
|
};
|
|
@@ -13,6 +13,10 @@ import tools from './tools.js';
|
|
|
13
13
|
import errors from './errors.js';
|
|
14
14
|
import resources from './resources.js';
|
|
15
15
|
import prompts from './prompts.js';
|
|
16
|
+
import url from './url.js';
|
|
17
|
+
import { contentSizeZh as contentSize } from './contentSize.js';
|
|
18
|
+
import { chunkManagerZh as chunkManager } from './chunkManager.js';
|
|
19
|
+
import { processorZh as processor } from './processor.js';
|
|
16
20
|
// 中文翻译资源 (Chinese translation resources)
|
|
17
21
|
export const zhTranslation = {
|
|
18
22
|
server,
|
|
@@ -24,5 +28,9 @@ export const zhTranslation = {
|
|
|
24
28
|
tools,
|
|
25
29
|
errors,
|
|
26
30
|
resources,
|
|
27
|
-
prompts
|
|
31
|
+
prompts,
|
|
32
|
+
url,
|
|
33
|
+
contentSize,
|
|
34
|
+
chunkManager,
|
|
35
|
+
processor
|
|
28
36
|
};
|
|
@@ -7,61 +7,67 @@ import { NODE_KEYS } from '../../keys/node.js';
|
|
|
7
7
|
// Node 相关消息 (Node related messages)
|
|
8
8
|
export default {
|
|
9
9
|
// 延迟和代理相关 (Delay and proxy related)
|
|
10
|
-
[NODE_KEYS.addingDelay]: '添加延迟: {{delay}}
|
|
10
|
+
[NODE_KEYS.addingDelay]: '添加延迟: {{delay}}毫秒',
|
|
11
11
|
[NODE_KEYS.noProxy]: '无代理',
|
|
12
12
|
[NODE_KEYS.usingProxy]: '使用代理: {{proxy}}',
|
|
13
13
|
[NODE_KEYS.usingHttpsProxy]: '使用HTTPS代理',
|
|
14
14
|
[NODE_KEYS.usingHttpProxy]: '使用HTTP代理',
|
|
15
15
|
// 系统代理相关 (System proxy related)
|
|
16
16
|
[NODE_KEYS.checkingProxyEnv]: '检查代理环境变量',
|
|
17
|
-
[NODE_KEYS.envVarValue]: '环境变量 {{
|
|
18
|
-
[NODE_KEYS.foundSystemProxy]: '
|
|
19
|
-
[NODE_KEYS.checkingSystemEnvVars]: '
|
|
20
|
-
[NODE_KEYS.windowsEnvVars]: 'Windows环境变量: {{
|
|
21
|
-
[NODE_KEYS.foundWindowsEnvProxy]: '
|
|
22
|
-
[NODE_KEYS.errorGettingWindowsEnvVars]: '获取Windows
|
|
23
|
-
[NODE_KEYS.unixEnvVars]: 'Unix环境变量: {{
|
|
24
|
-
[NODE_KEYS.foundUnixEnvProxy]: '
|
|
25
|
-
[NODE_KEYS.errorGettingUnixEnvVars]: '获取Unix
|
|
26
|
-
[NODE_KEYS.noSystemProxyFound]: '
|
|
27
|
-
[NODE_KEYS.errorGettingSystemEnvVars]: '
|
|
28
|
-
[NODE_KEYS.foundNoProxy]: '
|
|
17
|
+
[NODE_KEYS.envVarValue]: '环境变量 {{name}}: {{value}}',
|
|
18
|
+
[NODE_KEYS.foundSystemProxy]: '发现系统代理: {{proxy}}',
|
|
19
|
+
[NODE_KEYS.checkingSystemEnvVars]: '检查系统环境变量',
|
|
20
|
+
[NODE_KEYS.windowsEnvVars]: 'Windows环境变量: {{vars}}',
|
|
21
|
+
[NODE_KEYS.foundWindowsEnvProxy]: '发现Windows环境代理: {{proxy}}',
|
|
22
|
+
[NODE_KEYS.errorGettingWindowsEnvVars]: '获取Windows环境变量出错: {{error}}',
|
|
23
|
+
[NODE_KEYS.unixEnvVars]: 'Unix环境变量: {{vars}}',
|
|
24
|
+
[NODE_KEYS.foundUnixEnvProxy]: '发现Unix环境代理: {{proxy}}',
|
|
25
|
+
[NODE_KEYS.errorGettingUnixEnvVars]: '获取Unix环境变量出错: {{error}}',
|
|
26
|
+
[NODE_KEYS.noSystemProxyFound]: '未发现系统代理',
|
|
27
|
+
[NODE_KEYS.errorGettingSystemEnvVars]: '获取系统环境变量出错: {{error}}',
|
|
28
|
+
[NODE_KEYS.foundNoProxy]: '发现NO_PROXY: {{noProxy}}',
|
|
29
29
|
// 请求相关 (Request related)
|
|
30
|
-
[NODE_KEYS.usingUserAgent]:
|
|
31
|
-
[NODE_KEYS.requestDetails]:
|
|
32
|
-
[NODE_KEYS.requestOptions]:
|
|
33
|
-
[NODE_KEYS.startingFetch]:
|
|
34
|
-
[NODE_KEYS.fetchingUrl]:
|
|
35
|
-
[NODE_KEYS.responseStatus]:
|
|
36
|
-
[NODE_KEYS.redirectingTo]:
|
|
37
|
-
[NODE_KEYS.constructedFullRedirectUrl]:
|
|
30
|
+
[NODE_KEYS.usingUserAgent]: '使用User-Agent: {{userAgent}}',
|
|
31
|
+
[NODE_KEYS.requestDetails]: '请求详情: 方法={{method}}, URL={{url}}',
|
|
32
|
+
[NODE_KEYS.requestOptions]: '请求选项: {{options}}',
|
|
33
|
+
[NODE_KEYS.startingFetch]: '开始获取: {{method}} {{url}}',
|
|
34
|
+
[NODE_KEYS.fetchingUrl]: '获取URL: {{url}}',
|
|
35
|
+
[NODE_KEYS.responseStatus]: '响应状态: {{status}}',
|
|
36
|
+
[NODE_KEYS.redirectingTo]: '重定向到: {{url}}',
|
|
37
|
+
[NODE_KEYS.constructedFullRedirectUrl]: '构建完整重定向 URL: {{url}}',
|
|
38
38
|
// 响应相关 (Response related)
|
|
39
|
-
[NODE_KEYS.requestSuccess]:
|
|
40
|
-
[NODE_KEYS.errorResponse]:
|
|
41
|
-
[NODE_KEYS.errorResponseBody]:
|
|
42
|
-
[NODE_KEYS.errorReadingBody]:
|
|
39
|
+
[NODE_KEYS.requestSuccess]: '请求成功',
|
|
40
|
+
[NODE_KEYS.errorResponse]: '错误响应: {{status}}',
|
|
41
|
+
[NODE_KEYS.errorResponseBody]: '错误响应内容: {{body}}',
|
|
42
|
+
[NODE_KEYS.errorReadingBody]: '读取响应内容出错: {{error}}',
|
|
43
43
|
// 错误相关 (Error related)
|
|
44
|
-
[NODE_KEYS.fetchError]:
|
|
45
|
-
[NODE_KEYS.requestAborted]:
|
|
46
|
-
[NODE_KEYS.networkError]:
|
|
47
|
-
[NODE_KEYS.tooManyRedirects]:
|
|
44
|
+
[NODE_KEYS.fetchError]: '获取错误: {{error}}',
|
|
45
|
+
[NODE_KEYS.requestAborted]: '请求中止',
|
|
46
|
+
[NODE_KEYS.networkError]: '网络错误: {{code}}',
|
|
47
|
+
[NODE_KEYS.tooManyRedirects]: '重定向次数过多',
|
|
48
48
|
// HTML 获取相关 (HTML fetch related)
|
|
49
|
-
[NODE_KEYS.startingHtmlFetch]:
|
|
50
|
-
[NODE_KEYS.readingText]:
|
|
51
|
-
[NODE_KEYS.htmlContentLength]:
|
|
52
|
-
[NODE_KEYS.htmlFetchError]:
|
|
49
|
+
[NODE_KEYS.startingHtmlFetch]: '开始获取HTML',
|
|
50
|
+
[NODE_KEYS.readingText]: '读取文本内容',
|
|
51
|
+
[NODE_KEYS.htmlContentLength]: 'HTML内容长度: {{length}}字节',
|
|
52
|
+
[NODE_KEYS.htmlFetchError]: '获取HTML时出错: {{error}}',
|
|
53
53
|
// JSON 获取相关 (JSON fetch related)
|
|
54
|
-
[NODE_KEYS.startingJsonFetch]:
|
|
55
|
-
[NODE_KEYS.parsingJson]:
|
|
56
|
-
[NODE_KEYS.jsonParsed]:
|
|
57
|
-
[NODE_KEYS.jsonParseError]:
|
|
58
|
-
[NODE_KEYS.jsonFetchError]:
|
|
54
|
+
[NODE_KEYS.startingJsonFetch]: '开始获取JSON',
|
|
55
|
+
[NODE_KEYS.parsingJson]: '解析JSON',
|
|
56
|
+
[NODE_KEYS.jsonParsed]: 'JSON解析完成',
|
|
57
|
+
[NODE_KEYS.jsonParseError]: 'JSON解析错误: {{error}}',
|
|
58
|
+
[NODE_KEYS.jsonFetchError]: '获取JSON时出错: {{error}}',
|
|
59
59
|
// 文本获取相关 (Text fetch related)
|
|
60
|
-
[NODE_KEYS.startingTxtFetch]:
|
|
61
|
-
[NODE_KEYS.textContentLength]:
|
|
60
|
+
[NODE_KEYS.startingTxtFetch]: '开始获取纯文本',
|
|
61
|
+
[NODE_KEYS.textContentLength]: 'Text内容长度: {{length}}字节',
|
|
62
62
|
// Markdown 获取相关 (Markdown fetch related)
|
|
63
|
-
[NODE_KEYS.startingMarkdownFetch]:
|
|
64
|
-
[NODE_KEYS.creatingTurndown]:
|
|
65
|
-
[NODE_KEYS.convertingToMarkdown]:
|
|
66
|
-
[NODE_KEYS.markdownContentLength]:
|
|
63
|
+
[NODE_KEYS.startingMarkdownFetch]: '开始获取Markdown',
|
|
64
|
+
[NODE_KEYS.creatingTurndown]: '创建Turndown服务',
|
|
65
|
+
[NODE_KEYS.convertingToMarkdown]: '将HTML转换为Markdown',
|
|
66
|
+
[NODE_KEYS.markdownContentLength]: 'Markdown内容长度: {{length}}字节',
|
|
67
|
+
[NODE_KEYS.startingPlainTextFetch]: '开始提取纯文本',
|
|
68
|
+
[NODE_KEYS.extractingText]: '从HTML内容中提取文本',
|
|
69
|
+
[NODE_KEYS.textExtracted]: '文本已提取,长度: {{length}}字节',
|
|
70
|
+
// 内容分段相关 (Content splitting related)
|
|
71
|
+
[NODE_KEYS.contentSplit]: '内容已分段,共{{chunks}}个分段',
|
|
72
|
+
[NODE_KEYS.gettingChunk]: '获取分段内容,ID: {{chunkId}}, 索引: {{chunkIndex}}'
|
|
67
73
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
import { PROCESSOR_KEYS } from '../../keys/processor.js';
|
|
7
|
+
/**
|
|
8
|
+
* 处理器相关的中文文本 (Chinese texts related to processor)
|
|
9
|
+
*/
|
|
10
|
+
export const processorZh = {
|
|
11
|
+
// HTML转Markdown相关 (HTML to Markdown related)
|
|
12
|
+
[PROCESSOR_KEYS.creatingTurndown]: '创建 Turndown 服务',
|
|
13
|
+
[PROCESSOR_KEYS.convertingToMarkdown]: '将 HTML 转换为 Markdown',
|
|
14
|
+
[PROCESSOR_KEYS.markdownContentLength]: 'Markdown 内容长度: {{length}} 字节',
|
|
15
|
+
// HTML转纯文本相关 (HTML to plain text related)
|
|
16
|
+
[PROCESSOR_KEYS.creatingHtmlToText]: '创建 HTML-to-Text 转换器',
|
|
17
|
+
[PROCESSOR_KEYS.convertingToText]: '将 HTML 转换为纯文本',
|
|
18
|
+
[PROCESSOR_KEYS.textContentLength]: '纯文本内容长度: {{length}} 字节',
|
|
19
|
+
// JSON处理相关 (JSON processing related)
|
|
20
|
+
[PROCESSOR_KEYS.parsingJson]: '解析 JSON 内容',
|
|
21
|
+
[PROCESSOR_KEYS.jsonParsed]: '成功解析 JSON 内容',
|
|
22
|
+
[PROCESSOR_KEYS.jsonParseError]: '解析 JSON 失败: {{error}}。预览: {{textPreview}},长度: {{textLength}} 字节',
|
|
23
|
+
// 文本处理相关 (Text processing related)
|
|
24
|
+
[PROCESSOR_KEYS.processingText]: '处理文本内容,长度: {{length}} 字节',
|
|
25
|
+
// 内容大小验证相关 (Content size validation related)
|
|
26
|
+
[PROCESSOR_KEYS.contentTooLarge]: '内容大小 ({{contentSize}} 字节) 超过允许的限制 ({{contentSizeLimit}} 字节)',
|
|
27
|
+
[PROCESSOR_KEYS.contentSizeOk]: '内容大小 ({{contentSize}} 字节) 在允许的限制内 ({{contentSizeLimit}} 字节)',
|
|
28
|
+
};
|
|
@@ -29,5 +29,9 @@ export default {
|
|
|
29
29
|
[TOOLS_KEYS.callError]: '调用工具 {{name}} 时出错: {{error}}',
|
|
30
30
|
[TOOLS_KEYS.missingUrl]: '缺少URL参数',
|
|
31
31
|
[TOOLS_KEYS.fetchRequest]: '正在从URL获取{{type}}: {{url}}',
|
|
32
|
-
[TOOLS_KEYS.fetchError]: '从URL {{url}} 获取内容时出错: {{error}}'
|
|
32
|
+
[TOOLS_KEYS.fetchError]: '从URL {{url}} 获取内容时出错: {{error}}',
|
|
33
|
+
// 参数相关 (Parameters related)
|
|
34
|
+
[TOOLS_KEYS.missingUrlOrChunkId]: '缺少 URL 或分块 ID',
|
|
35
|
+
[TOOLS_KEYS.missingStartCursor]: '缺少起始游标参数',
|
|
36
|
+
[TOOLS_KEYS.fetchChunkRequest]: '获取分块: {{chunkId}},起始游标: {{startCursor}}',
|
|
33
37
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
import { URL_KEYS } from '../../keys/url.js';
|
|
7
|
+
// URL相关消息 (URL related messages)
|
|
8
|
+
export default {
|
|
9
|
+
// 验证相关 (Validation related)
|
|
10
|
+
[URL_KEYS.invalidUrl]: '无效的 URL: {{url}}',
|
|
11
|
+
[URL_KEYS.missingScheme]: '缺少 URL 协议',
|
|
12
|
+
[URL_KEYS.invalidScheme]: '无效的 URL 协议: {{scheme}}',
|
|
13
|
+
[URL_KEYS.invalidHostname]: '无效的主机名: {{hostname}}',
|
|
14
|
+
// 处理相关 (Processing related)
|
|
15
|
+
[URL_KEYS.parsing]: '正在解析 URL: {{url}}',
|
|
16
|
+
[URL_KEYS.constructing]: '正在从组件构建 URL',
|
|
17
|
+
[URL_KEYS.normalizing]: '正在标准化 URL: {{url}}',
|
|
18
|
+
[URL_KEYS.resolving]: '正在解析 URL: {{url}} 相对于基础: {{base}}',
|
|
19
|
+
// 组件相关 (Component related)
|
|
20
|
+
[URL_KEYS.scheme]: '协议: {{scheme}}',
|
|
21
|
+
[URL_KEYS.username]: '用户名: {{username}}',
|
|
22
|
+
[URL_KEYS.password]: '密码: {{password}}',
|
|
23
|
+
[URL_KEYS.hostname]: '主机名: {{hostname}}',
|
|
24
|
+
[URL_KEYS.port]: '端口: {{port}}',
|
|
25
|
+
[URL_KEYS.path]: '路径: {{path}}',
|
|
26
|
+
[URL_KEYS.query]: '查询参数: {{query}}',
|
|
27
|
+
[URL_KEYS.fragment]: '片段: {{fragment}}',
|
|
28
|
+
// 相对URL相关 (Relative URL related)
|
|
29
|
+
[URL_KEYS.baseUrl]: '基础 URL: {{url}}',
|
|
30
|
+
[URL_KEYS.relativeUrl]: '相对 URL: {{url}}',
|
|
31
|
+
[URL_KEYS.absoluteUrl]: '绝对 URL: {{url}}',
|
|
32
|
+
// 转换相关 (Conversion related)
|
|
33
|
+
[URL_KEYS.toString]: '正在将 URL 转换为字符串',
|
|
34
|
+
[URL_KEYS.toJSON]: '正在将 URL 转换为 JSON',
|
|
35
|
+
// 错误相关 (Error related)
|
|
36
|
+
[URL_KEYS.parseError]: '解析 URL 错误: {{error}}',
|
|
37
|
+
[URL_KEYS.constructError]: '构建 URL 错误: {{error}}',
|
|
38
|
+
[URL_KEYS.normalizeError]: '标准化 URL 错误: {{error}}',
|
|
39
|
+
[URL_KEYS.resolveError]: '解析 URL 错误: {{error}}'
|
|
40
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
export default {
|
|
7
|
+
// 客户端相关 (Client related)
|
|
8
|
+
'client.startingServer': '正在启动服务器...',
|
|
9
|
+
'client.usingEnvProxy': '使用环境代理: {proxy}',
|
|
10
|
+
'client.usingSystemProxy': '使用系统代理: {proxy}',
|
|
11
|
+
'client.noSystemProxy': '未找到系统代理',
|
|
12
|
+
'client.systemProxyDisabled': '系统代理检测已禁用',
|
|
13
|
+
'client.proxySet': '代理已设置: {proxy}',
|
|
14
|
+
'client.fetchingUrl': '正在获取 URL: {url}',
|
|
15
|
+
'client.usingBrowserMode': '使用浏览器模式',
|
|
16
|
+
'client.usingStandardMode': '使用标准模式',
|
|
17
|
+
'client.switchingToBrowserMode': '正在切换到浏览器模式',
|
|
18
|
+
'client.fetchSuccessful': '获取成功',
|
|
19
|
+
'client.fetchFailed': '获取失败: {error}',
|
|
20
|
+
'client.fatalError': '致命错误: {error}',
|
|
21
|
+
'client.serverClosed': '服务器已关闭',
|
|
22
|
+
// 使用信息 (Usage information)
|
|
23
|
+
'client.usageInfo': '用法: {info}',
|
|
24
|
+
'client.exampleUsage': '示例: {example}',
|
|
25
|
+
'client.chunkUsageInfo': '要获取特定分段,请使用 --chunk-id 和 --chunk-index 参数',
|
|
26
|
+
'client.allChunksUsageInfo': '要获取所有分段,请使用 --all-chunks 参数',
|
|
27
|
+
'client.invalidJson': '无效的 JSON: {error}',
|
|
28
|
+
'client.usingCommandLineProxy': '使用命令行代理: {proxy}',
|
|
29
|
+
'client.invalidProxyFormat': '无效的代理格式: {proxy}',
|
|
30
|
+
// 分段内容相关 (Chunked content related)
|
|
31
|
+
'client.chunkInfoSaved': '分段信息已保存到 {file},当前: {current},总计: {total}',
|
|
32
|
+
'client.chunkInfoSaveError': '保存分段信息错误: {error}',
|
|
33
|
+
'client.chunkInfoLoaded': '已从 {file} 加载分段信息,当前: {current},总计: {total}',
|
|
34
|
+
'client.chunkInfoLoadError': '加载分段信息错误: {error}',
|
|
35
|
+
'client.fetchingAllChunks': '正在获取所有分段内容,共 {total} 段',
|
|
36
|
+
'client.fetchingChunk': '正在获取第 {index}/{total} 段内容',
|
|
37
|
+
'client.fetchChunkFailed': '获取第 {index} 段内容失败: {error}',
|
|
38
|
+
'client.allChunksFetched': '所有分段内容获取完成,共 {total} 段',
|
|
39
|
+
'client.hasMoreChunks': '内容已分段: {current}/{total} 段',
|
|
40
|
+
'client.allChunksCommand': '一次性获取所有分段内容,请运行: {command}',
|
|
41
|
+
// 参数相关 (Parameters related)
|
|
42
|
+
'client.sendingParameters': '正在发送参数到 MCP: {params}',
|
|
43
|
+
'client.limitingChunks': '限制获取分段数量为 {limit} (总计: {total})',
|
|
44
|
+
'client.maxChunksUsageInfo': '使用 --max-chunks=N 参数限制获取的分段数量 (默认: {default})',
|
|
45
|
+
// 错误相关 (Error related)
|
|
46
|
+
'errors.forbidden': '访问被禁止 (HTTP 403)',
|
|
47
|
+
'errors.cloudflareProtection': '检测到 Cloudflare 保护',
|
|
48
|
+
'errors.captchaRequired': '需要验证码验证',
|
|
49
|
+
'errors.timeout': '请求超时,超时时间: {timeout}',
|
|
50
|
+
'errors.connectionProblem': '检测到连接问题'
|
|
51
|
+
};
|
package/dist/src/lib/logger.js
CHANGED
|
@@ -19,6 +19,9 @@ import factoryZh from './i18n/locales/zh/factory.js';
|
|
|
19
19
|
import errorsZh from './i18n/locales/zh/errors.js';
|
|
20
20
|
import resourcesZh from './i18n/locales/zh/resources.js';
|
|
21
21
|
import promptsZh from './i18n/locales/zh/prompts.js';
|
|
22
|
+
import { contentSizeZh } from './i18n/locales/zh/contentSize.js';
|
|
23
|
+
import { chunkManagerZh } from './i18n/locales/zh/chunkManager.js';
|
|
24
|
+
import { processorZh } from './i18n/locales/zh/processor.js';
|
|
22
25
|
// 创建翻译映射 (Create translation mapping)
|
|
23
26
|
const translationMap = {
|
|
24
27
|
server: serverZh,
|
|
@@ -30,7 +33,10 @@ const translationMap = {
|
|
|
30
33
|
factory: factoryZh,
|
|
31
34
|
errors: errorsZh,
|
|
32
35
|
resources: resourcesZh,
|
|
33
|
-
prompts: promptsZh
|
|
36
|
+
prompts: promptsZh,
|
|
37
|
+
contentSize: contentSizeZh,
|
|
38
|
+
chunkManager: chunkManagerZh,
|
|
39
|
+
processor: processorZh
|
|
34
40
|
};
|
|
35
41
|
// 组件名称常量 (Component name constants)
|
|
36
42
|
export const COMPONENTS = {
|
|
@@ -41,7 +47,10 @@ export const COMPONENTS = {
|
|
|
41
47
|
RESOURCES: 'MCP-RESOURCES',
|
|
42
48
|
PROMPTS: 'MCP-PROMPTS',
|
|
43
49
|
TOOLS: 'MCP-TOOLS',
|
|
44
|
-
FETCHER_FACTORY: 'FETCHER-FACTORY'
|
|
50
|
+
FETCHER_FACTORY: 'FETCHER-FACTORY',
|
|
51
|
+
CONTENT_SIZE: 'CONTENT-SIZE',
|
|
52
|
+
CHUNK_MANAGER: 'CHUNK-MANAGER',
|
|
53
|
+
PROCESSOR: 'CONTENT-PROCESSOR'
|
|
45
54
|
};
|
|
46
55
|
// 日志文件路径 (Log file path)
|
|
47
56
|
const LOG_DIR = path.join(os.homedir(), '.mult-fetch-mcp-server');
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { Fetcher } from '../fetch.js';
|
|
7
7
|
import { log, COMPONENTS } from '../logger.js';
|
|
8
8
|
import { initializeBrowser, closeBrowserInstance, shouldSwitchToBrowser } from './browser.js';
|
|
9
|
+
import { BaseFetcher } from '../fetchers/common/BaseFetcher.js';
|
|
9
10
|
/**
|
|
10
11
|
* 辅助函数:根据类型和参数自动选择合适的获取方法 (Helper function: automatically select appropriate fetching method based on type and parameters)
|
|
11
12
|
* 支持自动在标准模式和浏览器模式之间切换 (Supports automatic switching between standard mode and browser mode)
|
|
@@ -38,6 +39,8 @@ export async function fetchWithAutoDetect(params, type) {
|
|
|
38
39
|
return await Fetcher.txt(params);
|
|
39
40
|
case 'markdown':
|
|
40
41
|
return await Fetcher.markdown(params);
|
|
42
|
+
case 'plaintext':
|
|
43
|
+
return await Fetcher.plainText(params);
|
|
41
44
|
default:
|
|
42
45
|
throw new Error(`Unsupported content type: ${type}`);
|
|
43
46
|
}
|
|
@@ -67,6 +70,10 @@ export async function fetchWithAutoDetect(params, type) {
|
|
|
67
70
|
result = await Fetcher.markdown(params);
|
|
68
71
|
break;
|
|
69
72
|
}
|
|
73
|
+
case 'plaintext': {
|
|
74
|
+
result = await Fetcher.plainText(params);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
70
77
|
default:
|
|
71
78
|
throw new Error(`Unsupported content type: ${type}`);
|
|
72
79
|
}
|
|
@@ -108,6 +115,9 @@ export async function fetchWithAutoDetect(params, type) {
|
|
|
108
115
|
case 'markdown':
|
|
109
116
|
browserResult = await Fetcher.markdown(browserParams);
|
|
110
117
|
break;
|
|
118
|
+
case 'plaintext':
|
|
119
|
+
browserResult = await Fetcher.plainText(browserParams);
|
|
120
|
+
break;
|
|
111
121
|
default:
|
|
112
122
|
throw new Error(`Unsupported content type: ${type}`);
|
|
113
123
|
}
|
|
@@ -151,6 +161,9 @@ export async function fetchWithAutoDetect(params, type) {
|
|
|
151
161
|
case 'markdown':
|
|
152
162
|
browserResult = await Fetcher.markdown(browserParams);
|
|
153
163
|
break;
|
|
164
|
+
case 'plaintext':
|
|
165
|
+
browserResult = await Fetcher.plainText(browserParams);
|
|
166
|
+
break;
|
|
154
167
|
default:
|
|
155
168
|
throw new Error(`Unsupported content type: ${type}`);
|
|
156
169
|
}
|
|
@@ -173,8 +186,5 @@ export async function fetchWithAutoDetect(params, type) {
|
|
|
173
186
|
throw error;
|
|
174
187
|
}
|
|
175
188
|
// 如果没有匹配的类型,返回错误
|
|
176
|
-
return {
|
|
177
|
-
|
|
178
|
-
isError: true
|
|
179
|
-
};
|
|
180
|
-
} // 修复注释
|
|
189
|
+
return BaseFetcher.createErrorResponse(`Unsupported content type: ${type}`);
|
|
190
|
+
}
|