diff --git a/.cursorignore b/.cursorignore deleted file mode 100644 index ee5e8ff..0000000 --- a/.cursorignore +++ /dev/null @@ -1,2 +0,0 @@ -config.json -.env* \ No newline at end of file diff --git a/package.json b/package.json index c7df5c5..37b9cf9 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "keywords": [], "author": "abearxiong (https://www.xiongxiao.me)", "license": "MIT", - "packageManager": "pnpm@10.9.0", + "packageManager": "pnpm@10.10.0", "type": "module", "publishConfig": { "registry": "https://registry.npmjs.org/", @@ -43,13 +43,13 @@ "@kevisual/code-center-module": "0.0.18", "@kevisual/mark": "0.0.7", "@kevisual/router": "0.0.13", - "@kevisual/types": "^0.0.6", + "@kevisual/types": "^0.0.9", "@kevisual/use-config": "^1.0.11", - "@types/bun": "^1.2.10", + "@types/bun": "^1.2.11", "@types/crypto-js": "^4.2.2", "@types/formidable": "^3.4.5", "@types/lodash-es": "^4.17.12", - "@types/node": "^22.15.2", + "@types/node": "^22.15.3", "@vitejs/plugin-basic-ssl": "^2.0.0", "cookie": "^1.0.2", "cross-env": "^7.0.3", @@ -60,12 +60,12 @@ "ioredis": "^5.6.1", "json5": "^2.2.3", "lodash-es": "^4.17.21", - "openai": "^4.96.0", + "openai": "4.96.2", "pino": "^9.6.0", "pino-pretty": "^13.0.0", "pm2": "^6.0.5", "rimraf": "^6.0.1", - "rollup": "^4.40.0", + "rollup": "^4.40.1", "rollup-plugin-dts": "^6.2.1", "sequelize": "^6.37.7", "tape": "^5.9.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 46c00fe..97b2633 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,14 +18,14 @@ importers: specifier: 0.0.13 version: 0.0.13 '@kevisual/types': - specifier: ^0.0.6 - version: 0.0.6 + specifier: ^0.0.9 + version: 0.0.9 '@kevisual/use-config': specifier: ^1.0.11 version: 1.0.11(dotenv@16.5.0) '@types/bun': - specifier: ^1.2.10 - version: 1.2.10 + specifier: ^1.2.11 + version: 1.2.11 '@types/crypto-js': specifier: ^4.2.2 version: 4.2.2 @@ -36,11 +36,11 @@ importers: specifier: ^4.17.12 version: 4.17.12 '@types/node': - specifier: ^22.15.2 - version: 22.15.2 + specifier: ^22.15.3 + version: 22.15.3 '@vitejs/plugin-basic-ssl': specifier: ^2.0.0 - version: 2.0.0(vite@6.3.3(@types/node@22.15.2)(tsx@4.19.3)) + version: 2.0.0(vite@6.3.3(@types/node@22.15.3)(tsx@4.19.3)) cookie: specifier: ^1.0.2 version: 1.0.2 @@ -69,8 +69,8 @@ importers: specifier: ^4.17.21 version: 4.17.21 openai: - specifier: ^4.96.0 - version: 4.96.0(ws@8.18.1)(zod@3.24.2) + specifier: 4.96.2 + version: 4.96.2(ws@8.18.1)(zod@3.24.2) pino: specifier: ^9.6.0 version: 9.6.0 @@ -84,11 +84,11 @@ importers: specifier: ^6.0.1 version: 6.0.1 rollup: - specifier: ^4.40.0 - version: 4.40.0 + specifier: ^4.40.1 + version: 4.40.1 rollup-plugin-dts: specifier: ^6.2.1 - version: 6.2.1(rollup@4.40.0)(typescript@5.8.3) + version: 6.2.1(rollup@4.40.1)(typescript@5.8.3) sequelize: specifier: ^6.37.7 version: 6.37.7(pg@8.14.1) @@ -103,7 +103,7 @@ importers: version: 5.8.3 vite: specifier: ^6.3.3 - version: 6.3.3(@types/node@22.15.2)(tsx@4.19.3) + version: 6.3.3(@types/node@22.15.3)(tsx@4.19.3) packages: @@ -304,8 +304,8 @@ packages: '@kevisual/router@0.0.7': resolution: {integrity: sha512-4n1Tp4YLoraJv7jtfy7jbuLGyAj0B2QkTlnlEDHCUTlEUOvOkjtf7DHAe2SL92fTgXhSbod0I/0vUcDF85oj/w==} - '@kevisual/types@0.0.6': - resolution: {integrity: sha512-7yxe1QmuC5g7lI/1Hm+zXly8if0z+ZqGM1SVOVv2VNRwRAVYBJDc365zWCCfRwE+5YaB2daWTe5zBOU4EkltkQ==} + '@kevisual/types@0.0.9': + resolution: {integrity: sha512-SDJ7GMbOx7Ghz2kreHqym56ccAJS3t93y+NS0+afTLxcq2+cKcoEy2F8WXEv0mnJ6EsDp5AbA7Jv5TZA1Jbc3A==} '@kevisual/use-config@1.0.11': resolution: {integrity: sha512-ccilQTRZTpO075L67ZBXhr8Lp3i73/W5cCMT5enMjVrnJT5K0i5JH5IbzBhF6WY5Rj8dmVsAyyjJe24ClyM7Eg==} @@ -420,103 +420,114 @@ packages: rollup: optional: true - '@rollup/rollup-android-arm-eabi@4.40.0': - resolution: {integrity: sha512-+Fbls/diZ0RDerhE8kyC6hjADCXA1K4yVNlH0EYfd2XjyH0UGgzaQ8MlT0pCXAThfxv3QUAczHaL+qSv1E4/Cg==} + '@rollup/rollup-android-arm-eabi@4.40.1': + resolution: {integrity: sha512-kxz0YeeCrRUHz3zyqvd7n+TVRlNyTifBsmnmNPtk3hQURUyG9eAB+usz6DAwagMusjx/zb3AjvDUvhFGDAexGw==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.40.0': - resolution: {integrity: sha512-PPA6aEEsTPRz+/4xxAmaoWDqh67N7wFbgFUJGMnanCFs0TV99M0M8QhhaSCks+n6EbQoFvLQgYOGXxlMGQe/6w==} + '@rollup/rollup-android-arm64@4.40.1': + resolution: {integrity: sha512-PPkxTOisoNC6TpnDKatjKkjRMsdaWIhyuMkA4UsBXT9WEZY4uHezBTjs6Vl4PbqQQeu6oION1w2voYZv9yquCw==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.40.0': - resolution: {integrity: sha512-GwYOcOakYHdfnjjKwqpTGgn5a6cUX7+Ra2HeNj/GdXvO2VJOOXCiYYlRFU4CubFM67EhbmzLOmACKEfvp3J1kQ==} + '@rollup/rollup-darwin-arm64@4.40.1': + resolution: {integrity: sha512-VWXGISWFY18v/0JyNUy4A46KCFCb9NVsH+1100XP31lud+TzlezBbz24CYzbnA4x6w4hx+NYCXDfnvDVO6lcAA==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.40.0': - resolution: {integrity: sha512-CoLEGJ+2eheqD9KBSxmma6ld01czS52Iw0e2qMZNpPDlf7Z9mj8xmMemxEucinev4LgHalDPczMyxzbq+Q+EtA==} + '@rollup/rollup-darwin-x64@4.40.1': + resolution: {integrity: sha512-nIwkXafAI1/QCS7pxSpv/ZtFW6TXcNUEHAIA9EIyw5OzxJZQ1YDrX+CL6JAIQgZ33CInl1R6mHet9Y/UZTg2Bw==} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.40.0': - resolution: {integrity: sha512-r7yGiS4HN/kibvESzmrOB/PxKMhPTlz+FcGvoUIKYoTyGd5toHp48g1uZy1o1xQvybwwpqpe010JrcGG2s5nkg==} + '@rollup/rollup-freebsd-arm64@4.40.1': + resolution: {integrity: sha512-BdrLJ2mHTrIYdaS2I99mriyJfGGenSaP+UwGi1kB9BLOCu9SR8ZpbkmmalKIALnRw24kM7qCN0IOm6L0S44iWw==} cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.40.0': - resolution: {integrity: sha512-mVDxzlf0oLzV3oZOr0SMJ0lSDd3xC4CmnWJ8Val8isp9jRGl5Dq//LLDSPFrasS7pSm6m5xAcKaw3sHXhBjoRw==} + '@rollup/rollup-freebsd-x64@4.40.1': + resolution: {integrity: sha512-VXeo/puqvCG8JBPNZXZf5Dqq7BzElNJzHRRw3vjBE27WujdzuOPecDPc/+1DcdcTptNBep3861jNq0mYkT8Z6Q==} cpu: [x64] os: [freebsd] - '@rollup/rollup-linux-arm-gnueabihf@4.40.0': - resolution: {integrity: sha512-y/qUMOpJxBMy8xCXD++jeu8t7kzjlOCkoxxajL58G62PJGBZVl/Gwpm7JK9+YvlB701rcQTzjUZ1JgUoPTnoQA==} + '@rollup/rollup-linux-arm-gnueabihf@4.40.1': + resolution: {integrity: sha512-ehSKrewwsESPt1TgSE/na9nIhWCosfGSFqv7vwEtjyAqZcvbGIg4JAcV7ZEh2tfj/IlfBeZjgOXm35iOOjadcg==} cpu: [arm] os: [linux] + libc: [glibc] - '@rollup/rollup-linux-arm-musleabihf@4.40.0': - resolution: {integrity: sha512-GoCsPibtVdJFPv/BOIvBKO/XmwZLwaNWdyD8TKlXuqp0veo2sHE+A/vpMQ5iSArRUz/uaoj4h5S6Pn0+PdhRjg==} + '@rollup/rollup-linux-arm-musleabihf@4.40.1': + resolution: {integrity: sha512-m39iO/aaurh5FVIu/F4/Zsl8xppd76S4qoID8E+dSRQvTyZTOI2gVk3T4oqzfq1PtcvOfAVlwLMK3KRQMaR8lg==} cpu: [arm] os: [linux] + libc: [musl] - '@rollup/rollup-linux-arm64-gnu@4.40.0': - resolution: {integrity: sha512-L5ZLphTjjAD9leJzSLI7rr8fNqJMlGDKlazW2tX4IUF9P7R5TMQPElpH82Q7eNIDQnQlAyiNVfRPfP2vM5Avvg==} + '@rollup/rollup-linux-arm64-gnu@4.40.1': + resolution: {integrity: sha512-Y+GHnGaku4aVLSgrT0uWe2o2Rq8te9hi+MwqGF9r9ORgXhmHK5Q71N757u0F8yU1OIwUIFy6YiJtKjtyktk5hg==} cpu: [arm64] os: [linux] + libc: [glibc] - '@rollup/rollup-linux-arm64-musl@4.40.0': - resolution: {integrity: sha512-ATZvCRGCDtv1Y4gpDIXsS+wfFeFuLwVxyUBSLawjgXK2tRE6fnsQEkE4csQQYWlBlsFztRzCnBvWVfcae/1qxQ==} + '@rollup/rollup-linux-arm64-musl@4.40.1': + resolution: {integrity: sha512-jEwjn3jCA+tQGswK3aEWcD09/7M5wGwc6+flhva7dsQNRZZTe30vkalgIzV4tjkopsTS9Jd7Y1Bsj6a4lzz8gQ==} cpu: [arm64] os: [linux] + libc: [musl] - '@rollup/rollup-linux-loongarch64-gnu@4.40.0': - resolution: {integrity: sha512-wG9e2XtIhd++QugU5MD9i7OnpaVb08ji3P1y/hNbxrQ3sYEelKJOq1UJ5dXczeo6Hj2rfDEL5GdtkMSVLa/AOg==} + '@rollup/rollup-linux-loongarch64-gnu@4.40.1': + resolution: {integrity: sha512-ySyWikVhNzv+BV/IDCsrraOAZ3UaC8SZB67FZlqVwXwnFhPihOso9rPOxzZbjp81suB1O2Topw+6Ug3JNegejQ==} cpu: [loong64] os: [linux] + libc: [glibc] - '@rollup/rollup-linux-powerpc64le-gnu@4.40.0': - resolution: {integrity: sha512-vgXfWmj0f3jAUvC7TZSU/m/cOE558ILWDzS7jBhiCAFpY2WEBn5jqgbqvmzlMjtp8KlLcBlXVD2mkTSEQE6Ixw==} + '@rollup/rollup-linux-powerpc64le-gnu@4.40.1': + resolution: {integrity: sha512-BvvA64QxZlh7WZWqDPPdt0GH4bznuL6uOO1pmgPnnv86rpUpc8ZxgZwcEgXvo02GRIZX1hQ0j0pAnhwkhwPqWg==} cpu: [ppc64] os: [linux] + libc: [glibc] - '@rollup/rollup-linux-riscv64-gnu@4.40.0': - resolution: {integrity: sha512-uJkYTugqtPZBS3Z136arevt/FsKTF/J9dEMTX/cwR7lsAW4bShzI2R0pJVw+hcBTWF4dxVckYh72Hk3/hWNKvA==} + '@rollup/rollup-linux-riscv64-gnu@4.40.1': + resolution: {integrity: sha512-EQSP+8+1VuSulm9RKSMKitTav89fKbHymTf25n5+Yr6gAPZxYWpj3DzAsQqoaHAk9YX2lwEyAf9S4W8F4l3VBQ==} cpu: [riscv64] os: [linux] + libc: [glibc] - '@rollup/rollup-linux-riscv64-musl@4.40.0': - resolution: {integrity: sha512-rKmSj6EXQRnhSkE22+WvrqOqRtk733x3p5sWpZilhmjnkHkpeCgWsFFo0dGnUGeA+OZjRl3+VYq+HyCOEuwcxQ==} + '@rollup/rollup-linux-riscv64-musl@4.40.1': + resolution: {integrity: sha512-n/vQ4xRZXKuIpqukkMXZt9RWdl+2zgGNx7Uda8NtmLJ06NL8jiHxUawbwC+hdSq1rrw/9CghCpEONor+l1e2gA==} cpu: [riscv64] os: [linux] + libc: [musl] - '@rollup/rollup-linux-s390x-gnu@4.40.0': - resolution: {integrity: sha512-SpnYlAfKPOoVsQqmTFJ0usx0z84bzGOS9anAC0AZ3rdSo3snecihbhFTlJZ8XMwzqAcodjFU4+/SM311dqE5Sw==} + '@rollup/rollup-linux-s390x-gnu@4.40.1': + resolution: {integrity: sha512-h8d28xzYb98fMQKUz0w2fMc1XuGzLLjdyxVIbhbil4ELfk5/orZlSTpF/xdI9C8K0I8lCkq+1En2RJsawZekkg==} cpu: [s390x] os: [linux] + libc: [glibc] - '@rollup/rollup-linux-x64-gnu@4.40.0': - resolution: {integrity: sha512-RcDGMtqF9EFN8i2RYN2W+64CdHruJ5rPqrlYw+cgM3uOVPSsnAQps7cpjXe9be/yDp8UC7VLoCoKC8J3Kn2FkQ==} + '@rollup/rollup-linux-x64-gnu@4.40.1': + resolution: {integrity: sha512-XiK5z70PEFEFqcNj3/zRSz/qX4bp4QIraTy9QjwJAb/Z8GM7kVUsD0Uk8maIPeTyPCP03ChdI+VVmJriKYbRHQ==} cpu: [x64] os: [linux] + libc: [glibc] - '@rollup/rollup-linux-x64-musl@4.40.0': - resolution: {integrity: sha512-HZvjpiUmSNx5zFgwtQAV1GaGazT2RWvqeDi0hV+AtC8unqqDSsaFjPxfsO6qPtKRRg25SisACWnJ37Yio8ttaw==} + '@rollup/rollup-linux-x64-musl@4.40.1': + resolution: {integrity: sha512-2BRORitq5rQ4Da9blVovzNCMaUlyKrzMSvkVR0D4qPuOy/+pMCrh1d7o01RATwVy+6Fa1WBw+da7QPeLWU/1mQ==} cpu: [x64] os: [linux] + libc: [musl] - '@rollup/rollup-win32-arm64-msvc@4.40.0': - resolution: {integrity: sha512-UtZQQI5k/b8d7d3i9AZmA/t+Q4tk3hOC0tMOMSq2GlMYOfxbesxG4mJSeDp0EHs30N9bsfwUvs3zF4v/RzOeTQ==} + '@rollup/rollup-win32-arm64-msvc@4.40.1': + resolution: {integrity: sha512-b2bcNm9Kbde03H+q+Jjw9tSfhYkzrDUf2d5MAd1bOJuVplXvFhWz7tRtWvD8/ORZi7qSCy0idW6tf2HgxSXQSg==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.40.0': - resolution: {integrity: sha512-+m03kvI2f5syIqHXCZLPVYplP8pQch9JHyXKZ3AGMKlg8dCyr2PKHjwRLiW53LTrN/Nc3EqHOKxUxzoSPdKddA==} + '@rollup/rollup-win32-ia32-msvc@4.40.1': + resolution: {integrity: sha512-DfcogW8N7Zg7llVEfpqWMZcaErKfsj9VvmfSyRjCyo4BI3wPEfrzTtJkZG6gKP/Z92wFm6rz2aDO7/JfiR/whA==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.40.0': - resolution: {integrity: sha512-lpPE1cLfP5oPzVjKMx10pgBmKELQnFJXHgvtHCtuJWOv8MxqdEIMNtgHgBFf7Ea2/7EuVwa9fodWUfXAlXZLZQ==} + '@rollup/rollup-win32-x64-msvc@4.40.1': + resolution: {integrity: sha512-ECyOuDeH3C1I8jH2MK1RtBJW+YPMvSfT0a5NN0nHfQYnDSJ6tUiZH3gzwVP5/Kfh/+Tt7tpWVF9LXNTnhTJ3kA==} cpu: [x64] os: [win32] @@ -526,8 +537,8 @@ packages: '@tootallnate/quickjs-emscripten@0.23.0': resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} - '@types/bun@1.2.10': - resolution: {integrity: sha512-eilv6WFM3M0c9ztJt7/g80BDusK98z/FrFwseZgT4bXCq2vPhXD4z8R3oddmAn+R/Nmz9vBn4kweJKmGTZj+lg==} + '@types/bun@1.2.11': + resolution: {integrity: sha512-ZLbbI91EmmGwlWTRWuV6J19IUiUC5YQ3TCEuSHI3usIP75kuoA8/0PVF+LTrbEnVc8JIhpElWOxv1ocI1fJBbw==} '@types/cors@2.8.17': resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==} @@ -571,8 +582,8 @@ packages: '@types/node@18.19.86': resolution: {integrity: sha512-fifKayi175wLyKyc5qUfyENhQ1dCNI1UNjp653d8kuYcPQN5JhX3dGuP/XmvPTg/xRBn1VTLpbmi+H/Mr7tLfQ==} - '@types/node@22.15.2': - resolution: {integrity: sha512-uKXqKN9beGoMdBfcaTY1ecwz6ctxuJAcUlwE55938g0ZJ8lRxwAZqRz2AJ4pzpt5dHdTPMB863UZ0ESiFUcP7A==} + '@types/node@22.15.3': + resolution: {integrity: sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -715,8 +726,8 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - bun-types@1.2.10: - resolution: {integrity: sha512-b5ITZMnVdf3m1gMvJHG+gIfeJHiQPJak0f7925Hxu6ZN5VKA8AGy4GZ4lM+Xkn6jtWxg5S3ldWvfmXdvnkp3GQ==} + bun-types@1.2.11: + resolution: {integrity: sha512-dbkp5Lo8HDrXkLrONm6bk+yiiYQSntvFUzQp0v3pzTAsXk6FtgVMjdQ+lzFNVAmQFUkPQZ3WMZqH5tTo+Dp/IA==} call-bind-apply-helpers@1.0.2: resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} @@ -1573,8 +1584,8 @@ packages: once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - openai@4.96.0: - resolution: {integrity: sha512-dKoW56i02Prv2XQolJ9Rl9Svqubqkzg3QpwEOBuSVZLk05Shelu7s+ErRTwFc1Bs3JZ2qBqBfVpXQiJhwOGG8A==} + openai@4.96.2: + resolution: {integrity: sha512-R2XnxvMsizkROr7BV3uNp1q/3skwPZ7fmPjO1bXLnfB4Tu5xKxrT1EVwzjhxn0MZKBKAvOaGWS63jTMN6KrIXA==} hasBin: true peerDependencies: ws: ^8.18.0 @@ -1846,8 +1857,8 @@ packages: rollup-pluginutils@2.8.2: resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} - rollup@4.40.0: - resolution: {integrity: sha512-Noe455xmA96nnqH5piFtLobsGbCij7Tu+tb3c1vYjNbTkfzGqXqQXG3wJaYXkRZuQ0vEYN4bhwg7QnIrqB5B+w==} + rollup@4.40.1: + resolution: {integrity: sha512-C5VvvgCCyfyotVITIAv+4efVytl5F7wt+/I2i9q9GZcEXW9BP52YYOXC58igUi+LFZVHukErIIqQSWwv/M3WRw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -2468,20 +2479,20 @@ snapshots: '@kevisual/rollup-tools@0.0.1(esbuild@0.25.2)': dependencies: - '@rollup/plugin-alias': 5.1.1(rollup@4.40.0) - '@rollup/plugin-commonjs': 28.0.3(rollup@4.40.0) - '@rollup/plugin-json': 6.1.0(rollup@4.40.0) - '@rollup/plugin-node-resolve': 15.3.1(rollup@4.40.0) - '@rollup/plugin-replace': 6.0.2(rollup@4.40.0) - '@rollup/plugin-typescript': 12.1.2(rollup@4.40.0)(tslib@2.8.1)(typescript@5.8.3) - '@types/node': 22.15.2 + '@rollup/plugin-alias': 5.1.1(rollup@4.40.1) + '@rollup/plugin-commonjs': 28.0.3(rollup@4.40.1) + '@rollup/plugin-json': 6.1.0(rollup@4.40.1) + '@rollup/plugin-node-resolve': 15.3.1(rollup@4.40.1) + '@rollup/plugin-replace': 6.0.2(rollup@4.40.1) + '@rollup/plugin-typescript': 12.1.2(rollup@4.40.1)(tslib@2.8.1)(typescript@5.8.3) + '@types/node': 22.15.3 chalk: 5.4.1 commander: 12.1.0 glob: 11.0.1 - rollup: 4.40.0 + rollup: 4.40.1 rollup-plugin-copy: 3.5.0 - rollup-plugin-dts: 6.2.1(rollup@4.40.0)(typescript@5.8.3) - rollup-plugin-esbuild: 6.2.1(esbuild@0.25.2)(rollup@4.40.0) + rollup-plugin-dts: 6.2.1(rollup@4.40.1)(typescript@5.8.3) + rollup-plugin-esbuild: 6.2.1(esbuild@0.25.2)(rollup@4.40.1) rollup-plugin-inject: 3.0.2 tslib: 2.8.1 typescript: 5.8.3 @@ -2503,7 +2514,7 @@ snapshots: - bufferutil - utf-8-validate - '@kevisual/types@0.0.6': {} + '@kevisual/types@0.0.9': {} '@kevisual/use-config@1.0.11(dotenv@16.5.0)': dependencies: @@ -2587,13 +2598,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@rollup/plugin-alias@5.1.1(rollup@4.40.0)': + '@rollup/plugin-alias@5.1.1(rollup@4.40.1)': optionalDependencies: - rollup: 4.40.0 + rollup: 4.40.1 - '@rollup/plugin-commonjs@28.0.3(rollup@4.40.0)': + '@rollup/plugin-commonjs@28.0.3(rollup@4.40.1)': dependencies: - '@rollup/pluginutils': 5.1.4(rollup@4.40.0) + '@rollup/pluginutils': 5.1.4(rollup@4.40.1) commondir: 1.0.1 estree-walker: 2.0.2 fdir: 6.4.3(picomatch@4.0.2) @@ -2601,119 +2612,119 @@ snapshots: magic-string: 0.30.17 picomatch: 4.0.2 optionalDependencies: - rollup: 4.40.0 + rollup: 4.40.1 - '@rollup/plugin-json@6.1.0(rollup@4.40.0)': + '@rollup/plugin-json@6.1.0(rollup@4.40.1)': dependencies: - '@rollup/pluginutils': 5.1.4(rollup@4.40.0) + '@rollup/pluginutils': 5.1.4(rollup@4.40.1) optionalDependencies: - rollup: 4.40.0 + rollup: 4.40.1 - '@rollup/plugin-node-resolve@15.3.1(rollup@4.40.0)': + '@rollup/plugin-node-resolve@15.3.1(rollup@4.40.1)': dependencies: - '@rollup/pluginutils': 5.1.4(rollup@4.40.0) + '@rollup/pluginutils': 5.1.4(rollup@4.40.1) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-module: 1.0.0 resolve: 1.22.10 optionalDependencies: - rollup: 4.40.0 + rollup: 4.40.1 - '@rollup/plugin-replace@6.0.2(rollup@4.40.0)': + '@rollup/plugin-replace@6.0.2(rollup@4.40.1)': dependencies: - '@rollup/pluginutils': 5.1.4(rollup@4.40.0) + '@rollup/pluginutils': 5.1.4(rollup@4.40.1) magic-string: 0.30.17 optionalDependencies: - rollup: 4.40.0 + rollup: 4.40.1 - '@rollup/plugin-typescript@12.1.2(rollup@4.40.0)(tslib@2.8.1)(typescript@5.8.3)': + '@rollup/plugin-typescript@12.1.2(rollup@4.40.1)(tslib@2.8.1)(typescript@5.8.3)': dependencies: - '@rollup/pluginutils': 5.1.4(rollup@4.40.0) + '@rollup/pluginutils': 5.1.4(rollup@4.40.1) resolve: 1.22.10 typescript: 5.8.3 optionalDependencies: - rollup: 4.40.0 + rollup: 4.40.1 tslib: 2.8.1 - '@rollup/pluginutils@5.1.4(rollup@4.40.0)': + '@rollup/pluginutils@5.1.4(rollup@4.40.1)': dependencies: '@types/estree': 1.0.7 estree-walker: 2.0.2 picomatch: 4.0.2 optionalDependencies: - rollup: 4.40.0 + rollup: 4.40.1 - '@rollup/rollup-android-arm-eabi@4.40.0': + '@rollup/rollup-android-arm-eabi@4.40.1': optional: true - '@rollup/rollup-android-arm64@4.40.0': + '@rollup/rollup-android-arm64@4.40.1': optional: true - '@rollup/rollup-darwin-arm64@4.40.0': + '@rollup/rollup-darwin-arm64@4.40.1': optional: true - '@rollup/rollup-darwin-x64@4.40.0': + '@rollup/rollup-darwin-x64@4.40.1': optional: true - '@rollup/rollup-freebsd-arm64@4.40.0': + '@rollup/rollup-freebsd-arm64@4.40.1': optional: true - '@rollup/rollup-freebsd-x64@4.40.0': + '@rollup/rollup-freebsd-x64@4.40.1': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.40.0': + '@rollup/rollup-linux-arm-gnueabihf@4.40.1': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.40.0': + '@rollup/rollup-linux-arm-musleabihf@4.40.1': optional: true - '@rollup/rollup-linux-arm64-gnu@4.40.0': + '@rollup/rollup-linux-arm64-gnu@4.40.1': optional: true - '@rollup/rollup-linux-arm64-musl@4.40.0': + '@rollup/rollup-linux-arm64-musl@4.40.1': optional: true - '@rollup/rollup-linux-loongarch64-gnu@4.40.0': + '@rollup/rollup-linux-loongarch64-gnu@4.40.1': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.40.0': + '@rollup/rollup-linux-powerpc64le-gnu@4.40.1': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.40.0': + '@rollup/rollup-linux-riscv64-gnu@4.40.1': optional: true - '@rollup/rollup-linux-riscv64-musl@4.40.0': + '@rollup/rollup-linux-riscv64-musl@4.40.1': optional: true - '@rollup/rollup-linux-s390x-gnu@4.40.0': + '@rollup/rollup-linux-s390x-gnu@4.40.1': optional: true - '@rollup/rollup-linux-x64-gnu@4.40.0': + '@rollup/rollup-linux-x64-gnu@4.40.1': optional: true - '@rollup/rollup-linux-x64-musl@4.40.0': + '@rollup/rollup-linux-x64-musl@4.40.1': optional: true - '@rollup/rollup-win32-arm64-msvc@4.40.0': + '@rollup/rollup-win32-arm64-msvc@4.40.1': optional: true - '@rollup/rollup-win32-ia32-msvc@4.40.0': + '@rollup/rollup-win32-ia32-msvc@4.40.1': optional: true - '@rollup/rollup-win32-x64-msvc@4.40.0': + '@rollup/rollup-win32-x64-msvc@4.40.1': optional: true '@socket.io/component-emitter@3.1.2': {} '@tootallnate/quickjs-emscripten@0.23.0': {} - '@types/bun@1.2.10': + '@types/bun@1.2.11': dependencies: - bun-types: 1.2.10 + bun-types: 1.2.11 '@types/cors@2.8.17': dependencies: - '@types/node': 22.15.2 + '@types/node': 22.15.3 '@types/crypto-js@4.2.2': {} @@ -2725,16 +2736,16 @@ snapshots: '@types/formidable@3.4.5': dependencies: - '@types/node': 22.15.2 + '@types/node': 22.15.3 '@types/fs-extra@8.1.5': dependencies: - '@types/node': 22.15.2 + '@types/node': 22.15.3 '@types/glob@7.2.0': dependencies: '@types/minimatch': 5.1.2 - '@types/node': 22.15.2 + '@types/node': 22.15.3 '@types/lodash-es@4.17.12': dependencies: @@ -2748,18 +2759,18 @@ snapshots: '@types/node-fetch@2.6.12': dependencies: - '@types/node': 22.15.2 + '@types/node': 22.15.3 form-data: 4.0.2 '@types/node-forge@1.3.11': dependencies: - '@types/node': 22.15.2 + '@types/node': 22.15.3 '@types/node@18.19.86': dependencies: undici-types: 5.26.5 - '@types/node@22.15.2': + '@types/node@22.15.3': dependencies: undici-types: 6.21.0 @@ -2767,9 +2778,9 @@ snapshots: '@types/validator@13.12.3': {} - '@vitejs/plugin-basic-ssl@2.0.0(vite@6.3.3(@types/node@22.15.2)(tsx@4.19.3))': + '@vitejs/plugin-basic-ssl@2.0.0(vite@6.3.3(@types/node@22.15.3)(tsx@4.19.3))': dependencies: - vite: 6.3.3(@types/node@22.15.2)(tsx@4.19.3) + vite: 6.3.3(@types/node@22.15.3)(tsx@4.19.3) abort-controller@3.0.0: dependencies: @@ -2885,9 +2896,9 @@ snapshots: buffer-from@1.1.2: {} - bun-types@1.2.10: + bun-types@1.2.11: dependencies: - '@types/node': 22.15.2 + '@types/node': 22.15.3 call-bind-apply-helpers@1.0.2: dependencies: @@ -3103,7 +3114,7 @@ snapshots: engine.io@6.6.4: dependencies: '@types/cors': 2.8.17 - '@types/node': 22.15.2 + '@types/node': 22.15.3 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.7.2 @@ -3824,7 +3835,7 @@ snapshots: dependencies: wrappy: 1.0.2 - openai@4.96.0(ws@8.18.1)(zod@3.24.2): + openai@4.96.2(ws@8.18.1)(zod@3.24.2): dependencies: '@types/node': 18.19.86 '@types/node-fetch': 2.6.12 @@ -4166,21 +4177,21 @@ snapshots: globby: 10.0.1 is-plain-object: 3.0.1 - rollup-plugin-dts@6.2.1(rollup@4.40.0)(typescript@5.8.3): + rollup-plugin-dts@6.2.1(rollup@4.40.1)(typescript@5.8.3): dependencies: magic-string: 0.30.17 - rollup: 4.40.0 + rollup: 4.40.1 typescript: 5.8.3 optionalDependencies: '@babel/code-frame': 7.26.2 - rollup-plugin-esbuild@6.2.1(esbuild@0.25.2)(rollup@4.40.0): + rollup-plugin-esbuild@6.2.1(esbuild@0.25.2)(rollup@4.40.1): dependencies: debug: 4.4.0 es-module-lexer: 1.6.0 esbuild: 0.25.2 get-tsconfig: 4.10.0 - rollup: 4.40.0 + rollup: 4.40.1 unplugin-utils: 0.2.4 transitivePeerDependencies: - supports-color @@ -4195,30 +4206,30 @@ snapshots: dependencies: estree-walker: 0.6.1 - rollup@4.40.0: + rollup@4.40.1: dependencies: '@types/estree': 1.0.7 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.40.0 - '@rollup/rollup-android-arm64': 4.40.0 - '@rollup/rollup-darwin-arm64': 4.40.0 - '@rollup/rollup-darwin-x64': 4.40.0 - '@rollup/rollup-freebsd-arm64': 4.40.0 - '@rollup/rollup-freebsd-x64': 4.40.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.40.0 - '@rollup/rollup-linux-arm-musleabihf': 4.40.0 - '@rollup/rollup-linux-arm64-gnu': 4.40.0 - '@rollup/rollup-linux-arm64-musl': 4.40.0 - '@rollup/rollup-linux-loongarch64-gnu': 4.40.0 - '@rollup/rollup-linux-powerpc64le-gnu': 4.40.0 - '@rollup/rollup-linux-riscv64-gnu': 4.40.0 - '@rollup/rollup-linux-riscv64-musl': 4.40.0 - '@rollup/rollup-linux-s390x-gnu': 4.40.0 - '@rollup/rollup-linux-x64-gnu': 4.40.0 - '@rollup/rollup-linux-x64-musl': 4.40.0 - '@rollup/rollup-win32-arm64-msvc': 4.40.0 - '@rollup/rollup-win32-ia32-msvc': 4.40.0 - '@rollup/rollup-win32-x64-msvc': 4.40.0 + '@rollup/rollup-android-arm-eabi': 4.40.1 + '@rollup/rollup-android-arm64': 4.40.1 + '@rollup/rollup-darwin-arm64': 4.40.1 + '@rollup/rollup-darwin-x64': 4.40.1 + '@rollup/rollup-freebsd-arm64': 4.40.1 + '@rollup/rollup-freebsd-x64': 4.40.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.40.1 + '@rollup/rollup-linux-arm-musleabihf': 4.40.1 + '@rollup/rollup-linux-arm64-gnu': 4.40.1 + '@rollup/rollup-linux-arm64-musl': 4.40.1 + '@rollup/rollup-linux-loongarch64-gnu': 4.40.1 + '@rollup/rollup-linux-powerpc64le-gnu': 4.40.1 + '@rollup/rollup-linux-riscv64-gnu': 4.40.1 + '@rollup/rollup-linux-riscv64-musl': 4.40.1 + '@rollup/rollup-linux-s390x-gnu': 4.40.1 + '@rollup/rollup-linux-x64-gnu': 4.40.1 + '@rollup/rollup-linux-x64-musl': 4.40.1 + '@rollup/rollup-win32-arm64-msvc': 4.40.1 + '@rollup/rollup-win32-ia32-msvc': 4.40.1 + '@rollup/rollup-win32-x64-msvc': 4.40.1 fsevents: 2.3.3 run-parallel@1.2.0: @@ -4605,16 +4616,16 @@ snapshots: vary@1.1.2: {} - vite@6.3.3(@types/node@22.15.2)(tsx@4.19.3): + vite@6.3.3(@types/node@22.15.3)(tsx@4.19.3): dependencies: esbuild: 0.25.2 fdir: 6.4.4(picomatch@4.0.2) picomatch: 4.0.2 postcss: 8.5.3 - rollup: 4.40.0 + rollup: 4.40.1 tinyglobby: 0.2.13 optionalDependencies: - '@types/node': 22.15.2 + '@types/node': 22.15.3 fsevents: 2.3.3 tsx: 4.19.3 @@ -4681,7 +4692,7 @@ snapshots: wkx@0.5.0: dependencies: - '@types/node': 22.15.2 + '@types/node': 22.15.3 wrap-ansi@7.0.0: dependencies: diff --git a/src/test/func-call/curl.sh b/src/test/func-call/curl.sh new file mode 100644 index 0000000..f9f00ae --- /dev/null +++ b/src/test/func-call/curl.sh @@ -0,0 +1,35 @@ +curl --request POST \ + --url https://api.siliconflow.cn/v1/chat/completions \ + --header 'Authorization: Bearer sk-qbiigkzoaamuqxtwlgkugodncebkfbosemadfubjrseobpvx' \ + --header 'Content-Type: application/json' \ + --data '{ + "model": "Qwen/Qwen3-14B", + "messages": [ + { + "role": "user", + "content": "计算a+b的值" + } + ], + "stream": false, + "max_tokens": 512, + "stop": null, + "temperature": 0.7, + "top_p": 0.7, + "top_k": 50, + "frequency_penalty": 0.5, + "n": 1, + "response_format": { + "type": "text" + }, + "tools": [ + { + "type": "function", + "function": { + "description": "计算a,b,c算法的值,a=1,b=2,c=3", + "name": "compouted", + "parameters": {}, + "strict": false + } + } + ] +}' \ No newline at end of file diff --git a/src/test/func-call/demo.ts b/src/test/func-call/demo.ts new file mode 100644 index 0000000..6b91d7f --- /dev/null +++ b/src/test/func-call/demo.ts @@ -0,0 +1,116 @@ +import { SiliconFlow } from '../../provider/chat-adapter/siliconflow.ts'; +import { Ollama } from '../../provider/chat-adapter/ollama.ts'; +import dotenv from 'dotenv'; + +dotenv.config(); +const siliconflow = new SiliconFlow({ + apiKey: process.env.SILICONFLOW_API_KEY, + model: 'Qwen/Qwen3-14B', +}); +const ollama = new Ollama({ + model: 'qwen3:32b', + apiKey: process.env.OLLAMA_API_KEY, + baseURL: process.env.OLLAMA_BASE_URL, +}); +const main = async () => { + const usage = await siliconflow.getUsageInfo(); + console.log(usage); +}; +// 1. 定义工具函数 +const availableFunctions: Record Promise> = { + get_time: async (args: { location: string }) => { + // 模拟API调用 + console.log('time', args); + return { + time: '2022-03-22 12:00:00', + }; + }, + get_location: async (args: { symbol: string }) => { + // 模拟API调用 + console.log('location', args); + return { + city: 'Beijing', + }; + }, +}; + +// main(); +const funcCall = async (model = siliconflow) => { + const tools = [ + { + type: 'function', + function: { + name: 'get_time', + description: '获取当前时间', + parameters: { + type: 'object', + properties: { + place: { + type: 'string', + description: '位置', + }, + }, + required: ['place'], + }, + }, + }, + { + type: 'function', + function: { + name: 'get_location', + description: '获取当前位置', + // parameters: {}, + parameters: {}, + strict: false, + }, + }, + ]; + const messages: any[] = [{ role: 'user', content: '获取当前位置的当前时间' }]; + const res = await model.chat(messages, { + tools: tools as any, + }); + console.log(res.choices[0]); + const assistantMessage = res.choices[0].message; + const finish_reason = res.choices[0].finish_reason; + messages.push(assistantMessage); + let toolCalls = assistantMessage.tool_calls; + console.log("toolCalls", JSON.stringify(toolCalls)); + let maxRetries = 3; + while (toolCalls && toolCalls.length > 0) { + // 处理每个函数调用 + for (const toolCall of toolCalls) { + const functionName = toolCall.function.name; + const functionArgs = JSON.parse(toolCall.function.arguments); + // 调用本地函数 + const functionResponse = await availableFunctions[functionName](functionArgs); + // 将结果添加到消息历史 + messages.push({ + role: 'tool', + name: functionName, + content: JSON.stringify(functionResponse), + tool_call_id: toolCall.id, + }); + } + + // 第二次调用 - 将函数结果发送给模型获取最终回复 + const secondResponse = await model.chat(messages, { + tools: tools as any, + }); + + const finalMessage = secondResponse.choices[0].message; + messages.push(finalMessage); + const _toolCalls = finalMessage.tool_calls; + console.log("toolCalls", JSON.stringify(toolCalls) ,finalMessage.role); + toolCalls = _toolCalls ? _toolCalls : []; + maxRetries--; + if (maxRetries <= 0) { + break; + } + + console.log('tool calls', toolCalls); + } + + console.log(messages); +}; + +funcCall(ollama as any);