generated from tailored/router-template
Compare commits
2 Commits
8891b196ba
...
ce7cd03cb3
Author | SHA1 | Date | |
---|---|---|---|
ce7cd03cb3 | |||
a150cbc533 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -14,4 +14,6 @@ cache-file
|
||||
logs
|
||||
|
||||
.env*
|
||||
!.env.example
|
||||
!.env.example
|
||||
|
||||
.turbo
|
28
package.json
28
package.json
@ -18,6 +18,7 @@
|
||||
"build": "rimraf dist && bun run bun.config.mjs",
|
||||
"test": "tsx test/**/*.ts",
|
||||
"clean": "rm -rf dist",
|
||||
"turbo:build": "turbo run build",
|
||||
"pub": "npm run build && envision pack -p -u",
|
||||
"cmd": "tsx cmd/index.ts "
|
||||
},
|
||||
@ -34,9 +35,11 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kevisual/code-center-module": "0.0.18",
|
||||
"@kevisual/router": "0.0.13",
|
||||
"@kevisual/use-config": "^1.0.12",
|
||||
"@kevisual/ai": "^0.0.8",
|
||||
"@kevisual/code-center-module": "0.0.23",
|
||||
"@kevisual/context": "^0.0.3",
|
||||
"@kevisual/router": "0.0.23",
|
||||
"@kevisual/use-config": "^1.0.19",
|
||||
"cookie": "^1.0.2",
|
||||
"dayjs": "^1.11.13",
|
||||
"formidable": "^3.5.4",
|
||||
@ -44,30 +47,31 @@
|
||||
"nanoid": "^5.1.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kevisual/ai-center": "^0.0.3",
|
||||
"@kevisual/app-assistant": "workspace:*",
|
||||
"@kevisual/logger": "^0.0.4",
|
||||
"@kevisual/social-prompts": "workspace:*",
|
||||
"@kevisual/types": "^0.0.9",
|
||||
"@kevisual/use-config": "^1.0.12",
|
||||
"@kevisual/types": "^0.0.10",
|
||||
"@kevisual/use-config": "^1.0.19",
|
||||
"@kevisual/xhs": "workspace:*",
|
||||
"@types/bun": "^1.2.11",
|
||||
"@types/bun": "^1.2.16",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/formidable": "^3.4.5",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^22.15.3",
|
||||
"bullmq": "^5.51.1",
|
||||
"commander": "^13.1.0",
|
||||
"@types/node": "^24.0.3",
|
||||
"bullmq": "^5.55.0",
|
||||
"commander": "^14.0.0",
|
||||
"concurrently": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"dotenv": "^16.5.0",
|
||||
"inquire": "^0.4.8",
|
||||
"ioredis": "^5.6.1",
|
||||
"nodemon": "^3.1.10",
|
||||
"pg": "^8.15.6",
|
||||
"openai": "^5.6.0",
|
||||
"pg": "^8.16.2",
|
||||
"rimraf": "^6.0.1",
|
||||
"sequelize": "^6.37.7",
|
||||
"tape": "^5.9.0",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"packageManager": "pnpm@10.10.0"
|
||||
"packageManager": "pnpm@10.12.1"
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
"types": "app.d.ts",
|
||||
"scripts": {
|
||||
"build": "bun run bun.config.mjs",
|
||||
"postbuild": "dts -i src/index.ts -o app.d.ts",
|
||||
"postbuild2": "dts -i src/index.ts -o app.d.ts",
|
||||
"cmd": "tsx src/test/command.ts ",
|
||||
"dts": "dts -i src/index.js -o app.d.ts"
|
||||
},
|
||||
|
0
packages/xhs/readme.md
Normal file
0
packages/xhs/readme.md
Normal file
@ -2,9 +2,10 @@ import { QueryRouterServer } from '@kevisual/router/browser';
|
||||
import { XhsServices } from '@kevisual/xhs/services/xhs-services.ts';
|
||||
|
||||
export const app = new QueryRouterServer();
|
||||
export const xhsServices = new XhsServices();
|
||||
export const xhsServices = new XhsServices();// Semicolon separated Cookie File
|
||||
|
||||
const cookie =
|
||||
'a1=1969a2df762vy6p46vet3jjpwfvnoce52hge24v0430000640615;abRequestId=48bccb63-a540-5533-8215-546916a6386f;gid=yjKj0JdyjKJ4yjKj0JfiWx4hKJhvKU4Khd9qk84VVUEihdq8IlSd2J888K48Ky28SSqJKYSK;loadts=1746343425888;sec_poison_id=32d8febc-7543-41e7-8a1f-c652d32a1e1a;unread={%22ub%22:%2267f73e21000000001b0384ea%22%2C%22ue%22:%226812f08300000000090166d7%22%2C%22uc%22:32};web_session=040069b6528dbc23c355705e223a4b27b6660a;webBuild=4.62.3;webId=05b45ad626037308d58668196c6af47d;websectiga=8886be45f388a1ee7bf611a69f3e174cae48f1ea02c0f8ec3256031b8be9c7ee;xsecappid=xhs-pc-web;acw_tc=0a00d14717463434250061733e8b2fcd3804e9b06020e1f339ebd8b7e80fc4;';
|
||||
'a1=1978d0cdcb7p5neac7cesgfm9yat0b4a7hnesexkp30000220066;abRequestId=f98f27d6-cceb-53d9-a9ef-dbd68786231b;access-token-creator.xiaohongshu.com=customer.creator.AT-68c517518075239703025713copo06lnusenqic1;customer-sso-sid=68c517518075239698553486mipyx4lwk2ac5jaj;customerClientId=716985104518687;galaxy_creator_session_id=wda55FJhoiAWZ8cekT2aGiM9fuztft3mOdRM;galaxy.creator.beaker.session.id=1750438297110093146037;gid=yjWYf8Si4SWjyjWYf8SfSxdCDWU2Id0SWSdMITUki6jv0dq898D40M888JJ88KK8fdKS8jiy;loadts=1750444792784;sec_poison_id=2f592adb-ec34-48cd-a6ce-22b90bd67c3b;unread={%22ub%22:%226852a4100000000022030063%22%2C%22ue%22:%226854e0db00000000100251f6%22%2C%22uc%22:28};web_session=040069b6528dbc23c355980a603a4b3e03bb6a;webBuild=4.68.0;webId=1dbb23b746393db622165a22357897d5;websectiga=10f9a40ba454a07755a08f27ef8194c53637eba4551cf9751c009d9afb564467;x-user-id-creator.xiaohongshu.com=6726cef4000000001c019303;xsecappid=xhs-pc-web;acw_tc=0a00d41117504447915317110e41effee63c597aa77f2c9f0dc1b0a10248f8;';
|
||||
|
||||
xhsServices.createRoot({
|
||||
cookie,
|
||||
|
@ -10,6 +10,9 @@ const parseComment = (comment: CommonentInfo) => {
|
||||
content: comment.content,
|
||||
};
|
||||
};
|
||||
/**
|
||||
* 格式化评论信息
|
||||
*/
|
||||
export class Parse {
|
||||
static getComment(mention: Mention) {
|
||||
const typeList = ['comment/item', 'mention/comment', 'comment/comment'];
|
||||
|
@ -75,17 +75,31 @@ app
|
||||
.define(async (ctx) => {
|
||||
const { note_id, comment_id, content } = ctx.query;
|
||||
const client = xhsServices.getClient();
|
||||
const res = await client.postComment({
|
||||
note_id: note_id,
|
||||
comment_id: comment_id,
|
||||
content,
|
||||
});
|
||||
if (res.code === 0) {
|
||||
ctx.body = res.data;
|
||||
// content 300个字内,超过cai fen
|
||||
const textArr: string[] = [];
|
||||
if (content.length > 300) {
|
||||
const num = Math.ceil(content.length / 300);
|
||||
for (let i = 0; i < num; i++) {
|
||||
textArr.push(content.slice(i * 300, (i + 1) * 300));
|
||||
}
|
||||
} else {
|
||||
console.log('添加评论失败', res.code);
|
||||
ctx.throw(res.code, '添加评论失败');
|
||||
textArr.push(content);
|
||||
}
|
||||
const resArr: any[] = [];
|
||||
for (const text of textArr) {
|
||||
const res = await client.postComment({
|
||||
note_id: note_id,
|
||||
comment_id: comment_id,
|
||||
content: text,
|
||||
});
|
||||
if (res.code === 0) {
|
||||
resArr.push(res.data);
|
||||
} else {
|
||||
console.log('添加评论失败', res.code);
|
||||
ctx.throw(res.code, '添加评论失败');
|
||||
}
|
||||
}
|
||||
ctx.body = resArr;
|
||||
})
|
||||
.addTo(app);
|
||||
app
|
||||
|
14
packages/xhs/src/routes/notes/create-note.ts
Normal file
14
packages/xhs/src/routes/notes/create-note.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { app, xhsServices } from '@kevisual/xhs/app.ts';
|
||||
|
||||
app
|
||||
.route({
|
||||
path: 'note',
|
||||
key: 'create',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const client = xhsServices.getClient();
|
||||
const res = await client.c
|
||||
if (res.code === 0) {
|
||||
}
|
||||
})
|
||||
.addTo(app);
|
1
packages/xhs/src/routes/notes/index.ts
Normal file
1
packages/xhs/src/routes/notes/index.ts
Normal file
@ -0,0 +1 @@
|
||||
import './create-note.ts'
|
386
pnpm-lock.yaml
generated
386
pnpm-lock.yaml
generated
@ -8,15 +8,21 @@ importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@kevisual/ai':
|
||||
specifier: ^0.0.8
|
||||
version: 0.0.8
|
||||
'@kevisual/code-center-module':
|
||||
specifier: 0.0.18
|
||||
version: 0.0.18(@kevisual/auth@1.0.5)(@kevisual/router@0.0.13)(@kevisual/use-config@1.0.14(dotenv@16.5.0))(ioredis@5.6.1)(pg@8.15.6)(sequelize@6.37.7(pg@8.15.6))
|
||||
specifier: 0.0.23
|
||||
version: 0.0.23(dotenv@16.5.0)
|
||||
'@kevisual/context':
|
||||
specifier: ^0.0.3
|
||||
version: 0.0.3
|
||||
'@kevisual/router':
|
||||
specifier: 0.0.13
|
||||
version: 0.0.13
|
||||
specifier: 0.0.23
|
||||
version: 0.0.23
|
||||
'@kevisual/use-config':
|
||||
specifier: ^1.0.12
|
||||
version: 1.0.14(dotenv@16.5.0)
|
||||
specifier: ^1.0.19
|
||||
version: 1.0.19(dotenv@16.5.0)
|
||||
cookie:
|
||||
specifier: ^1.0.2
|
||||
version: 1.0.2
|
||||
@ -33,24 +39,24 @@ importers:
|
||||
specifier: ^5.1.5
|
||||
version: 5.1.5
|
||||
devDependencies:
|
||||
'@kevisual/ai-center':
|
||||
specifier: ^0.0.3
|
||||
version: 0.0.3
|
||||
'@kevisual/app-assistant':
|
||||
specifier: workspace:*
|
||||
version: link:packages/app-assistant
|
||||
'@kevisual/logger':
|
||||
specifier: ^0.0.4
|
||||
version: 0.0.4
|
||||
'@kevisual/social-prompts':
|
||||
specifier: workspace:*
|
||||
version: link:packages/social-prompts
|
||||
'@kevisual/types':
|
||||
specifier: ^0.0.9
|
||||
version: 0.0.9
|
||||
specifier: ^0.0.10
|
||||
version: 0.0.10
|
||||
'@kevisual/xhs':
|
||||
specifier: workspace:*
|
||||
version: link:packages/xhs
|
||||
'@types/bun':
|
||||
specifier: ^1.2.11
|
||||
version: 1.2.11
|
||||
specifier: ^1.2.16
|
||||
version: 1.2.16
|
||||
'@types/crypto-js':
|
||||
specifier: ^4.2.2
|
||||
version: 4.2.2
|
||||
@ -61,14 +67,14 @@ importers:
|
||||
specifier: ^4.17.12
|
||||
version: 4.17.12
|
||||
'@types/node':
|
||||
specifier: ^22.15.3
|
||||
version: 22.15.3
|
||||
specifier: ^24.0.3
|
||||
version: 24.0.3
|
||||
bullmq:
|
||||
specifier: ^5.51.1
|
||||
version: 5.51.1
|
||||
specifier: ^5.55.0
|
||||
version: 5.55.0
|
||||
commander:
|
||||
specifier: ^13.1.0
|
||||
version: 13.1.0
|
||||
specifier: ^14.0.0
|
||||
version: 14.0.0
|
||||
concurrently:
|
||||
specifier: ^9.1.2
|
||||
version: 9.1.2
|
||||
@ -87,15 +93,18 @@ importers:
|
||||
nodemon:
|
||||
specifier: ^3.1.10
|
||||
version: 3.1.10
|
||||
openai:
|
||||
specifier: ^5.6.0
|
||||
version: 5.6.0(ws@8.18.1)(zod@3.25.67)
|
||||
pg:
|
||||
specifier: ^8.15.6
|
||||
version: 8.15.6
|
||||
specifier: ^8.16.2
|
||||
version: 8.16.2
|
||||
rimraf:
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.1
|
||||
sequelize:
|
||||
specifier: ^6.37.7
|
||||
version: 6.37.7(pg@8.15.6)(sqlite3@5.1.7)
|
||||
version: 6.37.7(pg@8.16.2)(sqlite3@5.1.7)
|
||||
tape:
|
||||
specifier: ^5.9.0
|
||||
version: 5.9.0
|
||||
@ -128,7 +137,7 @@ importers:
|
||||
version: 5.1.5
|
||||
sequelize:
|
||||
specifier: ^6.37.7
|
||||
version: 6.37.7(pg@8.15.6)(sqlite3@5.1.7)
|
||||
version: 6.37.7(pg@8.16.2)(sqlite3@5.1.7)
|
||||
sqlite3:
|
||||
specifier: ^5.1.7
|
||||
version: 5.1.7
|
||||
@ -212,21 +221,17 @@ packages:
|
||||
'@jridgewell/sourcemap-codec@1.5.0':
|
||||
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
|
||||
|
||||
'@kevisual/ai-center@0.0.3':
|
||||
resolution: {integrity: sha512-GYY8PyOxh8G9VYkm5rBCmOabrdIdN5b5kyx15OaX0fZEi1rG5bzDTL4BTqx5KhurG01HHbXiq32BbCv4ZaSMVA==}
|
||||
'@kevisual/ai@0.0.8':
|
||||
resolution: {integrity: sha512-MvK4U1iWf8hz7lj/+YBQV3qWRRDy42VH8fInKFVxjpEGPGaxfXOMP73C85T4Cf82OGU/fxOayiR0xLi2SyBTLw==}
|
||||
|
||||
'@kevisual/auth@1.0.5':
|
||||
resolution: {integrity: sha512-GwsLj7unKXi7lmMiIIgdig4LwwLiDJnOy15HHZR5gMbyK6s5/uJiMY5RXPB2+onGzTNDqFo/hXjsD2wkerHPVg==}
|
||||
|
||||
'@kevisual/code-center-module@0.0.18':
|
||||
resolution: {integrity: sha512-BfANmxLEO1AwVmqpa6VDgxk//YN8asf1r5jIPpyKDQm12kyyrYgHND9AgGCDRH8lvq6rYVe0svCZXD5b06UPWQ==}
|
||||
peerDependencies:
|
||||
'@kevisual/auth': ^1.0.5
|
||||
'@kevisual/router': ^0.0.7
|
||||
'@kevisual/use-config': ^1.0.8
|
||||
ioredis: ^5.5.0
|
||||
pg: ^8.13.3
|
||||
sequelize: ^6.37.5
|
||||
'@kevisual/code-center-module@0.0.23':
|
||||
resolution: {integrity: sha512-qusUc+BdheJAKFSCOfRJATxKOgE7uqhwMtB8fEI+N9NdbGAX7mshn3Pcq082RFFYrWLMNICsWq/6WczEFamgYw==}
|
||||
|
||||
'@kevisual/context@0.0.3':
|
||||
resolution: {integrity: sha512-cYpqVmoHVjv3NrGMU1e6iyiPDKRtNnK2wOWgbBU5d+8IHuC8VYHTg2GY5bnD/272GK7EYdr9x/c3QgsCIqR2BQ==}
|
||||
|
||||
'@kevisual/db@0.0.1':
|
||||
resolution: {integrity: sha512-FgDS5FzcU5Um2UV6EYQN4+D4R24M6/A7DANMPpvTpRioS94apKsnthZQWNL65e6gPc4ca3ys8zygrF6rd3ZA7Q==}
|
||||
@ -238,17 +243,28 @@ packages:
|
||||
'@kevisual/load@0.0.6':
|
||||
resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==}
|
||||
|
||||
'@kevisual/router@0.0.13':
|
||||
resolution: {integrity: sha512-raji8aKXr0jigmJVOKBXb5gpstiAuyoIDy9m6SyPf4lRjCU3pspVI1bpscOUCBlaPICo6TLzPQxXhyTvvvtdWw==}
|
||||
'@kevisual/logger@0.0.4':
|
||||
resolution: {integrity: sha512-+fpr92eokSxoGOW1SIRl/27lPuO+zyY+feR5o2Q4YCNlAdt2x64NwC/w8r/3NEC5QenLgd4K0azyKTI2mHbARw==}
|
||||
|
||||
'@kevisual/types@0.0.9':
|
||||
resolution: {integrity: sha512-SDJ7GMbOx7Ghz2kreHqym56ccAJS3t93y+NS0+afTLxcq2+cKcoEy2F8WXEv0mnJ6EsDp5AbA7Jv5TZA1Jbc3A==}
|
||||
'@kevisual/router@0.0.22':
|
||||
resolution: {integrity: sha512-Cqv2vV+hPBHrMMfvWlfDIuNrQcmd260oQZ4S5QR/R4tV35XtMKiseqhnC9uR09oVBJUh+d5rW3YucDDddheeDQ==}
|
||||
|
||||
'@kevisual/router@0.0.23':
|
||||
resolution: {integrity: sha512-W6ehlhAzNe58vq4QeQt2XFoO84Qaw34A0PVOByJsJ2ICj4YKBTclAt+rOAoISCvUeSbeNOIuhUE3sLyPfplzUw==}
|
||||
|
||||
'@kevisual/types@0.0.10':
|
||||
resolution: {integrity: sha512-Q73uzzjk9UidumnmCvOpgzqDDvQxsblz22bIFuoiioUFJWwaparx8bpd8ArRyFojicYL1YJoFDzDZ9j9NN8grA==}
|
||||
|
||||
'@kevisual/use-config@1.0.14':
|
||||
resolution: {integrity: sha512-U4fmPFJre+Ph+hdg+EKVaRGxdpD4T4ZoOz5QLEyC6o3ekg8NC4n1i7Myo1ektqATyoG9Y0q/bJdOhiJwnLEt4g==}
|
||||
peerDependencies:
|
||||
dotenv: ^16.4.7
|
||||
|
||||
'@kevisual/use-config@1.0.19':
|
||||
resolution: {integrity: sha512-Q1IH4eMqUe5w6Bq8etoqOSls9FPIy0xwwD3wHf26EsQLZadhccI9qkDuFzP/rFWDa57mwFPEfwbGE5UlqWOCkw==}
|
||||
peerDependencies:
|
||||
dotenv: ^16.4.7
|
||||
|
||||
'@ljharb/resumer@0.1.3':
|
||||
resolution: {integrity: sha512-d+tsDgfkj9X5QTriqM4lKesCkMMJC3IrbPKHvayP00ELx2axdXvDfWkqjxrLXIzGcQzmj7VAUT1wopqARTvafw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@ -409,8 +425,8 @@ packages:
|
||||
resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
'@types/bun@1.2.11':
|
||||
resolution: {integrity: sha512-ZLbbI91EmmGwlWTRWuV6J19IUiUC5YQ3TCEuSHI3usIP75kuoA8/0PVF+LTrbEnVc8JIhpElWOxv1ocI1fJBbw==}
|
||||
'@types/bun@1.2.16':
|
||||
resolution: {integrity: sha512-1aCZJ/6nSiViw339RsaNhkNoEloLaPzZhxMOYEa7OzRzO41IGg5n/7I43/ZIAW/c+Q6cT12Vf7fOZOoVIzb5BQ==}
|
||||
|
||||
'@types/cors@2.8.17':
|
||||
resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==}
|
||||
@ -442,6 +458,9 @@ packages:
|
||||
'@types/node@22.15.3':
|
||||
resolution: {integrity: sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==}
|
||||
|
||||
'@types/node@24.0.3':
|
||||
resolution: {integrity: sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg==}
|
||||
|
||||
'@types/validator@13.12.2':
|
||||
resolution: {integrity: sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==}
|
||||
|
||||
@ -561,8 +580,11 @@ packages:
|
||||
bullmq@5.51.1:
|
||||
resolution: {integrity: sha512-JEZokH5Sb6p66HRjbfQjPNYuSilDRcB8UREmJzOBqTTaJFza8I92vsBF3J/zmtzd7KVv3dxhZyH9CYSLOJALRA==}
|
||||
|
||||
bun-types@1.2.11:
|
||||
resolution: {integrity: sha512-dbkp5Lo8HDrXkLrONm6bk+yiiYQSntvFUzQp0v3pzTAsXk6FtgVMjdQ+lzFNVAmQFUkPQZ3WMZqH5tTo+Dp/IA==}
|
||||
bullmq@5.55.0:
|
||||
resolution: {integrity: sha512-LKaQZroyXBYSQd/SNP9EcmCZgiZjIImtQHBlnupUvhX1GmmJfIXjn0bf8lek3bvajMUbvVf8FrYdFD0ajAuy0g==}
|
||||
|
||||
bun-types@1.2.16:
|
||||
resolution: {integrity: sha512-ciXLrHV4PXax9vHvUrkvun9VPVGOVwbbbBF/Ev1cXz12lyEZMoJpIJABOfPcN9gDJRaiKF9MVbSygLg4NXu3/A==}
|
||||
|
||||
cacache@15.3.0:
|
||||
resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==}
|
||||
@ -622,9 +644,9 @@ packages:
|
||||
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
commander@13.1.0:
|
||||
resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==}
|
||||
engines: {node: '>=18'}
|
||||
commander@14.0.0:
|
||||
resolution: {integrity: sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA==}
|
||||
engines: {node: '>=20'}
|
||||
|
||||
concat-map@0.0.1:
|
||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||
@ -743,6 +765,10 @@ packages:
|
||||
resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
depd@2.0.0:
|
||||
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
detect-libc@2.0.4:
|
||||
resolution: {integrity: sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==}
|
||||
engines: {node: '>=8'}
|
||||
@ -768,12 +794,19 @@ packages:
|
||||
eastasianwidth@0.2.0:
|
||||
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
|
||||
|
||||
ee-first@1.1.1:
|
||||
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
|
||||
|
||||
emoji-regex@8.0.0:
|
||||
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
|
||||
|
||||
emoji-regex@9.2.2:
|
||||
resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==}
|
||||
|
||||
encodeurl@2.0.0:
|
||||
resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
encoding@0.1.13:
|
||||
resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==}
|
||||
|
||||
@ -830,6 +863,13 @@ packages:
|
||||
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
escape-html@1.0.3:
|
||||
resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==}
|
||||
|
||||
etag@1.8.1:
|
||||
resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
eventemitter3@5.0.1:
|
||||
resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==}
|
||||
|
||||
@ -869,6 +909,10 @@ packages:
|
||||
resolution: {integrity: sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
|
||||
fresh@2.0.0:
|
||||
resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
fs-constants@1.0.0:
|
||||
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
|
||||
|
||||
@ -991,6 +1035,10 @@ packages:
|
||||
http-cache-semantics@4.1.1:
|
||||
resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==}
|
||||
|
||||
http-errors@2.0.0:
|
||||
resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
http-proxy-agent@4.0.1:
|
||||
resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==}
|
||||
engines: {node: '>= 6'}
|
||||
@ -1242,10 +1290,18 @@ packages:
|
||||
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mime-db@1.54.0:
|
||||
resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mime-types@2.1.35:
|
||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mime-types@3.0.1:
|
||||
resolution: {integrity: sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
mimic-response@3.1.0:
|
||||
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
|
||||
engines: {node: '>=10'}
|
||||
@ -1401,9 +1457,25 @@ packages:
|
||||
resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
on-finished@2.4.1:
|
||||
resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
once@1.4.0:
|
||||
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
||||
|
||||
openai@5.6.0:
|
||||
resolution: {integrity: sha512-jNH5z+hYAdOMZXyEt0yZ7246s+UZjg2AwFQqkAhZIPPjxNtHHO5mykOefau6FkOqj16aC94MOdJl/rZBcKj/cQ==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
ws: ^8.18.0
|
||||
zod: ^3.23.8
|
||||
peerDependenciesMeta:
|
||||
ws:
|
||||
optional: true
|
||||
zod:
|
||||
optional: true
|
||||
|
||||
own-keys@1.0.1:
|
||||
resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@ -1437,31 +1509,34 @@ packages:
|
||||
resolution: {integrity: sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
pg-cloudflare@1.2.5:
|
||||
resolution: {integrity: sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg==}
|
||||
pg-cloudflare@1.2.6:
|
||||
resolution: {integrity: sha512-uxmJAnmIgmYgnSFzgOf2cqGQBzwnRYcrEgXuFjJNEkpedEIPBSEzxY7ph4uA9k1mI+l/GR0HjPNS6FKNZe8SBQ==}
|
||||
|
||||
pg-connection-string@2.8.5:
|
||||
resolution: {integrity: sha512-Ni8FuZ8yAF+sWZzojvtLE2b03cqjO5jNULcHFfM9ZZ0/JXrgom5pBREbtnAw7oxsxJqHw9Nz/XWORUEL3/IFow==}
|
||||
|
||||
pg-connection-string@2.9.1:
|
||||
resolution: {integrity: sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==}
|
||||
|
||||
pg-int8@1.0.1:
|
||||
resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
|
||||
engines: {node: '>=4.0.0'}
|
||||
|
||||
pg-pool@3.9.6:
|
||||
resolution: {integrity: sha512-rFen0G7adh1YmgvrmE5IPIqbb+IgEzENUm+tzm6MLLDSlPRoZVhzU1WdML9PV2W5GOdRA9qBKURlbt1OsXOsPw==}
|
||||
pg-pool@3.10.1:
|
||||
resolution: {integrity: sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg==}
|
||||
peerDependencies:
|
||||
pg: '>=8.0'
|
||||
|
||||
pg-protocol@1.9.5:
|
||||
resolution: {integrity: sha512-DYTWtWpfd5FOro3UnAfwvhD8jh59r2ig8bPtc9H8Ds7MscE/9NYruUQWFAOuraRl29jwcT2kyMFQ3MxeaVjUhg==}
|
||||
pg-protocol@1.10.2:
|
||||
resolution: {integrity: sha512-Ci7jy8PbaWxfsck2dwZdERcDG2A0MG8JoQILs+uZNjABFuBuItAZCWUNz8sXRDMoui24rJw7WlXqgpMdBSN/vQ==}
|
||||
|
||||
pg-types@2.2.0:
|
||||
resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
pg@8.15.6:
|
||||
resolution: {integrity: sha512-yvao7YI3GdmmrslNVsZgx9PfntfWrnXwtR+K/DjI0I/sTKif4Z623um+sjVZ1hk5670B+ODjvHDAckKdjmPTsg==}
|
||||
engines: {node: '>= 8.0.0'}
|
||||
pg@8.16.2:
|
||||
resolution: {integrity: sha512-OtLWF0mKLmpxelOt9BqVq83QV6bTfsS0XLegIeAKqKjurRnRKie1Dc1iL89MugmSLhftxw6NNCyZhm1yQFLMEQ==}
|
||||
engines: {node: '>= 16.0.0'}
|
||||
peerDependencies:
|
||||
pg-native: '>=3.0.1'
|
||||
peerDependenciesMeta:
|
||||
@ -1528,6 +1603,10 @@ packages:
|
||||
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
range-parser@1.2.1:
|
||||
resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
rc@1.2.8:
|
||||
resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
|
||||
hasBin: true
|
||||
@ -1630,6 +1709,10 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
send@1.2.0:
|
||||
resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==}
|
||||
engines: {node: '>= 18'}
|
||||
|
||||
sequelize-pool@7.1.0:
|
||||
resolution: {integrity: sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
@ -1682,6 +1765,9 @@ packages:
|
||||
resolution: {integrity: sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
setprototypeof@1.2.0:
|
||||
resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
|
||||
|
||||
shebang-command@2.0.0:
|
||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||
engines: {node: '>=8'}
|
||||
@ -1767,6 +1853,14 @@ packages:
|
||||
standard-as-callback@2.1.0:
|
||||
resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==}
|
||||
|
||||
statuses@2.0.1:
|
||||
resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
statuses@2.0.2:
|
||||
resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
stop-iteration-iterator@1.1.0:
|
||||
resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@ -1851,6 +1945,10 @@ packages:
|
||||
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
|
||||
engines: {node: '>=8.0'}
|
||||
|
||||
toidentifier@1.0.1:
|
||||
resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
|
||||
engines: {node: '>=0.6'}
|
||||
|
||||
toposort-class@1.0.1:
|
||||
resolution: {integrity: sha512-OsLcGGbYF3rMjPUf8oKktyvCiUxSbqMMS39m33MAjLTC1DVIH6x3WSt63/M77ihI09+Sdfk1AXvfhCEeUmC7mg==}
|
||||
|
||||
@ -1907,6 +2005,9 @@ packages:
|
||||
undici-types@6.21.0:
|
||||
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||
|
||||
undici-types@7.8.0:
|
||||
resolution: {integrity: sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==}
|
||||
|
||||
unique-filename@1.1.1:
|
||||
resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==}
|
||||
|
||||
@ -2040,8 +2141,8 @@ packages:
|
||||
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
zod@3.24.2:
|
||||
resolution: {integrity: sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==}
|
||||
zod@3.25.67:
|
||||
resolution: {integrity: sha512-idA2YXwpCdqUSKRCACDE6ItZD9TZzy3OZMtpfLoh6oPR47lipysRrJfjzMqFxQ3uJuUPyUeWe1r9vLH33xO/Qw==}
|
||||
|
||||
snapshots:
|
||||
|
||||
@ -2099,26 +2200,41 @@ snapshots:
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.0': {}
|
||||
|
||||
'@kevisual/ai-center@0.0.3': {}
|
||||
'@kevisual/ai@0.0.8':
|
||||
dependencies:
|
||||
'@kevisual/logger': 0.0.4
|
||||
|
||||
'@kevisual/auth@1.0.5': {}
|
||||
|
||||
'@kevisual/code-center-module@0.0.18(@kevisual/auth@1.0.5)(@kevisual/router@0.0.13)(@kevisual/use-config@1.0.14(dotenv@16.5.0))(ioredis@5.6.1)(pg@8.15.6)(sequelize@6.37.7(pg@8.15.6))':
|
||||
'@kevisual/code-center-module@0.0.23(dotenv@16.5.0)':
|
||||
dependencies:
|
||||
'@kevisual/auth': 1.0.5
|
||||
'@kevisual/router': 0.0.13
|
||||
'@kevisual/use-config': 1.0.14(dotenv@16.5.0)
|
||||
'@kevisual/context': 0.0.3
|
||||
'@kevisual/router': 0.0.22
|
||||
'@kevisual/use-config': 1.0.19(dotenv@16.5.0)
|
||||
ioredis: 5.6.1
|
||||
nanoid: 5.1.5
|
||||
pg: 8.15.6
|
||||
sequelize: 6.37.7(pg@8.15.6)(sqlite3@5.1.7)
|
||||
pg: 8.16.2
|
||||
sequelize: 6.37.7(pg@8.16.2)(sqlite3@5.1.7)
|
||||
socket.io: 4.8.1
|
||||
zod: 3.24.2
|
||||
zod: 3.25.67
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- dotenv
|
||||
- ibm_db
|
||||
- mariadb
|
||||
- mysql2
|
||||
- oracledb
|
||||
- pg-hstore
|
||||
- pg-native
|
||||
- snowflake-sdk
|
||||
- sqlite3
|
||||
- supports-color
|
||||
- tedious
|
||||
- utf-8-validate
|
||||
|
||||
'@kevisual/context@0.0.3': {}
|
||||
|
||||
'@kevisual/db@0.0.1': {}
|
||||
|
||||
'@kevisual/dts@0.0.2(typescript@5.8.3)':
|
||||
@ -2132,18 +2248,33 @@ snapshots:
|
||||
dependencies:
|
||||
eventemitter3: 5.0.1
|
||||
|
||||
'@kevisual/router@0.0.13':
|
||||
'@kevisual/logger@0.0.4': {}
|
||||
|
||||
'@kevisual/router@0.0.22':
|
||||
dependencies:
|
||||
path-to-regexp: 8.2.0
|
||||
selfsigned: 2.4.1
|
||||
|
||||
'@kevisual/types@0.0.9': {}
|
||||
'@kevisual/router@0.0.23':
|
||||
dependencies:
|
||||
path-to-regexp: 8.2.0
|
||||
selfsigned: 2.4.1
|
||||
send: 1.2.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@kevisual/types@0.0.10': {}
|
||||
|
||||
'@kevisual/use-config@1.0.14(dotenv@16.5.0)':
|
||||
dependencies:
|
||||
'@kevisual/load': 0.0.6
|
||||
dotenv: 16.5.0
|
||||
|
||||
'@kevisual/use-config@1.0.19(dotenv@16.5.0)':
|
||||
dependencies:
|
||||
'@kevisual/load': 0.0.6
|
||||
dotenv: 16.5.0
|
||||
|
||||
'@ljharb/resumer@0.1.3':
|
||||
dependencies:
|
||||
'@ljharb/through': 2.3.14
|
||||
@ -2254,13 +2385,13 @@ snapshots:
|
||||
'@tootallnate/once@1.1.2':
|
||||
optional: true
|
||||
|
||||
'@types/bun@1.2.11':
|
||||
'@types/bun@1.2.16':
|
||||
dependencies:
|
||||
bun-types: 1.2.11
|
||||
bun-types: 1.2.16
|
||||
|
||||
'@types/cors@2.8.17':
|
||||
dependencies:
|
||||
'@types/node': 22.15.3
|
||||
'@types/node': 24.0.3
|
||||
|
||||
'@types/crypto-js@4.2.2': {}
|
||||
|
||||
@ -2272,7 +2403,7 @@ snapshots:
|
||||
|
||||
'@types/formidable@3.4.5':
|
||||
dependencies:
|
||||
'@types/node': 22.15.3
|
||||
'@types/node': 24.0.3
|
||||
|
||||
'@types/lodash-es@4.17.12':
|
||||
dependencies:
|
||||
@ -2284,12 +2415,16 @@ snapshots:
|
||||
|
||||
'@types/node-forge@1.3.11':
|
||||
dependencies:
|
||||
'@types/node': 22.15.3
|
||||
'@types/node': 24.0.3
|
||||
|
||||
'@types/node@22.15.3':
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
'@types/node@24.0.3':
|
||||
dependencies:
|
||||
undici-types: 7.8.0
|
||||
|
||||
'@types/validator@13.12.2': {}
|
||||
|
||||
abbrev@1.1.1:
|
||||
@ -2433,9 +2568,21 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
bun-types@1.2.11:
|
||||
bullmq@5.55.0:
|
||||
dependencies:
|
||||
'@types/node': 22.15.3
|
||||
cron-parser: 4.9.0
|
||||
ioredis: 5.6.1
|
||||
msgpackr: 1.11.2
|
||||
node-abort-controller: 3.1.1
|
||||
semver: 7.7.1
|
||||
tslib: 2.8.1
|
||||
uuid: 9.0.1
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
bun-types@1.2.16:
|
||||
dependencies:
|
||||
'@types/node': 24.0.3
|
||||
|
||||
cacache@15.3.0:
|
||||
dependencies:
|
||||
@ -2523,7 +2670,7 @@ snapshots:
|
||||
dependencies:
|
||||
delayed-stream: 1.0.0
|
||||
|
||||
commander@13.1.0: {}
|
||||
commander@14.0.0: {}
|
||||
|
||||
concat-map@0.0.1: {}
|
||||
|
||||
@ -2655,6 +2802,8 @@ snapshots:
|
||||
|
||||
denque@2.1.0: {}
|
||||
|
||||
depd@2.0.0: {}
|
||||
|
||||
detect-libc@2.0.4: {}
|
||||
|
||||
dezalgo@1.0.4:
|
||||
@ -2678,10 +2827,14 @@ snapshots:
|
||||
|
||||
eastasianwidth@0.2.0: {}
|
||||
|
||||
ee-first@1.1.1: {}
|
||||
|
||||
emoji-regex@8.0.0: {}
|
||||
|
||||
emoji-regex@9.2.2: {}
|
||||
|
||||
encodeurl@2.0.0: {}
|
||||
|
||||
encoding@0.1.13:
|
||||
dependencies:
|
||||
iconv-lite: 0.6.3
|
||||
@ -2696,7 +2849,7 @@ snapshots:
|
||||
engine.io@6.6.4:
|
||||
dependencies:
|
||||
'@types/cors': 2.8.17
|
||||
'@types/node': 22.15.3
|
||||
'@types/node': 24.0.3
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
cookie: 0.7.2
|
||||
@ -2806,6 +2959,10 @@ snapshots:
|
||||
|
||||
escalade@3.2.0: {}
|
||||
|
||||
escape-html@1.0.3: {}
|
||||
|
||||
etag@1.8.1: {}
|
||||
|
||||
eventemitter3@5.0.1: {}
|
||||
|
||||
expand-template@2.0.3: {}
|
||||
@ -2840,6 +2997,8 @@ snapshots:
|
||||
dezalgo: 1.0.4
|
||||
once: 1.4.0
|
||||
|
||||
fresh@2.0.0: {}
|
||||
|
||||
fs-constants@1.0.0: {}
|
||||
|
||||
fs-minipass@2.1.0:
|
||||
@ -2978,6 +3137,14 @@ snapshots:
|
||||
http-cache-semantics@4.1.1:
|
||||
optional: true
|
||||
|
||||
http-errors@2.0.0:
|
||||
dependencies:
|
||||
depd: 2.0.0
|
||||
inherits: 2.0.4
|
||||
setprototypeof: 1.2.0
|
||||
statuses: 2.0.1
|
||||
toidentifier: 1.0.1
|
||||
|
||||
http-proxy-agent@4.0.1:
|
||||
dependencies:
|
||||
'@tootallnate/once': 1.1.2
|
||||
@ -3282,10 +3449,16 @@ snapshots:
|
||||
|
||||
mime-db@1.52.0: {}
|
||||
|
||||
mime-db@1.54.0: {}
|
||||
|
||||
mime-types@2.1.35:
|
||||
dependencies:
|
||||
mime-db: 1.52.0
|
||||
|
||||
mime-types@3.0.1:
|
||||
dependencies:
|
||||
mime-db: 1.54.0
|
||||
|
||||
mimic-response@3.1.0: {}
|
||||
|
||||
minimatch@10.0.1:
|
||||
@ -3466,10 +3639,19 @@ snapshots:
|
||||
has-symbols: 1.1.0
|
||||
object-keys: 1.1.1
|
||||
|
||||
on-finished@2.4.1:
|
||||
dependencies:
|
||||
ee-first: 1.1.1
|
||||
|
||||
once@1.4.0:
|
||||
dependencies:
|
||||
wrappy: 1.0.2
|
||||
|
||||
openai@5.6.0(ws@8.18.1)(zod@3.25.67):
|
||||
optionalDependencies:
|
||||
ws: 8.18.1
|
||||
zod: 3.25.67
|
||||
|
||||
own-keys@1.0.1:
|
||||
dependencies:
|
||||
get-intrinsic: 1.2.7
|
||||
@ -3500,18 +3682,20 @@ snapshots:
|
||||
|
||||
path-to-regexp@8.2.0: {}
|
||||
|
||||
pg-cloudflare@1.2.5:
|
||||
pg-cloudflare@1.2.6:
|
||||
optional: true
|
||||
|
||||
pg-connection-string@2.8.5: {}
|
||||
|
||||
pg-connection-string@2.9.1: {}
|
||||
|
||||
pg-int8@1.0.1: {}
|
||||
|
||||
pg-pool@3.9.6(pg@8.15.6):
|
||||
pg-pool@3.10.1(pg@8.16.2):
|
||||
dependencies:
|
||||
pg: 8.15.6
|
||||
pg: 8.16.2
|
||||
|
||||
pg-protocol@1.9.5: {}
|
||||
pg-protocol@1.10.2: {}
|
||||
|
||||
pg-types@2.2.0:
|
||||
dependencies:
|
||||
@ -3521,15 +3705,15 @@ snapshots:
|
||||
postgres-date: 1.0.7
|
||||
postgres-interval: 1.2.0
|
||||
|
||||
pg@8.15.6:
|
||||
pg@8.16.2:
|
||||
dependencies:
|
||||
pg-connection-string: 2.8.5
|
||||
pg-pool: 3.9.6(pg@8.15.6)
|
||||
pg-protocol: 1.9.5
|
||||
pg-connection-string: 2.9.1
|
||||
pg-pool: 3.10.1(pg@8.16.2)
|
||||
pg-protocol: 1.10.2
|
||||
pg-types: 2.2.0
|
||||
pgpass: 1.0.5
|
||||
optionalDependencies:
|
||||
pg-cloudflare: 1.2.5
|
||||
pg-cloudflare: 1.2.6
|
||||
|
||||
pgpass@1.0.5:
|
||||
dependencies:
|
||||
@ -3587,6 +3771,8 @@ snapshots:
|
||||
|
||||
punycode@2.3.1: {}
|
||||
|
||||
range-parser@1.2.1: {}
|
||||
|
||||
rc@1.2.8:
|
||||
dependencies:
|
||||
deep-extend: 0.6.0
|
||||
@ -3727,9 +3913,25 @@ snapshots:
|
||||
|
||||
semver@7.7.1: {}
|
||||
|
||||
send@1.2.0:
|
||||
dependencies:
|
||||
debug: 4.4.0(supports-color@5.5.0)
|
||||
encodeurl: 2.0.0
|
||||
escape-html: 1.0.3
|
||||
etag: 1.8.1
|
||||
fresh: 2.0.0
|
||||
http-errors: 2.0.0
|
||||
mime-types: 3.0.1
|
||||
ms: 2.1.3
|
||||
on-finished: 2.4.1
|
||||
range-parser: 1.2.1
|
||||
statuses: 2.0.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
sequelize-pool@7.1.0: {}
|
||||
|
||||
sequelize@6.37.7(pg@8.15.6)(sqlite3@5.1.7):
|
||||
sequelize@6.37.7(pg@8.16.2)(sqlite3@5.1.7):
|
||||
dependencies:
|
||||
'@types/debug': 4.1.12
|
||||
'@types/validator': 13.12.2
|
||||
@ -3748,7 +3950,7 @@ snapshots:
|
||||
validator: 13.12.0
|
||||
wkx: 0.5.0
|
||||
optionalDependencies:
|
||||
pg: 8.15.6
|
||||
pg: 8.16.2
|
||||
sqlite3: 5.1.7
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@ -3778,6 +3980,8 @@ snapshots:
|
||||
es-errors: 1.3.0
|
||||
es-object-atoms: 1.1.1
|
||||
|
||||
setprototypeof@1.2.0: {}
|
||||
|
||||
shebang-command@2.0.0:
|
||||
dependencies:
|
||||
shebang-regex: 3.0.0
|
||||
@ -3903,6 +4107,10 @@ snapshots:
|
||||
|
||||
standard-as-callback@2.1.0: {}
|
||||
|
||||
statuses@2.0.1: {}
|
||||
|
||||
statuses@2.0.2: {}
|
||||
|
||||
stop-iteration-iterator@1.1.0:
|
||||
dependencies:
|
||||
es-errors: 1.3.0
|
||||
@ -4032,6 +4240,8 @@ snapshots:
|
||||
dependencies:
|
||||
is-number: 7.0.0
|
||||
|
||||
toidentifier@1.0.1: {}
|
||||
|
||||
toposort-class@1.0.1: {}
|
||||
|
||||
touch@3.1.1: {}
|
||||
@ -4098,6 +4308,8 @@ snapshots:
|
||||
|
||||
undici-types@6.21.0: {}
|
||||
|
||||
undici-types@7.8.0: {}
|
||||
|
||||
unique-filename@1.1.1:
|
||||
dependencies:
|
||||
unique-slug: 2.0.2
|
||||
@ -4186,7 +4398,7 @@ snapshots:
|
||||
|
||||
wkx@0.5.0:
|
||||
dependencies:
|
||||
'@types/node': 22.15.3
|
||||
'@types/node': 24.0.3
|
||||
|
||||
wrap-ansi@7.0.0:
|
||||
dependencies:
|
||||
@ -4228,4 +4440,4 @@ snapshots:
|
||||
y18n: 5.0.8
|
||||
yargs-parser: 21.1.1
|
||||
|
||||
zod@3.24.2: {}
|
||||
zod@3.25.67: {}
|
||||
|
3
src/agent/agent.ts
Normal file
3
src/agent/agent.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { QueryRouterServer } from '@kevisual/router';
|
||||
|
||||
export const agent = new QueryRouterServer();
|
16
src/agent/ai.ts
Normal file
16
src/agent/ai.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { SiliconFlowProvider } from '@kevisual/ai';
|
||||
import { config } from '../modules/config.ts';
|
||||
|
||||
export const ai = new SiliconFlowProvider({
|
||||
model: 'Qwen/Qwen3-32B',
|
||||
// model: 'Pro/deepseek-ai/DeepSeek-R1',// 只有充值能用
|
||||
apiKey: config.SILICONFLOW_API_KEY,
|
||||
});
|
||||
|
||||
ai.getUsageInfo()
|
||||
.then((usage) => {
|
||||
console.log('AI usage info:', usage);
|
||||
})
|
||||
.catch((res) => {
|
||||
console.error('Error fetching AI usage info:', res.status);
|
||||
});
|
95
src/agent/analyze/content.ts
Normal file
95
src/agent/analyze/content.ts
Normal file
@ -0,0 +1,95 @@
|
||||
import { agent } from '@/agent/agent.ts';
|
||||
import { ai } from '../ai.ts';
|
||||
import { logger } from '@/agent/logger.ts';
|
||||
const getJsonFromString = (str: string) => {
|
||||
// 尝试从字符串中提取JSON对象
|
||||
try {
|
||||
const jsonMatch = str.match(/```json\s*([\s\S]*?)\s*```/);
|
||||
if (jsonMatch && jsonMatch[1]) {
|
||||
return JSON.parse(jsonMatch[1]);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error parsing JSON from string:', error);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
agent
|
||||
.route({
|
||||
path: 'analyze',
|
||||
key: 'content',
|
||||
description: '分析文本内容,意图分析,判断是否需要获取上下文包函小红书的图片,视频,文本。',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const text = ctx.query?.text || '';
|
||||
|
||||
let result = {
|
||||
image: false,
|
||||
video: false,
|
||||
text: false,
|
||||
comment: false,
|
||||
};
|
||||
|
||||
const prompt = `
|
||||
请分析<context>包函的内容,判断是否需要包含小红书的图片、视频或文本信息,返回一个JSON对象,包含三个布尔值:image(是否包含图片)、video(是否包含视频)、text(是否包含小红书文本),comment(是否是评论信息)。
|
||||
如果文本中提到图片或视频,请返回true,否则返回false。
|
||||
|
||||
文本示例:
|
||||
1. "解答一下这个笔记。" , text为true
|
||||
2. "分析一下这个图片。", image为true
|
||||
3. "这个视频介绍的是什么。", video为true
|
||||
4. "评价一下这个评论。", comment为true
|
||||
|
||||
返回内容示例:
|
||||
\`\`\`json
|
||||
{
|
||||
"image": true,
|
||||
"video": false,
|
||||
"text": true,
|
||||
"comment": false
|
||||
}
|
||||
\`\`\`
|
||||
分析的文本的内容是:
|
||||
<context>
|
||||
${text}
|
||||
</context>
|
||||
`;
|
||||
const now = Date.now();
|
||||
console.log('start');
|
||||
const res = await ai
|
||||
.chat(
|
||||
[
|
||||
{
|
||||
role: 'user',
|
||||
content: prompt,
|
||||
},
|
||||
],
|
||||
{
|
||||
// @ts-ignore
|
||||
enable_thinking: false,
|
||||
},
|
||||
)
|
||||
.catch((err) => {
|
||||
console.log('AI service error:', err.status);
|
||||
ctx.throw(500, 'AI service error: ' + err.status);
|
||||
return err;
|
||||
});
|
||||
|
||||
console.log('end', Date.now() - now, 'ms');
|
||||
const ans = res.choices[0]?.message?.content || '';
|
||||
if (!ans) {
|
||||
logger.error('Empty response from AI:', res);
|
||||
}
|
||||
const json = getJsonFromString(ans);
|
||||
if (!json) {
|
||||
logger.error('Invalid JSON format in response:', ans);
|
||||
ctx.throw(400, 'Invalid JSON format in response');
|
||||
}
|
||||
result = {
|
||||
image: json.image || false,
|
||||
video: json.video || false,
|
||||
text: json.text || false,
|
||||
comment: json.comment || false,
|
||||
};
|
||||
ctx.body = result;
|
||||
})
|
||||
.addTo(agent);
|
64
src/agent/fix/prompt.ts
Normal file
64
src/agent/fix/prompt.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import { agent } from '@/agent/agent.ts';
|
||||
import { ai } from '../ai.ts';
|
||||
import { logger } from '@/agent/logger.ts';
|
||||
|
||||
const getTagContent = (text: string) => {
|
||||
const match = text.match(/<content>([\s\S]*?)<\/content>/);
|
||||
return match ? match[1].trim() : text;
|
||||
};
|
||||
agent
|
||||
.route({
|
||||
path: 'fix',
|
||||
key: 'xhs',
|
||||
description: '对小红书的提示词进行修正和优化',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const text = ctx.query?.text || '';
|
||||
const now = Date.now();
|
||||
console.log('start');
|
||||
const res = await ai
|
||||
.chat(
|
||||
[
|
||||
{
|
||||
role: 'user',
|
||||
content: `
|
||||
你是一个提示词优化的专家,请根据用户提供的提示词进行修正和优化,其中用户的提示词返回的要求如果没有或者不明确,请你都修正为要求返回的文本在500字以内,且内容是纯文本格式,不能是markdown模式,也不包含任何HTML标签或其他格式化内容。
|
||||
|
||||
只对提示词进行优化,并且不需要对内容进行分析或总结。
|
||||
|
||||
示例1. 用户提示词
|
||||
<content>总结笔记</content>
|
||||
优化后的提示词
|
||||
<content>请总结一下这个笔记,要求返回的内容是纯文本格式,字数不超过500字。</content>
|
||||
示例2. 用户提示词
|
||||
<content>分析一下这个图片</content>
|
||||
优化后的提示词
|
||||
<content>请分析一下这个图片,要求返回的内容是纯文本格式,字数不超过500字。</content>
|
||||
|
||||
|
||||
用户的提示词是
|
||||
<content>
|
||||
${text}
|
||||
</content>
|
||||
`,
|
||||
},
|
||||
],
|
||||
{
|
||||
// @ts-ignore
|
||||
enable_thinking: false,
|
||||
},
|
||||
)
|
||||
.catch((err) => {
|
||||
console.log('AI service error:', err.status);
|
||||
ctx.throw(500, 'AI service error: ' + err.status);
|
||||
return err;
|
||||
});
|
||||
|
||||
console.log('end', Date.now() - now, 'ms');
|
||||
const ans = res.choices[0]?.message?.content || '';
|
||||
if (!ans) {
|
||||
logger.error('Empty response from AI:', res);
|
||||
}
|
||||
ctx.body = getTagContent(ans)
|
||||
})
|
||||
.addTo(agent);
|
7
src/agent/index.ts
Normal file
7
src/agent/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { agent } from './agent.ts';
|
||||
import './analyze/content.ts';
|
||||
import './fix/prompt.ts';
|
||||
|
||||
import './xhs.ts';
|
||||
|
||||
export { agent };
|
3
src/agent/logger.ts
Normal file
3
src/agent/logger.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { Logger } from '@kevisual/logger';
|
||||
|
||||
export const logger = new Logger();
|
19
src/agent/test/analyze.ts
Normal file
19
src/agent/test/analyze.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { agent } from '../index.ts';
|
||||
|
||||
const main = async () => {
|
||||
const text1 = '解答一下这个笔记。';
|
||||
const text2 = '分析一下这个图片';
|
||||
const text3 = '这个视频介绍的是什么';
|
||||
const text4 = '评价一下这个评论。';
|
||||
const text5 = '关于这个评论。';
|
||||
const text6 = '1+1=';
|
||||
const res = await agent.call({
|
||||
path: 'analyze',
|
||||
key: 'content',
|
||||
payload: {
|
||||
text: text6,
|
||||
},
|
||||
});
|
||||
console.log('analyze content res', res.code, 'content', res.body);
|
||||
};
|
||||
main();
|
0
src/agent/test/common.ts
Normal file
0
src/agent/test/common.ts
Normal file
18
src/agent/test/prompt-fix.ts
Normal file
18
src/agent/test/prompt-fix.ts
Normal file
@ -0,0 +1,18 @@
|
||||
// 其中回复的要求是以纯文本,具体的内容在<content></content>当中
|
||||
import { agent } from '../index.ts';
|
||||
|
||||
const main = async () => {
|
||||
const text = '请总结一下这个笔记。';
|
||||
const text2 = '告诉我1+1的值';
|
||||
const text3 = 'html和css的大纲是什么?';
|
||||
const text4 = '1+1=';
|
||||
const res = await agent.call({
|
||||
path: 'fix',
|
||||
key: 'xhs',
|
||||
payload: {
|
||||
text: text4,
|
||||
},
|
||||
});
|
||||
console.log('fix xhs res', res.code, 'content', res.body);
|
||||
};
|
||||
main();
|
53
src/agent/xhs.ts
Normal file
53
src/agent/xhs.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import { nanoid } from 'nanoid';
|
||||
import { agent } from './agent.ts';
|
||||
import { ai } from './ai.ts';
|
||||
/**
|
||||
* 清除文本中的@信息
|
||||
* @param text
|
||||
*/
|
||||
const clearAtInfo = (text: string = '') => {
|
||||
const newText = text.replace(/@[\u4e00-\u9fa5\w]+/g, '').replace(/#.*?#/g, '');
|
||||
return newText.trim();
|
||||
};
|
||||
agent
|
||||
.route({
|
||||
path: 'xhs',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { text = '' } = ctx.query || {};
|
||||
const id = nanoid();
|
||||
const no_at_text = clearAtInfo(text);
|
||||
const resFix = await agent.call({
|
||||
path: 'fix',
|
||||
key: 'xhs',
|
||||
payload: {
|
||||
text: no_at_text,
|
||||
},
|
||||
});
|
||||
if (resFix.code !== 200) {
|
||||
ctx.throw(500, 'AI 小红书prompt优化错误: ' + resFix.message);
|
||||
return;
|
||||
} else {
|
||||
console.log('小红书优化的文本', resFix.body);
|
||||
}
|
||||
const prompt_text = resFix.body || '';
|
||||
const res = await ai
|
||||
.chat(
|
||||
[
|
||||
{
|
||||
role: 'user',
|
||||
content: prompt_text,
|
||||
},
|
||||
],
|
||||
{
|
||||
// @ts-ignore
|
||||
enable_thinking: false,
|
||||
},
|
||||
)
|
||||
.catch((error) => {
|
||||
ctx.throw(500, 'AI 服务错误: ' + error.status);
|
||||
return error;
|
||||
});
|
||||
ctx.body = res.choices?.[0]?.message?.content || '';
|
||||
})
|
||||
.addTo(agent);
|
@ -1,5 +1,5 @@
|
||||
import { App } from '@kevisual/router';
|
||||
import { useContextKey } from '@kevisual/use-config/context';
|
||||
import { useContextKey } from '@kevisual/context';
|
||||
|
||||
const init = () => {
|
||||
return new App();
|
||||
|
3
src/modules/notify.ts
Normal file
3
src/modules/notify.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const notify = () => {
|
||||
//
|
||||
};
|
@ -1,15 +1,16 @@
|
||||
import { Redis } from 'ioredis';
|
||||
import { config } from './config.ts';
|
||||
import { useContextKey } from '@kevisual/use-config/context';
|
||||
import { useContextKey } from '@kevisual/context';
|
||||
|
||||
type initRedisOpts = {
|
||||
onConnect?: () => void; // 连接成功的回调函数
|
||||
onError?: (msg?: any) => void; // 连接断开的回调函数
|
||||
const redisConfig = {
|
||||
host: config.REDIS_HOST || 'localhost',
|
||||
port: parseInt(config.REDIS_PORT || '6379'),
|
||||
password: config.REDIS_PASSWORD,
|
||||
};
|
||||
const initRedis = (config?: any, options?: initRedisOpts) => {
|
||||
const redis = new Redis({
|
||||
host: config?.REDIS_HOST || 'localhost', // Redis 服务器的主机名或 IP 地址
|
||||
port: config?.REDIS_PORT || 6379, // Redis 服务器的端口号
|
||||
export const createRedisClient = (options = {}) => {
|
||||
const redisClient = new Redis({
|
||||
host: 'localhost', // Redis 服务器的主机名或 IP 地址
|
||||
port: 6379, // Redis 服务器的端口号
|
||||
// password: 'your_password', // Redis 的密码 (如果有)
|
||||
db: 0, // 要使用的 Redis 数据库索引 (0-15)
|
||||
keyPrefix: '', // key 前缀
|
||||
@ -18,27 +19,20 @@ const initRedis = (config?: any, options?: initRedisOpts) => {
|
||||
return Math.min(times * 50, 2000); // 每次重试时延迟增加
|
||||
},
|
||||
maxRetriesPerRequest: null, // 允许请求重试的次数 (如果需要无限次重试)
|
||||
...config, // 其他配置项
|
||||
...redisConfig,
|
||||
...options,
|
||||
});
|
||||
// 监听连接事件
|
||||
redis.on('connect', () => {
|
||||
if (options?.onConnect) {
|
||||
options.onConnect();
|
||||
console.log('Redis 连接成功');
|
||||
}
|
||||
redisClient.on('connect', () => {
|
||||
console.log('Redis client connected successfully');
|
||||
});
|
||||
|
||||
redis.on('error', (err) => {
|
||||
console.error('Redis 连接错误', err);
|
||||
if (options?.onError) {
|
||||
options.onError(err);
|
||||
}
|
||||
redisClient.on('error', (err) => {
|
||||
console.error('Redis client error:', err);
|
||||
});
|
||||
return redis;
|
||||
return redisClient;
|
||||
};
|
||||
// 配置 Redis 连接
|
||||
export const redis = useContextKey('redis', () => initRedis(config));
|
||||
export const redis = useContextKey('redis', () => createRedisClient());
|
||||
|
||||
// 初始化 Redis 客户端
|
||||
export const redisPublisher = new Redis(); // 用于发布消息
|
||||
export const redisSubscriber = new Redis(); // 用于订阅消息
|
||||
// export const redisPublisher = createRedisClient(); // 用于发布消息
|
||||
// export const redisSubscriber = createRedisClient(); // 用于订阅消息
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Sequelize } from 'sequelize';
|
||||
import { config } from './config.ts';
|
||||
import { useContextKey } from '@kevisual/use-config/context';
|
||||
import { useContextKey } from '@kevisual/context';
|
||||
|
||||
export type PostgresConfig = {
|
||||
postgres: {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { agent } from '@/agent/index.ts';
|
||||
import { taskApp, queue, xhsApp } from '../task.ts';
|
||||
import { random, omit } from 'lodash-es';
|
||||
import util from 'node:util';
|
||||
@ -10,6 +11,7 @@ taskApp
|
||||
.route({
|
||||
path: 'task',
|
||||
key: 'getUnread',
|
||||
description: '获取未读提及消息',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const res = await xhsApp.call({
|
||||
@ -50,6 +52,7 @@ taskApp
|
||||
.route({
|
||||
path: 'task',
|
||||
key: 'getMention',
|
||||
description: '获取提及消息',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { unread_count } = ctx.query;
|
||||
@ -61,11 +64,9 @@ taskApp
|
||||
num: unread_count,
|
||||
},
|
||||
});
|
||||
console.log('mentionRes', mentionRes.body);
|
||||
if (mentionRes.code === 200) {
|
||||
let data = mentionRes.body || [];
|
||||
// data = data.map((item) => omit(item, 'mention'));
|
||||
console.log('queryMention', util.inspect(data, { depth: 10 }));
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const item = data[i];
|
||||
queue.add(
|
||||
@ -86,7 +87,6 @@ taskApp
|
||||
},
|
||||
},
|
||||
);
|
||||
console.log('add mention task', item);
|
||||
await sleep(200);
|
||||
}
|
||||
}
|
||||
@ -94,9 +94,7 @@ taskApp
|
||||
path: 'mention',
|
||||
key: 'postRead',
|
||||
});
|
||||
console.log('postRead', postRead.body);
|
||||
}
|
||||
await sleep(1000);
|
||||
ctx.body = {
|
||||
job: unread_count,
|
||||
};
|
||||
@ -109,7 +107,7 @@ taskApp
|
||||
key: 'ai',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const data = ctx.query.data;
|
||||
const data = ctx.query.data; // 为提及的相关信息
|
||||
const note_id = data.note_id;
|
||||
const xsec_token = data.xsec_token;
|
||||
const comment_id = data.comment.comment_id;
|
||||
@ -119,6 +117,21 @@ taskApp
|
||||
content,
|
||||
comment_id,
|
||||
};
|
||||
const resAgent = await agent.call({
|
||||
path: 'xhs',
|
||||
payload: {
|
||||
text: content,
|
||||
},
|
||||
});
|
||||
let responseText = '';
|
||||
let errorText = '';
|
||||
if (resAgent.code !== 200) {
|
||||
errorText = '【调用错误】';
|
||||
responseText = `${resAgent.message}`;
|
||||
} else {
|
||||
responseText = resAgent.body;
|
||||
}
|
||||
postData.content = responseText;
|
||||
const res = await xhsApp.call({
|
||||
path: 'mention',
|
||||
key: 'addComment',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ProviderManager, SiliconFlowProvider } from '@kevisual/ai-center';
|
||||
import { ProviderManager, SiliconFlowProvider } from '@kevisual/ai';
|
||||
import dotenv from 'dotenv';
|
||||
import util from 'node:util';
|
||||
dotenv.config();
|
||||
|
22
turbo.json
Normal file
22
turbo.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"outputs": [
|
||||
"dist/**"
|
||||
]
|
||||
},
|
||||
"dev:lib": {
|
||||
"persistent": true,
|
||||
"cache": true
|
||||
},
|
||||
"build:lib": {
|
||||
"dependsOn": [
|
||||
"^build:lib"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user