Compare commits

..

4 Commits

Author SHA1 Message Date
kirigaya
291199a995 update 2025-05-14 16:35:26 +08:00
kirigaya
5a797f97c7 完成 wt 0.1 系统 2025-05-13 21:55:35 +08:00
kirigaya
ad619afa44 test access token 2025-05-13 16:08:34 +08:00
kirigaya
4b05c6e10a update 2025-05-13 16:01:36 +08:00
24 changed files with 567 additions and 3117 deletions

View File

@ -8,12 +8,13 @@
"name": "qq-rag-llm", "name": "qq-rag-llm",
"version": "1.0.0", "version": "1.0.0",
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "^9.0.1",
"@ptkdev/logger": "^1.8.0", "@ptkdev/logger": "^1.8.0",
"@types/node": "^20.12.12", "@types/node": "^20.12.12",
"axios": "^1.7.2", "axios": "^1.7.2",
"fs": "^0.0.1-security", "fs": "^0.0.1-security",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",
"lagrange.onebot": "^1.0.8", "lagrange.onebot": "^1.0.9",
"node-schedule": "^2.1.1", "node-schedule": "^2.1.1",
"ws": "^8.17.0", "ws": "^8.17.0",
"yaml": "^2.4.2" "yaml": "^2.4.2"
@ -34,6 +35,59 @@
"typescript": "^5.4.5" "typescript": "^5.4.5"
} }
}, },
"node_modules/@elastic/elasticsearch": {
"version": "9.0.1",
"resolved": "https://registry.npmmirror.com/@elastic/elasticsearch/-/elasticsearch-9.0.1.tgz",
"integrity": "sha512-V/Hj/ePRiC6H8vOQF4GfOGIUFjYyA2C1Je6qKBD20AShmxqkaTRAQSvia4tvLobHqjrljUzb6khfhDuPrb6E8g==",
"license": "Apache-2.0",
"dependencies": {
"@elastic/transport": "^9.0.1",
"apache-arrow": "18.x - 19.x",
"tslib": "^2.4.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@elastic/elasticsearch/node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
"node_modules/@elastic/transport": {
"version": "9.0.1",
"resolved": "https://registry.npmmirror.com/@elastic/transport/-/transport-9.0.1.tgz",
"integrity": "sha512-6jVZQzAe2iTRsZA6I/wkO2BjzJFD9BHTASo2YgGfbcoV95ey/8D/ABRhpgfg35LIDrmialIGJBizunSwxsRDLg==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/api": "1.x",
"debug": "^4.4.0",
"hpagent": "^1.2.0",
"ms": "^2.1.3",
"secure-json-parse": "^3.0.2",
"tslib": "^2.8.1",
"undici": "^7.2.3"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@elastic/transport/node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
"node_modules/@opentelemetry/api": {
"version": "1.9.0",
"resolved": "https://registry.npmmirror.com/@opentelemetry/api/-/api-1.9.0.tgz",
"integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",
"license": "Apache-2.0",
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@pm2/agent": { "node_modules/@pm2/agent": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmmirror.com/@pm2/agent/-/agent-2.0.4.tgz", "resolved": "https://registry.npmmirror.com/@pm2/agent/-/agent-2.0.4.tgz",
@ -427,12 +481,39 @@
"dev": true, "dev": true,
"license": "(Unlicense OR Apache-2.0)" "license": "(Unlicense OR Apache-2.0)"
}, },
"node_modules/@swc/helpers": {
"version": "0.5.17",
"resolved": "https://registry.npmmirror.com/@swc/helpers/-/helpers-0.5.17.tgz",
"integrity": "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "^2.8.0"
}
},
"node_modules/@swc/helpers/node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
"node_modules/@tootallnate/quickjs-emscripten": { "node_modules/@tootallnate/quickjs-emscripten": {
"version": "0.23.0", "version": "0.23.0",
"resolved": "https://registry.npmmirror.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", "resolved": "https://registry.npmmirror.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz",
"integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/command-line-args": {
"version": "5.2.3",
"resolved": "https://registry.npmmirror.com/@types/command-line-args/-/command-line-args-5.2.3.tgz",
"integrity": "sha512-uv0aG6R0Y8WHZLTamZwtfsDLVRnOa+n+n5rEvFWL5Na5gZ8V2Teab/duDPFzIIIhs9qizDpcavCusCLJZu62Kw==",
"license": "MIT"
},
"node_modules/@types/command-line-usage": {
"version": "5.0.4",
"resolved": "https://registry.npmmirror.com/@types/command-line-usage/-/command-line-usage-5.0.4.tgz",
"integrity": "sha512-BwR5KP3Es/CSht0xqBcUXS3qCAUVXwpRKsV2+arxeb65atasuXG9LykC9Ab10Cw3s2raH92ZqOeILaQbsB2ACg==",
"license": "MIT"
},
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.17.46", "version": "20.17.46",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-20.17.46.tgz", "resolved": "https://registry.npmmirror.com/@types/node/-/node-20.17.46.tgz",
@ -602,6 +683,32 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/apache-arrow": {
"version": "19.0.1",
"resolved": "https://registry.npmmirror.com/apache-arrow/-/apache-arrow-19.0.1.tgz",
"integrity": "sha512-APmMLzS4qbTivLrPdQXexGM4JRr+0g62QDaobzEvip/FdQIrv2qLy0mD5Qdmw4buydtVJgbFeKR8f59I6PPGDg==",
"license": "Apache-2.0",
"dependencies": {
"@swc/helpers": "^0.5.11",
"@types/command-line-args": "^5.2.3",
"@types/command-line-usage": "^5.0.4",
"@types/node": "^20.13.0",
"command-line-args": "^6.0.1",
"command-line-usage": "^7.0.1",
"flatbuffers": "^24.3.25",
"json-bignum": "^0.0.3",
"tslib": "^2.6.2"
},
"bin": {
"arrow2csv": "bin/arrow2csv.js"
}
},
"node_modules/apache-arrow/node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
"node_modules/arch": { "node_modules/arch": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmmirror.com/arch/-/arch-2.2.0.tgz", "resolved": "https://registry.npmmirror.com/arch/-/arch-2.2.0.tgz",
@ -636,6 +743,15 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"license": "Python-2.0" "license": "Python-2.0"
}, },
"node_modules/array-back": {
"version": "6.2.2",
"resolved": "https://registry.npmmirror.com/array-back/-/array-back-6.2.2.tgz",
"integrity": "sha512-gUAZ7HPyb4SJczXAMUXMGAvI976JoK3qEx9v1FTmeYuJj0IBiaKttG1ydtGKdkfqWkIkouke7nG8ufGy77+Cvw==",
"license": "MIT",
"engines": {
"node": ">=12.17"
}
},
"node_modules/assertion-error": { "node_modules/assertion-error": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/assertion-error/-/assertion-error-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/assertion-error/-/assertion-error-1.1.0.tgz",
@ -962,7 +1078,6 @@
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmmirror.com/chalk-template/-/chalk-template-0.4.0.tgz", "resolved": "https://registry.npmmirror.com/chalk-template/-/chalk-template-0.4.0.tgz",
"integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==", "integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"chalk": "^4.1.2" "chalk": "^4.1.2"
@ -1154,6 +1269,44 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/command-line-args": {
"version": "6.0.1",
"resolved": "https://registry.npmmirror.com/command-line-args/-/command-line-args-6.0.1.tgz",
"integrity": "sha512-Jr3eByUjqyK0qd8W0SGFW1nZwqCaNCtbXjRo2cRJC1OYxWl3MZ5t1US3jq+cO4sPavqgw4l9BMGX0CBe+trepg==",
"license": "MIT",
"dependencies": {
"array-back": "^6.2.2",
"find-replace": "^5.0.2",
"lodash.camelcase": "^4.3.0",
"typical": "^7.2.0"
},
"engines": {
"node": ">=12.20"
},
"peerDependencies": {
"@75lb/nature": "latest"
},
"peerDependenciesMeta": {
"@75lb/nature": {
"optional": true
}
}
},
"node_modules/command-line-usage": {
"version": "7.0.3",
"resolved": "https://registry.npmmirror.com/command-line-usage/-/command-line-usage-7.0.3.tgz",
"integrity": "sha512-PqMLy5+YGwhMh1wS04mVG44oqDsgyLRSKJBdOo1bnYhMKBW65gZF1dRp2OZRhiTjgUHljy99qkO7bsctLaw35Q==",
"license": "MIT",
"dependencies": {
"array-back": "^6.2.2",
"chalk-template": "^0.4.0",
"table-layout": "^4.1.0",
"typical": "^7.1.1"
},
"engines": {
"node": ">=12.20.0"
}
},
"node_modules/commander": { "node_modules/commander": {
"version": "2.15.1", "version": "2.15.1",
"resolved": "https://registry.npmmirror.com/commander/-/commander-2.15.1.tgz", "resolved": "https://registry.npmmirror.com/commander/-/commander-2.15.1.tgz",
@ -1714,6 +1867,23 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/find-replace": {
"version": "5.0.2",
"resolved": "https://registry.npmmirror.com/find-replace/-/find-replace-5.0.2.tgz",
"integrity": "sha512-Y45BAiE3mz2QsrN2fb5QEtO4qb44NcS7en/0y9PEVsg351HsLeVclP8QPMH79Le9sH3rs5RSwJu99W0WPZO43Q==",
"license": "MIT",
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@75lb/nature": "latest"
},
"peerDependenciesMeta": {
"@75lb/nature": {
"optional": true
}
}
},
"node_modules/find-up": { "node_modules/find-up": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmmirror.com/find-up/-/find-up-5.0.0.tgz", "resolved": "https://registry.npmmirror.com/find-up/-/find-up-5.0.0.tgz",
@ -1741,6 +1911,12 @@
"flat": "cli.js" "flat": "cli.js"
} }
}, },
"node_modules/flatbuffers": {
"version": "24.12.23",
"resolved": "https://registry.npmmirror.com/flatbuffers/-/flatbuffers-24.12.23.tgz",
"integrity": "sha512-dLVCAISd5mhls514keQzmEG6QHmUUsNuWsb4tFafIUwvvgDjXhtfAYSKOzt5SWOy+qByV5pbsDZ+Vb7HUOBEdA==",
"license": "Apache-2.0"
},
"node_modules/follow-redirects": { "node_modules/follow-redirects": {
"version": "1.15.9", "version": "1.15.9",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz", "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz",
@ -2060,6 +2236,15 @@
"he": "bin/he" "he": "bin/he"
} }
}, },
"node_modules/hpagent": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/hpagent/-/hpagent-1.2.0.tgz",
"integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==",
"license": "MIT",
"engines": {
"node": ">=14"
}
},
"node_modules/http-proxy-agent": { "node_modules/http-proxy-agent": {
"version": "7.0.2", "version": "7.0.2",
"resolved": "https://registry.npmmirror.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", "resolved": "https://registry.npmmirror.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
@ -2443,6 +2628,14 @@
"bignumber.js": "^9.0.0" "bignumber.js": "^9.0.0"
} }
}, },
"node_modules/json-bignum": {
"version": "0.0.3",
"resolved": "https://registry.npmmirror.com/json-bignum/-/json-bignum-0.0.3.tgz",
"integrity": "sha512-2WHyXj3OfHSgNyuzDbSxI1w2jgw5gkWSWhS7Qg4bWXx1nLk3jnbwfUeS0PSba3IzpTUWdHxBieELUzXRjQB2zg==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/json-schema-traverse": { "node_modules/json-schema-traverse": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
@ -2500,9 +2693,9 @@
"license": "(MIT OR Apache-2.0)" "license": "(MIT OR Apache-2.0)"
}, },
"node_modules/lagrange.onebot": { "node_modules/lagrange.onebot": {
"version": "1.0.8", "version": "1.0.9",
"resolved": "https://registry.npmmirror.com/lagrange.onebot/-/lagrange.onebot-1.0.8.tgz", "resolved": "https://registry.npmmirror.com/lagrange.onebot/-/lagrange.onebot-1.0.9.tgz",
"integrity": "sha512-x2IdveKDW5GLm6NJRYjV+/6lAds94AQN3Ow00bFBqFTtZDAED6AKBCnIrrkyfns1OXpXJrZXbdGfny11zgtdmA==", "integrity": "sha512-1J+WZ3LMRQTtut6x62LbmyRaUSr/7JSq+MEZNMbNgGlTHkFCVAC1HkRDjCHVay7SvSVA5D4rkp4L0csVDj7p4g==",
"dependencies": { "dependencies": {
"@ptkdev/logger": "^1.8.0", "@ptkdev/logger": "^1.8.0",
"@types/node": "22.15.16", "@types/node": "22.15.16",
@ -2569,6 +2762,12 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmmirror.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
"license": "MIT"
},
"node_modules/lodash.get": { "node_modules/lodash.get": {
"version": "4.4.2", "version": "4.4.2",
"resolved": "https://registry.npmmirror.com/lodash.get/-/lodash.get-4.4.2.tgz", "resolved": "https://registry.npmmirror.com/lodash.get/-/lodash.get-4.4.2.tgz",
@ -3602,6 +3801,22 @@
"integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/secure-json-parse": {
"version": "3.0.2",
"resolved": "https://registry.npmmirror.com/secure-json-parse/-/secure-json-parse-3.0.2.tgz",
"integrity": "sha512-H6nS2o8bWfpFEV6U38sOSjS7bTbdgbCGU9wEM6W14P5H0QOsz94KCusifV44GpHDTu2nqZbuDNhTzu+mjDSw1w==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"license": "BSD-3-Clause"
},
"node_modules/semver": { "node_modules/semver": {
"version": "7.7.1", "version": "7.7.1",
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.1.tgz", "resolved": "https://registry.npmmirror.com/semver/-/semver-7.7.1.tgz",
@ -4133,6 +4348,19 @@
"url": "https://www.buymeacoffee.com/systeminfo" "url": "https://www.buymeacoffee.com/systeminfo"
} }
}, },
"node_modules/table-layout": {
"version": "4.1.1",
"resolved": "https://registry.npmmirror.com/table-layout/-/table-layout-4.1.1.tgz",
"integrity": "sha512-iK5/YhZxq5GO5z8wb0bY1317uDF3Zjpha0QFFLA8/trAoiLbQD0HUbMesEaxyzUgDxi2QlcbM8IvqOlEjgoXBA==",
"license": "MIT",
"dependencies": {
"array-back": "^6.2.2",
"wordwrapjs": "^5.1.0"
},
"engines": {
"node": ">=12.17"
}
},
"node_modules/to-regex-range": { "node_modules/to-regex-range": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz", "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz",
@ -4230,6 +4458,15 @@
"node": ">=14.17" "node": ">=14.17"
} }
}, },
"node_modules/typical": {
"version": "7.3.0",
"resolved": "https://registry.npmmirror.com/typical/-/typical-7.3.0.tgz",
"integrity": "sha512-ya4mg/30vm+DOWfBg4YK3j2WD6TWtRkCbasOJr40CseYENzCUby/7rIvXA99JGsQHeNxLbnXdyLLxKSv3tauFw==",
"license": "MIT",
"engines": {
"node": ">=12.17"
}
},
"node_modules/typify-parser": { "node_modules/typify-parser": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/typify-parser/-/typify-parser-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/typify-parser/-/typify-parser-1.1.0.tgz",
@ -4240,6 +4477,15 @@
"node": ">= 0.10.0" "node": ">= 0.10.0"
} }
}, },
"node_modules/undici": {
"version": "7.9.0",
"resolved": "https://registry.npmmirror.com/undici/-/undici-7.9.0.tgz",
"integrity": "sha512-e696y354tf5cFZPXsF26Yg+5M63+5H3oE6Vtkh2oqbvsE2Oe7s2nIbcQh5lmG7Lp/eS29vJtTpw9+p6PX0qNSg==",
"license": "MIT",
"engines": {
"node": ">=20.18.1"
}
},
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "6.19.8", "version": "6.19.8",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.19.8.tgz", "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.19.8.tgz",
@ -4378,6 +4624,15 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/wordwrapjs": {
"version": "5.1.0",
"resolved": "https://registry.npmmirror.com/wordwrapjs/-/wordwrapjs-5.1.0.tgz",
"integrity": "sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg==",
"license": "MIT",
"engines": {
"node": ">=12.17"
}
},
"node_modules/workerpool": { "node_modules/workerpool": {
"version": "6.5.1", "version": "6.5.1",
"resolved": "https://registry.npmmirror.com/workerpool/-/workerpool-6.5.1.tgz", "resolved": "https://registry.npmmirror.com/workerpool/-/workerpool-6.5.1.tgz",

View File

@ -14,12 +14,13 @@
"test": "mocha" "test": "mocha"
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "^9.0.1",
"@ptkdev/logger": "^1.8.0", "@ptkdev/logger": "^1.8.0",
"@types/node": "^20.12.12", "@types/node": "^20.12.12",
"axios": "^1.7.2", "axios": "^1.7.2",
"fs": "^0.0.1-security", "fs": "^0.0.1-security",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",
"lagrange.onebot": "^1.0.8", "lagrange.onebot": "^1.0.9",
"node-schedule": "^2.1.1", "node-schedule": "^2.1.1",
"ws": "^8.17.0", "ws": "^8.17.0",
"yaml": "^2.4.2" "yaml": "^2.4.2"

View File

@ -14,5 +14,15 @@ export const qq_users = {
/** /**
* dayo ! * dayo !
*/ */
JIN_HUI: 1193466151 JIN_HUI: 1193466151,
/**
* TIP dayo !
*/
TIP: 1542544558
};
export const es_db = {
WT_OMCP_INDEX: 'openmcp-debug-collection.openmcp',
WT_TEST_INDEX: 'openmcp-debug-collection.test'
}; };

View File

@ -0,0 +1,7 @@
export class CommandRegistry {
constructor() {
}
}

65
node/bot/src/hook/es.ts Normal file
View File

@ -0,0 +1,65 @@
import { Client } from '@elastic/elasticsearch';
// 创建 Elasticsearch 客户端
const client = new Client({
node: 'https://localhost:9200', // ES 地址
auth: {
username: 'elastic',
password: process.env['ES_PASSWORD'] || '',
},
tls: {
rejectUnauthorized: false,
}
});
// 示例:创建一个索引
export async function createIndex(indexName: string) {
try {
const response = await client.indices.create({
index: indexName,
});
// console.log('Index created:', response);
} catch (error) {
console.error('Error creating index:', error);
}
}
// 示例:插入文档
export async function indexDocument(indexName: string, document: any) {
try {
const response = await client.index({
index: indexName,
body: document,
});
// console.log('Document indexed:', response);
} catch (error) {
console.error('Error indexing document:', error);
}
}
// 示例:搜索文档
export async function searchDocuments(indexName: string, query: never) {
try {
const response = await client.search({
index: indexName,
body: {
query: query
},
});
// console.log('Search results:', response.hits.hits);
} catch (error) {
console.error('Error searching documents:', error);
}
}
// 示例:删除索引
export async function deleteIndex(indexName: string) {
try {
const response = await client.indices.delete({
index: indexName,
});
console.log('Index deleted:', response);
} catch (error) {
console.error('Error deleting index:', error);
}
}

View File

@ -0,0 +1,41 @@
export class SizedQueue<T> {
private items: T[] = [];
private maxSize: number;
constructor(maxSize: number) {
this.maxSize = maxSize;
}
// 入队
enqueue(item: T): void {
if (this.items.length >= this.maxSize) {
this.items.shift(); // 如果队列已满,移除队首元素
}
this.items.push(item);
}
// 出队
dequeue(): T | undefined {
return this.items.shift();
}
// 查看队首元素
peek(): T | undefined {
return this.items[0];
}
// 判断队列是否为空
isEmpty(): boolean {
return this.items.length === 0;
}
// 获取队列长度
size(): number {
return this.items.length;
}
// 获取队列最大容量
getMaxSize(): number {
return this.maxSize;
}
}

View File

@ -1,11 +1,13 @@
import '../plugins/image'; import '../plugins/image';
import * as path from 'path'; import * as path from 'path';
import { mapper, plugins, LagrangeContext, PrivateMessage, GroupMessage, Send, logger, ApproveMessage, Message } from 'lagrange.onebot'; import { mapper, LagrangeContext, GroupMessage, ApproveMessage, Message } from 'lagrange.onebot';
import { getNews, publishOpenMCP } from './openmcp-dev.service'; import { getNews } from './openmcp-dev.service';
import { qq_groups, qq_users } from '../global'; import { es_db, qq_groups, qq_users } from '../global';
import { parseCommand, sendMessageToDiscord } from '../util'; import { parseCommand, sendMessageToDiscord } from '../hook/util';
import axios from 'axios'; import axios from 'axios';
import { publishOpenMCP } from '../test-channel/test-channel.service';
import { walktalk } from '../test-channel/bug-logger.service';
console.log('activate ' + path.basename(__filename)); console.log('activate ' + path.basename(__filename));
@ -13,10 +15,10 @@ const visitCache = new Map<string, number>();
export class OpenMcpChannel { export class OpenMcpChannel {
@mapper.onGroup(qq_groups.OPENMCP_DEV, { onlyAdmin: true }) @mapper.onGroup(qq_groups.OPENMCP_DEV, { memorySize: 50 })
async handleTestChannel(c: LagrangeContext<GroupMessage>) { async handleOpenMcpChannel(c: LagrangeContext<GroupMessage>) {
const text = c.getRawText();
const text = c.getRawText();
const commandResult = parseCommand(text); const commandResult = parseCommand(text);
if (commandResult !== undefined) { if (commandResult !== undefined) {
// 校验身份 // 校验身份
@ -33,6 +35,9 @@ export class OpenMcpChannel {
c.sendMessage('检测到超级管理员TIP 系统允许访问,正在执行 ' + JSON.stringify(commandResult)); c.sendMessage('检测到超级管理员TIP 系统允许访问,正在执行 ' + JSON.stringify(commandResult));
visitCache.set(c.message.user_id.toString(), now); visitCache.set(c.message.user_id.toString(), now);
} }
} else {
c.sendMessage('非法请求TIP 系统拒绝访问');
return;
} }
const { command, args } = commandResult; const { command, args } = commandResult;
@ -74,7 +79,12 @@ export class OpenMcpChannel {
await sendMessageToDiscord('hello from qq'); await sendMessageToDiscord('hello from qq');
break; break;
case 'wt':
walktalk(c, es_db.WT_OMCP_INDEX, args[0]);
break;
default: default:
break; break;
} }
} }

View File

@ -3,7 +3,7 @@ import axios from 'axios';
import { LagrangeContext, PrivateMessage, GroupMessage } from 'lagrange.onebot' import { LagrangeContext, PrivateMessage, GroupMessage } from 'lagrange.onebot'
import path from 'path'; import path from 'path';
import { sendMessageToDiscord, wait } from '../util'; import { sendMessageToDiscord, wait } from '../hook/util';
export async function getNews(c: LagrangeContext<PrivateMessage | GroupMessage>) { export async function getNews(c: LagrangeContext<PrivateMessage | GroupMessage>) {
const res = await axios.post('http://localhost:3000/get-news-from-hack-news'); const res = await axios.post('http://localhost:3000/get-news-from-hack-news');
@ -14,19 +14,3 @@ export async function getNews(c: LagrangeContext<PrivateMessage | GroupMessage>)
c.sendMessage(message); c.sendMessage(message);
} }
export async function publishOpenMCP(c: LagrangeContext<GroupMessage>) {
const res = await axios.post('http://localhost:3000/publish-openmcp-client');
const data = res.data;
const message = data.msg;
console.log('message', message);
const { vsix, content } = message;
await c.uploadGroupFile(c.message.group_id, vsix, path.basename(vsix));
await wait(2000);
await c.sendGroupNotice(c.message.group_id, content);
await sendMessageToDiscord(content);
}

View File

@ -0,0 +1,5 @@
import { GroupMessage, LagrangeContext, Receive } from "lagrange.onebot";
export interface WalkTalkStatus {
enabled: boolean;
}

View File

@ -0,0 +1,70 @@
import { GroupMessage, LagrangeContext, mapper } from "lagrange.onebot";
import { WalkTalkStatus } from "./bug-logger.dto";
import { SizedQueue } from "lagrange.onebot/utils";
import * as fs from 'fs';
import { indexDocument } from "../hook/es";
import { es_db } from "../global";
export const groupWalkTalkStatus = new Map<number, WalkTalkStatus>();
export function walktalk(c: LagrangeContext<GroupMessage>, index: string, retainSize?: string) {
const queue = mapper.getMemoryStorage(c);
if (!queue) {
console.error('装饰器 memorySize 请设置为大于 0 的数值');
return;
}
// 查看当前 walktalk 系统状态
if (!groupWalkTalkStatus.has(c.message.group_id)) {
groupWalkTalkStatus.set(c.message.group_id, { enabled: false });
}
const status = groupWalkTalkStatus.get(c.message.group_id);
if (!status.enabled) {
// 关闭 -> 开启:清空 queue 非最后人信息
clearQueueNonRelative(queue);
c.sendMessage('walktalk 采集系统 enable, current size: ' + queue.size());
} else {
// 开启 -> 关闭:搜集数据,并且进行存储
const items = queue.items;
const filename = Date.now() + '.json';
const document = {
content: items,
time: Date.now()
};
indexDocument(index, document);
c.sendMessage('walktalk 采集系统 shutdown, collected size: ' + queue.size());
queue.clear();
}
status.enabled = !status.enabled;
}
function clearQueueNonRelative(queue: SizedQueue<GroupMessage>) {
if (queue.size() < 2) {
return;
}
const items = queue.items;
const lastMessage = items.at(-1); // 获取队列的最后一个元素
if (!lastMessage) {
return;
}
const lastUserId = lastMessage.user_id; // 获取最后一个元素的 user_id
let currentIndex = items.length - 2;
while (currentIndex >= 0) {
const message = items[currentIndex]; // 获取当前元素
if (message.user_id !== lastUserId) {
break;
}
currentIndex --;
}
const retainItems = items.splice(currentIndex + 1);
queue.items = retainItems;
}

View File

@ -3,8 +3,10 @@ import * as path from 'path';
import { mapper, plugins, LagrangeContext, PrivateMessage, GroupMessage, Send, logger, ApproveMessage, Message } from 'lagrange.onebot'; import { mapper, plugins, LagrangeContext, PrivateMessage, GroupMessage, Send, logger, ApproveMessage, Message } from 'lagrange.onebot';
import { getNews, publishOpenMCP } from './test-channel.service'; import { getNews, publishOpenMCP } from './test-channel.service';
import { qq_groups, qq_users } from '../global'; import { es_db, qq_groups, qq_users } from '../global';
import { parseCommand, sendMessageToDiscord } from '../util'; import { parseCommand, sendMessageToDiscord } from '../hook/util';
import { walktalk } from './bug-logger.service';
import axios from 'axios';
console.log('activate ' + path.basename(__filename)); console.log('activate ' + path.basename(__filename));
@ -40,14 +42,13 @@ export class TestChannel {
c.finishSession(); c.finishSession();
} }
@mapper.onGroup(qq_groups.TEST_CHANNEL, { onlyAdmin: true }) @mapper.onGroup(qq_groups.TEST_CHANNEL, { memorySize: 100 })
async handleTestChannel(c: LagrangeContext<GroupMessage>) { async handleTestChannel(c: LagrangeContext<GroupMessage>) {
const text = c.getRawText(); const text = c.getRawText();
const commandResult = parseCommand(text); const commandResult = parseCommand(text);
if (commandResult !== undefined) { if (commandResult !== undefined) {
// 校验身份 // 校验身份
if (c.message.user_id === qq_users.JIN_HUI) { if (c.message.user_id === qq_users.JIN_HUI) {
const now = Date.now(); const now = Date.now();
const lastVisit = visitCache.get(c.message.user_id.toString()); const lastVisit = visitCache.get(c.message.user_id.toString());
@ -60,6 +61,9 @@ export class TestChannel {
c.sendMessage('检测到超级管理员TIP 系统允许访问,正在执行 ' + JSON.stringify(commandResult)); c.sendMessage('检测到超级管理员TIP 系统允许访问,正在执行 ' + JSON.stringify(commandResult));
visitCache.set(c.message.user_id.toString(), now); visitCache.set(c.message.user_id.toString(), now);
} }
} else {
c.sendMessage('非法请求TIP 系统拒绝访问');
return;
} }
const { command, args } = commandResult; const { command, args } = commandResult;
@ -101,6 +105,10 @@ export class TestChannel {
await sendMessageToDiscord('hello from qq'); await sendMessageToDiscord('hello from qq');
break; break;
case 'wt':
walktalk(c, es_db.WT_TEST_INDEX, args[0]);
break;
default: default:
break; break;
} }
@ -114,8 +122,11 @@ export class TestChannel {
c.setGroupAddRequest('', c.message.sub_type, true, ''); c.setGroupAddRequest('', c.message.sub_type, true, '');
} }
@mapper.createTimeSchedule('0 11 20 * * *') @mapper.createTimeSchedule('0 40 16 * * *')
async handleTestChannelSchedule(c: LagrangeContext<Message>) { async handleTestChannelSchedule(c: LagrangeContext<Message>) {
c.sendPrivateMsg(qq_users.JIN_HUI, 'hello'); const res = await axios.post('http://localhost:3000/get-news-from-hack-news');
const data = res.data;
const message = data.msg;
c.sendGroupMsg(qq_groups.TEST_CHANNEL, message);
} }
} }

View File

@ -1,9 +1,10 @@
import '../plugins/image'; import '../plugins/image';
import axios from 'axios'; import axios from 'axios';
import * as fs from 'fs';
import { LagrangeContext, PrivateMessage, GroupMessage } from 'lagrange.onebot' import { LagrangeContext, PrivateMessage, GroupMessage } from 'lagrange.onebot'
import path from 'path'; import path from 'path';
import { sendMessageToDiscord, wait } from '../util'; import { sendMessageToDiscord, wait } from '../hook/util';
export async function getNews(c: LagrangeContext<PrivateMessage | GroupMessage>) { export async function getNews(c: LagrangeContext<PrivateMessage | GroupMessage>) {
const res = await axios.post('http://localhost:3000/get-news-from-hack-news'); const res = await axios.post('http://localhost:3000/get-news-from-hack-news');
@ -17,16 +18,37 @@ export async function getNews(c: LagrangeContext<PrivateMessage | GroupMessage>)
export async function publishOpenMCP(c: LagrangeContext<GroupMessage>) { export async function publishOpenMCP(c: LagrangeContext<GroupMessage>) {
const res = await axios.post('http://localhost:3000/publish-openmcp-client'); const res = await axios.post('http://localhost:3000/publish-openmcp-client');
c.sendMessage('完成编译');
const data = res.data; const data = res.data;
const message = data.msg; const message = data.msg;
console.log('message', message);
const { vsix, content } = message; const { vsix, content } = message;
await c.uploadGroupFile(c.message.group_id, vsix, path.basename(vsix)); if (!fs.existsSync(vsix)) {
await wait(2000); c.sendMessage('vsix 文件不存在,需要超级管理员查看后台日志以排错');
return;
}
const vscodePlatformResult = await axios.post('http://localhost:3000/publish-vsix', { tool: 'vsce', vsix });
if (vscodePlatformResult.data.msg.toLowerCase().startsWith('error')) {
c.sendMessage('vscode 平台发布失败,\n' + vscodePlatformResult.data.msg);
return;
} else {
c.sendMessage('vscode 平台发布成功');
}
const openvsxPlatformResult = await axios.post('http://localhost:3000/publish-vsix', { tool: 'ovsx', vsix });
if (openvsxPlatformResult.data.msg.toLowerCase().startsWith('error')) {
c.sendMessage('openvsx 平台发布失败,\n' + openvsxPlatformResult.data.msg);
return;
} else {
c.sendMessage('openvsx 平台发布成功');
}
await c.sendGroupNotice(c.message.group_id, content); await c.sendGroupNotice(c.message.group_id, content);
await wait(2000);
await c.uploadGroupFile(c.message.group_id, vsix, path.basename(vsix));
await sendMessageToDiscord(content); await sendMessageToDiscord(content);
} }

1
node/faas/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
runtime-data

View File

@ -11,6 +11,7 @@
"dependencies": { "dependencies": {
"body-parser": "^2.2.0", "body-parser": "^2.2.0",
"bson": "^6.10.3", "bson": "^6.10.3",
"collections": "^5.1.13",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^5.1.0", "express": "^5.1.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
@ -18,6 +19,7 @@
"openmcp-sdk": "^0.0.4" "openmcp-sdk": "^0.0.4"
}, },
"devDependencies": { "devDependencies": {
"@types/collections": "^5.1.5",
"@types/cors": "^2.8.18", "@types/cors": "^2.8.18",
"@types/express": "^5.0.1", "@types/express": "^5.0.1",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",
@ -189,6 +191,13 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@types/collections": {
"version": "5.1.5",
"resolved": "https://registry.npmmirror.com/@types/collections/-/collections-5.1.5.tgz",
"integrity": "sha512-gLSFHjr7XTZJ6VQnD0Gn0NfhV/B0rhyWvFokV4iT0++2ccLeMTdxO9y9joVFYYMdn0BT24rkkjM8HLW5gSGh5g==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/connect": { "node_modules/@types/connect": {
"version": "3.4.38", "version": "3.4.38",
"resolved": "https://registry.npmmirror.com/@types/connect/-/connect-3.4.38.tgz", "resolved": "https://registry.npmmirror.com/@types/connect/-/connect-3.4.38.tgz",
@ -642,6 +651,15 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/collections": {
"version": "5.1.13",
"resolved": "https://registry.npmmirror.com/collections/-/collections-5.1.13.tgz",
"integrity": "sha512-SCb6Qd+d3Z02corWQ7/mqXiXeeTdHvkP6TeFSYfGYdCFp1WrjSNZ3j6y8Y3T/7osGEe0iOcU2g1d346l99m4Lg==",
"license": "BSD-3-Clause",
"dependencies": {
"weak-map": "~1.0.x"
}
},
"node_modules/combined-stream": { "node_modules/combined-stream": {
"version": "1.0.8", "version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz", "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
@ -2300,6 +2318,12 @@
"integrity": "sha512-zksaLKM2fVlnB5jQQDqKXXwYHLQUVH9es+5TOOHwGOVJOCeRBCiPjwSg+3tN2AdTCzjgli4jijCH290kXb/zWQ==", "integrity": "sha512-zksaLKM2fVlnB5jQQDqKXXwYHLQUVH9es+5TOOHwGOVJOCeRBCiPjwSg+3tN2AdTCzjgli4jijCH290kXb/zWQ==",
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"node_modules/weak-map": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/weak-map/-/weak-map-1.0.8.tgz",
"integrity": "sha512-lNR9aAefbGPpHO7AEnY0hCFjz1eTkWCXYvkTRrTHs9qv8zJp+SkVYpzfLIFXQQiG3tVvbNFQgVg2bQS8YGgxyw==",
"license": "Apache-2.0"
},
"node_modules/web-streams-polyfill": { "node_modules/web-streams-polyfill": {
"version": "4.0.0-beta.3", "version": "4.0.0-beta.3",
"resolved": "https://registry.npmmirror.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", "resolved": "https://registry.npmmirror.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz",

View File

@ -11,6 +11,7 @@
"dependencies": { "dependencies": {
"body-parser": "^2.2.0", "body-parser": "^2.2.0",
"bson": "^6.10.3", "bson": "^6.10.3",
"collections": "^5.1.13",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^5.1.0", "express": "^5.1.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
@ -18,6 +19,7 @@
"openmcp-sdk": "^0.0.4" "openmcp-sdk": "^0.0.4"
}, },
"devDependencies": { "devDependencies": {
"@types/collections": "^5.1.5",
"@types/cors": "^2.8.18", "@types/cors": "^2.8.18",
"@types/express": "^5.0.1", "@types/express": "^5.0.1",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",

View File

@ -1,287 +0,0 @@
{
"messages": [
{
"role": "user",
"content": "请通过 headless 的方式帮我搜集 https://news.ycombinator.com/ 最热门的前三条信息。\n\n请一步步寻找先罗列所有元素剔除了 css class 后的 html 源代码,过滤可能是广告的元素后然后再从元素里面找到符合要求数量的有效元素。不要在第一步的时候就盲目获取元素的属性。\n\n然后帮我进入这些网站后总结相关信息返回翻译好的简体中文并且整理成一个简单的资讯。\n按以下格式输出严格禁止添加任何额外引导语或总结句\n\n[用一句吸引人的话开头,例如:\"⌨️ 今日份 AI & CS 技术文章分享\"]\n\n📌 [翻译成简体中文的文章标题]\n摘要[文章的核心观点100字以内]\n作者[若存在]\n发布时间[若存在]\n链接[文章URL]",
"extraInfo": {
"created": 1747073959697,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_a0f34b9b-d93a-437d-af28-bf96d68555f3",
"index": 0,
"type": "function",
"function": {
"name": "k_navigate",
"arguments": "{\"url\":\"https://news.ycombinator.com/\",\"launchOptions\":{\"headless\":true}}"
}
}
],
"extraInfo": {
"created": 1747073967399,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_a0f34b9b-d93a-437d-af28-bf96d68555f3",
"content": [
{
"type": "error",
"text": "McpError: MCP error -32603: Navigation timeout of 30000 ms exceeded"
}
],
"extraInfo": {
"created": 1747073997731,
"state": "tool call failed",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1071,
"completion_tokens": 36,
"total_tokens": 1107,
"prompt_tokens_details": {
"cached_tokens": 1024
},
"prompt_cache_hit_tokens": 1024,
"prompt_cache_miss_tokens": 47
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_0e73ade3-e100-4f12-b3cd-505cf31a3e26",
"index": 0,
"type": "function",
"function": {
"name": "k_navigate",
"arguments": "{\"url\":\"https://news.ycombinator.com/\",\"launchOptions\":{\"headless\":true,\"args\":[\"--no-sandbox\"]},\"allowDangerous\":true}"
}
}
],
"extraInfo": {
"created": 1747074003265,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_0e73ade3-e100-4f12-b3cd-505cf31a3e26",
"content": [
{
"type": "error",
"text": "McpError: MCP error -32603: Navigation timeout of 30000 ms exceeded"
}
],
"extraInfo": {
"created": 1747074034143,
"state": "tool call failed",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1141,
"completion_tokens": 54,
"total_tokens": 1195,
"prompt_tokens_details": {
"cached_tokens": 1088
},
"prompt_cache_hit_tokens": 1088,
"prompt_cache_miss_tokens": 53
}
}
},
{
"role": "assistant",
"content": "很抱歉,我无法直接访问该网站以获取信息。您可以尝试手动访问 [Hacker News](https://news.ycombinator.com/) 并查看最热门的前三条信息,然后我可以帮助您整理和翻译相关内容。",
"extraInfo": {
"created": 1747074039413,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1229,
"completion_tokens": 49,
"total_tokens": 1278,
"prompt_tokens_details": {
"cached_tokens": 1216
},
"prompt_cache_hit_tokens": 1216,
"prompt_cache_miss_tokens": 13
}
}
}
],
"settings": {
"temperature": 0.7,
"enableTools": [
{
"name": "k_navigate",
"description": "Navigate to a URL",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "URL to navigate to"
},
"launchOptions": {
"type": "object",
"description": "PuppeteerJS LaunchOptions. Default null. If changed and not null, browser restarts. Example: { headless: true, args: ['--no-sandbox'] }"
},
"allowDangerous": {
"type": "boolean",
"description": "Allow dangerous LaunchOptions that reduce security. When false, dangerous args like --no-sandbox will throw errors. Default false."
}
},
"required": [
"url"
]
},
"enabled": true
},
{
"name": "k_screenshot",
"description": "Take a screenshot of the current page or a specific element",
"inputSchema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name for the screenshot"
},
"selector": {
"type": "string",
"description": "CSS selector for element to screenshot"
},
"width": {
"type": "number",
"description": "Width in pixels (default: 800)"
},
"height": {
"type": "number",
"description": "Height in pixels (default: 600)"
}
},
"required": [
"name"
]
},
"enabled": true
},
{
"name": "k_click",
"description": "Click an element on the page",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to click"
}
},
"required": [
"selector"
]
},
"enabled": true
},
{
"name": "k_fill",
"description": "Fill out an input field",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for input field"
},
"value": {
"type": "string",
"description": "Value to fill"
}
},
"required": [
"selector",
"value"
]
},
"enabled": true
},
{
"name": "k_select",
"description": "Select an element on the page with Select tag",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to select"
},
"value": {
"type": "string",
"description": "Value to select"
}
},
"required": [
"selector",
"value"
]
},
"enabled": true
},
{
"name": "k_hover",
"description": "Hover an element on the page",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to hover"
}
},
"required": [
"selector"
]
},
"enabled": true
},
{
"name": "k_evaluate",
"description": "Execute JavaScript in the browser console",
"inputSchema": {
"type": "object",
"properties": {
"script": {
"type": "string",
"description": "JavaScript code to execute"
}
},
"required": [
"script"
]
},
"enabled": true
}
],
"systemPrompt": "",
"contextLength": 20
},
"mcp": {
"connectionType": "STDIO",
"command": "node",
"args": [
"~/project/Lagrange.RagBot/node/servers/my-browser/dist/browser.js"
]
}
}

View File

@ -1,287 +0,0 @@
{
"messages": [
{
"role": "user",
"content": "请通过 headless 的方式帮我搜集 https://news.ycombinator.com/ 最热门的前三条信息。\n\n请一步步寻找先罗列所有元素剔除了 css class 后的 html 源代码,过滤可能是广告的元素后然后再从元素里面找到符合要求数量的有效元素。不要在第一步的时候就盲目获取元素的属性。\n\n然后帮我进入这些网站后总结相关信息返回翻译好的简体中文并且整理成一个简单的资讯。\n按以下格式输出严格禁止添加任何额外引导语或总结句\n\n[用一句吸引人的话开头,例如:\"⌨️ 今日份 AI & CS 技术文章分享\"]\n\n📌 [翻译成简体中文的文章标题]\n摘要[文章的核心观点100字以内]\n作者[若存在]\n发布时间[若存在]\n链接[文章URL]",
"extraInfo": {
"created": 1747074265643,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_27a3e2af-e707-4eaf-909c-2fa9f1075667",
"index": 0,
"type": "function",
"function": {
"name": "k_navigate",
"arguments": "{\"url\":\"https://news.ycombinator.com/\",\"launchOptions\":{\"headless\":true}}"
}
}
],
"extraInfo": {
"created": 1747074272702,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_27a3e2af-e707-4eaf-909c-2fa9f1075667",
"content": [
{
"type": "error",
"text": "McpError: MCP error -32603: Navigation timeout of 30000 ms exceeded"
}
],
"extraInfo": {
"created": 1747074303017,
"state": "tool call failed",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1071,
"completion_tokens": 36,
"total_tokens": 1107,
"prompt_tokens_details": {
"cached_tokens": 1024
},
"prompt_cache_hit_tokens": 1024,
"prompt_cache_miss_tokens": 47
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_273aedd5-6187-403d-bb53-404b293360b7",
"index": 0,
"type": "function",
"function": {
"name": "k_navigate",
"arguments": "{\"url\":\"https://news.ycombinator.com/\",\"launchOptions\":{\"headless\":true,\"args\":[\"--no-sandbox\"]},\"allowDangerous\":true}"
}
}
],
"extraInfo": {
"created": 1747074308989,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_273aedd5-6187-403d-bb53-404b293360b7",
"content": [
{
"type": "error",
"text": "McpError: MCP error -32603: Navigation timeout of 30000 ms exceeded"
}
],
"extraInfo": {
"created": 1747074339889,
"state": "tool call failed",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1141,
"completion_tokens": 54,
"total_tokens": 1195,
"prompt_tokens_details": {
"cached_tokens": 1088
},
"prompt_cache_hit_tokens": 1088,
"prompt_cache_miss_tokens": 53
}
}
},
{
"role": "assistant",
"content": "很抱歉,我无法访问该网站以获取所需的信息。可能是由于网站的反爬机制或其他技术限制导致无法加载页面。如果您有其他需求或可以尝试其他方法,请告诉我!",
"extraInfo": {
"created": 1747074347931,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1229,
"completion_tokens": 39,
"total_tokens": 1268,
"prompt_tokens_details": {
"cached_tokens": 1216
},
"prompt_cache_hit_tokens": 1216,
"prompt_cache_miss_tokens": 13
}
}
}
],
"settings": {
"temperature": 0.7,
"enableTools": [
{
"name": "k_navigate",
"description": "Navigate to a URL",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "URL to navigate to"
},
"launchOptions": {
"type": "object",
"description": "PuppeteerJS LaunchOptions. Default null. If changed and not null, browser restarts. Example: { headless: true, args: ['--no-sandbox'] }"
},
"allowDangerous": {
"type": "boolean",
"description": "Allow dangerous LaunchOptions that reduce security. When false, dangerous args like --no-sandbox will throw errors. Default false."
}
},
"required": [
"url"
]
},
"enabled": true
},
{
"name": "k_screenshot",
"description": "Take a screenshot of the current page or a specific element",
"inputSchema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name for the screenshot"
},
"selector": {
"type": "string",
"description": "CSS selector for element to screenshot"
},
"width": {
"type": "number",
"description": "Width in pixels (default: 800)"
},
"height": {
"type": "number",
"description": "Height in pixels (default: 600)"
}
},
"required": [
"name"
]
},
"enabled": true
},
{
"name": "k_click",
"description": "Click an element on the page",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to click"
}
},
"required": [
"selector"
]
},
"enabled": true
},
{
"name": "k_fill",
"description": "Fill out an input field",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for input field"
},
"value": {
"type": "string",
"description": "Value to fill"
}
},
"required": [
"selector",
"value"
]
},
"enabled": true
},
{
"name": "k_select",
"description": "Select an element on the page with Select tag",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to select"
},
"value": {
"type": "string",
"description": "Value to select"
}
},
"required": [
"selector",
"value"
]
},
"enabled": true
},
{
"name": "k_hover",
"description": "Hover an element on the page",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to hover"
}
},
"required": [
"selector"
]
},
"enabled": true
},
{
"name": "k_evaluate",
"description": "Execute JavaScript in the browser console",
"inputSchema": {
"type": "object",
"properties": {
"script": {
"type": "string",
"description": "JavaScript code to execute"
}
},
"required": [
"script"
]
},
"enabled": true
}
],
"systemPrompt": "",
"contextLength": 20
},
"mcp": {
"connectionType": "STDIO",
"command": "node",
"args": [
"~/project/Lagrange.RagBot/node/servers/my-browser/dist/browser.js"
]
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,563 +0,0 @@
{
"messages": [
{
"role": "user",
"content": "请通过 headless 的方式帮我搜集 https://news.ycombinator.com/ 最热门的前三条信息。\n\n请一步步寻找先罗列所有元素剔除了 css class 后的 html 源代码,过滤可能是广告的元素后然后再从元素里面找到符合要求数量的有效元素。不要在第一步的时候就盲目获取元素的属性。\n\n然后帮我进入这些网站后总结相关信息返回翻译好的简体中文并且整理成一个简单的资讯。\n按以下格式输出严格禁止添加任何额外引导语或总结句\n\n[用一句吸引人的话开头,例如:\"⌨️ 今日份 AI & CS 技术文章分享\"]\n\n📌 [翻译成简体中文的文章标题]\n摘要[文章的核心观点100字以内]\n作者[若存在]\n发布时间[若存在]\n链接[文章URL]",
"extraInfo": {
"created": 1747101600320,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_d1b875c1-5a16-4136-a2f4-53648127051f",
"index": 0,
"type": "function",
"function": {
"name": "k_navigate",
"arguments": "{\"url\":\"https://news.ycombinator.com/\",\"launchOptions\":{\"headless\":true}}"
}
}
],
"extraInfo": {
"created": 1747101606670,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_d1b875c1-5a16-4136-a2f4-53648127051f",
"content": [
{
"type": "error",
"text": "McpError: MCP error -32603: net::ERR_CONNECTION_RESET at https://news.ycombinator.com/"
}
],
"extraInfo": {
"created": 1747101616953,
"state": "tool call failed",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1071,
"completion_tokens": 36,
"total_tokens": 1107,
"prompt_tokens_details": {
"cached_tokens": 1024
},
"prompt_cache_hit_tokens": 1024,
"prompt_cache_miss_tokens": 47
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_16d05805-8a72-4fb2-b002-6acc27237b94",
"index": 0,
"type": "function",
"function": {
"name": "k_navigate",
"arguments": "{\"url\":\"https://news.ycombinator.com/\",\"launchOptions\":{\"headless\":true,\"args\":[\"--no-sandbox\"]},\"allowDangerous\":true}"
}
}
],
"extraInfo": {
"created": 1747101623731,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_16d05805-8a72-4fb2-b002-6acc27237b94",
"content": [
{
"type": "text",
"text": "Navigated to https://news.ycombinator.com/"
}
],
"extraInfo": {
"created": 1747101628493,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1150,
"completion_tokens": 54,
"total_tokens": 1204,
"prompt_tokens_details": {
"cached_tokens": 1088
},
"prompt_cache_hit_tokens": 1088,
"prompt_cache_miss_tokens": 62
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_c1b1ae98-17cd-4ef6-b4a7-5209e80c7695",
"index": 0,
"type": "function",
"function": {
"name": "k_evaluate",
"arguments": "{\"script\":\"document.documentElement.outerHTML\"}"
}
}
],
"extraInfo": {
"created": 1747101633965,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_c1b1ae98-17cd-4ef6-b4a7-5209e80c7695",
"content": [
{
"type": "text",
"text": "Execution result:\n\"<html><head></head><body></body></html>\"\n\nConsole output:\n"
}
],
"extraInfo": {
"created": 1747101634989,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1230,
"completion_tokens": 25,
"total_tokens": 1255,
"prompt_tokens_details": {
"cached_tokens": 1152
},
"prompt_cache_hit_tokens": 1152,
"prompt_cache_miss_tokens": 78
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_4d783557-5cfc-428b-ae7c-8535ce181d57",
"index": 0,
"type": "function",
"function": {
"name": "k_evaluate",
"arguments": "{\"script\":\"document.body.outerHTML\"}"
}
}
],
"extraInfo": {
"created": 1747101640718,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_4d783557-5cfc-428b-ae7c-8535ce181d57",
"content": [
{
"type": "text",
"text": "Execution result:\n\"<body></body>\"\n\nConsole output:\n"
}
],
"extraInfo": {
"created": 1747101640724,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1296,
"completion_tokens": 23,
"total_tokens": 1319,
"prompt_tokens_details": {
"cached_tokens": 1216
},
"prompt_cache_hit_tokens": 1216,
"prompt_cache_miss_tokens": 80
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_53fcd540-014c-4bc3-9ba6-15a9d5b65b3b",
"index": 0,
"type": "function",
"function": {
"name": "k_evaluate",
"arguments": "{\"script\":\"document.querySelectorAll('a.storylink').length\"}"
}
}
],
"extraInfo": {
"created": 1747101646038,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_53fcd540-014c-4bc3-9ba6-15a9d5b65b3b",
"content": [
{
"type": "text",
"text": "Execution result:\n0\n\nConsole output:\n"
}
],
"extraInfo": {
"created": 1747101646042,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1352,
"completion_tokens": 28,
"total_tokens": 1380,
"prompt_tokens_details": {
"cached_tokens": 1280
},
"prompt_cache_hit_tokens": 1280,
"prompt_cache_miss_tokens": 72
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_7ec588aa-9a81-41ad-9d5e-1cab03e5e7ef",
"index": 0,
"type": "function",
"function": {
"name": "k_evaluate",
"arguments": "{\"script\":\"document.querySelectorAll('a').length\"}"
}
}
],
"extraInfo": {
"created": 1747101651231,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_7ec588aa-9a81-41ad-9d5e-1cab03e5e7ef",
"content": [
{
"type": "text",
"text": "Execution result:\n0\n\nConsole output:\n"
}
],
"extraInfo": {
"created": 1747101651236,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1406,
"completion_tokens": 25,
"total_tokens": 1431,
"prompt_tokens_details": {
"cached_tokens": 1344
},
"prompt_cache_hit_tokens": 1344,
"prompt_cache_miss_tokens": 62
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_77caa460-fd9a-41a9-9db6-98c7d65bd59f",
"index": 0,
"type": "function",
"function": {
"name": "k_evaluate",
"arguments": "{\"script\":\"document.querySelectorAll('*').length\"}"
}
}
],
"extraInfo": {
"created": 1747101656646,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_77caa460-fd9a-41a9-9db6-98c7d65bd59f",
"content": [
{
"type": "text",
"text": "Execution result:\n3\n\nConsole output:\n"
}
],
"extraInfo": {
"created": 1747101656651,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1457,
"completion_tokens": 25,
"total_tokens": 1482,
"prompt_tokens_details": {
"cached_tokens": 1408
},
"prompt_cache_hit_tokens": 1408,
"prompt_cache_miss_tokens": 49
}
}
},
{
"role": "assistant",
"content": "",
"tool_calls": [
{
"id": "call_0_379c9e3f-c525-4cde-965c-dea7635f116b",
"index": 0,
"type": "function",
"function": {
"name": "k_evaluate",
"arguments": "{\"script\":\"Array.from(document.querySelectorAll('*')).map(el => el.outerHTML).join('\\\\n')\"}"
}
}
],
"extraInfo": {
"created": 1747101663316,
"state": "success",
"serverName": "deepseek"
}
},
{
"role": "tool",
"index": 0,
"tool_call_id": "call_0_379c9e3f-c525-4cde-965c-dea7635f116b",
"content": [
{
"type": "text",
"text": "Execution result:\n\"<html><head></head><body></body></html>\\n<head></head>\\n<body></body>\"\n\nConsole output:\n"
}
],
"extraInfo": {
"created": 1747101663320,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1508,
"completion_tokens": 39,
"total_tokens": 1547,
"prompt_tokens_details": {
"cached_tokens": 1472
},
"prompt_cache_hit_tokens": 1472,
"prompt_cache_miss_tokens": 36
}
}
},
{
"role": "assistant",
"content": "由于页面加载失败或内容未被正确渲染,无法获取 Hacker News 的热门信息。建议稍后重试或检查网络设置。",
"extraInfo": {
"created": 1747101669791,
"state": "success",
"serverName": "deepseek",
"usage": {
"prompt_tokens": 1600,
"completion_tokens": 30,
"total_tokens": 1630,
"prompt_tokens_details": {
"cached_tokens": 1536
},
"prompt_cache_hit_tokens": 1536,
"prompt_cache_miss_tokens": 64
}
}
}
],
"settings": {
"temperature": 0.7,
"enableTools": [
{
"name": "k_navigate",
"description": "Navigate to a URL",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "URL to navigate to"
},
"launchOptions": {
"type": "object",
"description": "PuppeteerJS LaunchOptions. Default null. If changed and not null, browser restarts. Example: { headless: true, args: ['--no-sandbox'] }"
},
"allowDangerous": {
"type": "boolean",
"description": "Allow dangerous LaunchOptions that reduce security. When false, dangerous args like --no-sandbox will throw errors. Default false."
}
},
"required": [
"url"
]
},
"enabled": true
},
{
"name": "k_screenshot",
"description": "Take a screenshot of the current page or a specific element",
"inputSchema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name for the screenshot"
},
"selector": {
"type": "string",
"description": "CSS selector for element to screenshot"
},
"width": {
"type": "number",
"description": "Width in pixels (default: 800)"
},
"height": {
"type": "number",
"description": "Height in pixels (default: 600)"
}
},
"required": [
"name"
]
},
"enabled": true
},
{
"name": "k_click",
"description": "Click an element on the page",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to click"
}
},
"required": [
"selector"
]
},
"enabled": true
},
{
"name": "k_fill",
"description": "Fill out an input field",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for input field"
},
"value": {
"type": "string",
"description": "Value to fill"
}
},
"required": [
"selector",
"value"
]
},
"enabled": true
},
{
"name": "k_select",
"description": "Select an element on the page with Select tag",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to select"
},
"value": {
"type": "string",
"description": "Value to select"
}
},
"required": [
"selector",
"value"
]
},
"enabled": true
},
{
"name": "k_hover",
"description": "Hover an element on the page",
"inputSchema": {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for element to hover"
}
},
"required": [
"selector"
]
},
"enabled": true
},
{
"name": "k_evaluate",
"description": "Execute JavaScript in the browser console",
"inputSchema": {
"type": "object",
"properties": {
"script": {
"type": "string",
"description": "JavaScript code to execute"
}
},
"required": [
"script"
]
},
"enabled": true
}
],
"systemPrompt": "",
"contextLength": 20
},
"mcp": {
"connectionType": "STDIO",
"command": "node",
"args": [
"~/project/Lagrange.RagBot/node/servers/my-browser/dist/browser.js"
]
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -51,4 +51,19 @@ app.post('/publish-openmcp-client', async (req: Request, res: Response) => {
console.log(error); console.log(error);
res.send(error.toString()); res.send(error.toString());
} }
}) });
app.post('/publish-vsix', async (req: Request, res: Response) => {
try {
const { vsix, tool } = req.body;
const result = execSync(tool + ' publish -i ' + vsix, { cwd: OPENMCP_CLIENT });
res.send({
code: 200,
msg: result
});
} catch (error) {
console.log(error);
res.send(error.toString());
}
});