@octo-cyber/humble-brag-lab 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/controllers/humble-brag.controller.d.ts +3 -0
  2. package/dist/controllers/humble-brag.controller.d.ts.map +1 -0
  3. package/dist/controllers/humble-brag.controller.js +60 -0
  4. package/dist/controllers/humble-brag.controller.js.map +1 -0
  5. package/dist/data/classic-quotes.d.ts +9 -0
  6. package/dist/data/classic-quotes.d.ts.map +1 -0
  7. package/dist/data/classic-quotes.js +76 -0
  8. package/dist/data/classic-quotes.js.map +1 -0
  9. package/dist/entities/analysis-record.entity.d.ts +17 -0
  10. package/dist/entities/analysis-record.entity.d.ts.map +1 -0
  11. package/dist/entities/analysis-record.entity.js +66 -0
  12. package/dist/entities/analysis-record.entity.js.map +1 -0
  13. package/dist/entities/index.d.ts +5 -0
  14. package/dist/entities/index.d.ts.map +1 -0
  15. package/dist/entities/index.js +12 -0
  16. package/dist/entities/index.js.map +1 -0
  17. package/dist/entities/quote-collection.entity.d.ts +17 -0
  18. package/dist/entities/quote-collection.entity.d.ts.map +1 -0
  19. package/dist/entities/quote-collection.entity.js +66 -0
  20. package/dist/entities/quote-collection.entity.js.map +1 -0
  21. package/dist/humble-brag-lab.module.d.ts +8 -0
  22. package/dist/humble-brag-lab.module.d.ts.map +1 -0
  23. package/dist/humble-brag-lab.module.js +21 -0
  24. package/dist/humble-brag-lab.module.js.map +1 -0
  25. package/dist/index.d.ts +6 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +12 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/schemas/humble-brag.schema.d.ts +33 -0
  30. package/dist/schemas/humble-brag.schema.d.ts.map +1 -0
  31. package/dist/schemas/humble-brag.schema.js +16 -0
  32. package/dist/schemas/humble-brag.schema.js.map +1 -0
  33. package/dist/services/analysis-record.service.d.ts +15 -0
  34. package/dist/services/analysis-record.service.d.ts.map +1 -0
  35. package/dist/services/analysis-record.service.js +32 -0
  36. package/dist/services/analysis-record.service.js.map +1 -0
  37. package/dist/services/humble-brag-analyzer.service.d.ts +22 -0
  38. package/dist/services/humble-brag-analyzer.service.d.ts.map +1 -0
  39. package/dist/services/humble-brag-analyzer.service.js +321 -0
  40. package/dist/services/humble-brag-analyzer.service.js.map +1 -0
  41. package/dist/services/quote-collection.service.d.ts +15 -0
  42. package/dist/services/quote-collection.service.d.ts.map +1 -0
  43. package/dist/services/quote-collection.service.js +39 -0
  44. package/dist/services/quote-collection.service.js.map +1 -0
  45. package/package.json +88 -0
  46. package/web/index.ts +9 -0
  47. package/web/manifest.ts +18 -0
  48. package/web/messages/en-US.json +76 -0
  49. package/web/messages/zh-CN.json +76 -0
  50. package/web/pages/HumbleBragLabPage.tsx +561 -0
@@ -0,0 +1,3 @@
1
+ import type { Express } from '@octo-cyber/core';
2
+ export declare function registerHumbleBragRoutes(app: Express): void;
3
+ //# sourceMappingURL=humble-brag.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humble-brag.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/humble-brag.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAQnE,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA4E3D"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerHumbleBragRoutes = registerHumbleBragRoutes;
4
+ const core_1 = require("@octo-cyber/core");
5
+ const humble_brag_analyzer_service_js_1 = require("../services/humble-brag-analyzer.service.js");
6
+ const analysis_record_service_js_1 = require("../services/analysis-record.service.js");
7
+ const quote_collection_service_js_1 = require("../services/quote-collection.service.js");
8
+ const humble_brag_schema_js_1 = require("../schemas/humble-brag.schema.js");
9
+ const classic_quotes_js_1 = require("../data/classic-quotes.js");
10
+ function registerHumbleBragRoutes(app) {
11
+ const analyzer = core_1.Container.get(humble_brag_analyzer_service_js_1.HumbleBragAnalyzerService);
12
+ const recordService = core_1.Container.get(analysis_record_service_js_1.AnalysisRecordService);
13
+ const collectionService = core_1.Container.get(quote_collection_service_js_1.QuoteCollectionService);
14
+ // POST /api/v1/humble-brag-lab/analyze
15
+ app.post('/api/v1/humble-brag-lab/analyze', (0, core_1.asyncHandler)(async (req, res) => {
16
+ const parsed = humble_brag_schema_js_1.AnalyzeTextSchema.safeParse(req.body);
17
+ if (!parsed.success) {
18
+ throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
19
+ }
20
+ const result = analyzer.analyze(parsed.data.text);
21
+ const record = await recordService.saveRecord({
22
+ inputText: parsed.data.text,
23
+ score: result.score,
24
+ rank: result.rank,
25
+ translation: result.translation,
26
+ patterns: JSON.stringify(result.patterns),
27
+ highlights: JSON.stringify(result.highlights),
28
+ });
29
+ res.status(201).json(core_1.ApiResponse.ok({ ...result, id: record.id }, '分析完成'));
30
+ }));
31
+ // GET /api/v1/humble-brag-lab/records
32
+ app.get('/api/v1/humble-brag-lab/records', (0, core_1.asyncHandler)(async (_req, res) => {
33
+ const records = await recordService.listRecords(20);
34
+ res.json(core_1.ApiResponse.ok(records));
35
+ }));
36
+ // GET /api/v1/humble-brag-lab/classic-quotes
37
+ app.get('/api/v1/humble-brag-lab/classic-quotes', (0, core_1.asyncHandler)(async (_req, res) => {
38
+ res.json(core_1.ApiResponse.ok(classic_quotes_js_1.CLASSIC_QUOTES));
39
+ }));
40
+ // GET /api/v1/humble-brag-lab/collections
41
+ app.get('/api/v1/humble-brag-lab/collections', (0, core_1.asyncHandler)(async (_req, res) => {
42
+ const items = await collectionService.listCollections();
43
+ res.json(core_1.ApiResponse.ok(items));
44
+ }));
45
+ // POST /api/v1/humble-brag-lab/collections
46
+ app.post('/api/v1/humble-brag-lab/collections', (0, core_1.asyncHandler)(async (req, res) => {
47
+ const parsed = humble_brag_schema_js_1.AddCollectionSchema.safeParse(req.body);
48
+ if (!parsed.success) {
49
+ throw core_1.AppError.badRequest(parsed.error.issues[0]?.message ?? 'Invalid input');
50
+ }
51
+ const item = await collectionService.addCollection(parsed.data);
52
+ res.status(201).json(core_1.ApiResponse.ok(item, '收藏成功'));
53
+ }));
54
+ // DELETE /api/v1/humble-brag-lab/collections/:id
55
+ app.delete('/api/v1/humble-brag-lab/collections/:id', (0, core_1.asyncHandler)(async (req, res) => {
56
+ await collectionService.removeCollection(req.params.id);
57
+ res.json(core_1.ApiResponse.ok(null, '已取消收藏'));
58
+ }));
59
+ }
60
+ //# sourceMappingURL=humble-brag.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humble-brag.controller.js","sourceRoot":"","sources":["../../src/controllers/humble-brag.controller.ts"],"names":[],"mappings":";;AAQA,4DA4EC;AAnFD,2CAAkF;AAClF,iGAAwF;AACxF,uFAA+E;AAC/E,yFAAiF;AACjF,4EAA0F;AAC1F,iEAA2D;AAE3D,SAAgB,wBAAwB,CAAC,GAAY;IACnD,MAAM,QAAQ,GAAG,gBAAS,CAAC,GAAG,CAAC,2DAAyB,CAAC,CAAC;IAC1D,MAAM,aAAa,GAAG,gBAAS,CAAC,GAAG,CAAC,kDAAqB,CAAC,CAAC;IAC3D,MAAM,iBAAiB,GAAG,gBAAS,CAAC,GAAG,CAAC,oDAAsB,CAAC,CAAC;IAEhE,uCAAuC;IACvC,GAAG,CAAC,IAAI,CACN,iCAAiC,EACjC,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QACjD,MAAM,MAAM,GAAG,yCAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,eAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;QAChF,C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@
1
+ export interface ClassicQuote {
2
+ id: string;
3
+ text: string;
4
+ score: number;
5
+ rank: string;
6
+ analysis: string;
7
+ }
8
+ export declare const CLASSIC_QUOTES: ClassicQuote[];
9
+ //# sourceMappingURL=classic-quotes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classic-quotes.d.ts","sourceRoot":"","sources":["../../src/data/classic-quotes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,YAAY,EAuExC,CAAC"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLASSIC_QUOTES = void 0;
4
+ exports.CLASSIC_QUOTES = [
5
+ {
6
+ id: 'q1',
7
+ text: '烦死了,又被哈佛录了,不知道要不要去……',
8
+ score: 92,
9
+ rank: '👑 王者凡尔赛',
10
+ analysis: '以烦恼包装顶尖成就,教科书级别的假装困扰',
11
+ },
12
+ {
13
+ id: 'q2',
14
+ text: '随手买了块劳力士,手腕好重啊,出门都不方便。',
15
+ score: 88,
16
+ rank: '💎 钻石大师',
17
+ analysis: '奢侈品随口提及 + 伪装成日常烦恼,满分操作',
18
+ },
19
+ {
20
+ id: 'q3',
21
+ text: '虽然才月薪5万,但感觉够用了,普通人其实不需要那么多钱的。',
22
+ score: 85,
23
+ rank: '💎 钻石大师',
24
+ analysis: '假谦虚 + 优越感对比,"普通人"三个字出卖了一切',
25
+ },
26
+ {
27
+ id: 'q4',
28
+ text: '又被CEO叫去谈晋升的事,真的好烦,刚刚升完还要再升。',
29
+ score: 82,
30
+ rank: '💎 钻石大师',
31
+ analysis: '以烦恼形式展示连续晋升,典型的"苦恼型炫耀"',
32
+ },
33
+ {
34
+ id: 'q5',
35
+ text: '唉,出差又要坐商务舱,腰真的不舒服,经济舱感觉更自在。',
36
+ score: 79,
37
+ rank: '🏅 铂金斡旋',
38
+ analysis: '通过假装抱怨商务舱透露高端出行习惯',
39
+ },
40
+ {
41
+ id: 'q6',
42
+ text: '没想到一个随便写的方案就拿了第一,有点惭愧……',
43
+ score: 76,
44
+ rank: '🏅 铂金斡旋',
45
+ analysis: '"随便写"+"第一",假装意外的优越感双倍奉上',
46
+ },
47
+ {
48
+ id: 'q7',
49
+ text: '朋友非要我去参加他们的聚会,说没我就没意思,真的烦啊。',
50
+ score: 65,
51
+ rank: '🏅 铂金斡旋',
52
+ analysis: '以被追捧为烦恼,暗示自己的社交地位',
53
+ },
54
+ {
55
+ id: 'q8',
56
+ text: '清华的同学总问我要学习资料,我真的没什么特别的,就是运气好。',
57
+ score: 78,
58
+ rank: '🏅 铂金斡旋',
59
+ analysis: '名校背书 + 假谦虚,"运气好"不过是谦辞',
60
+ },
61
+ {
62
+ id: 'q9',
63
+ text: '又要去参加Forbes颁奖典礼,礼服还没准备,好麻烦。',
64
+ score: 91,
65
+ rank: '👑 王者凡尔赛',
66
+ analysis: '顶级荣誉化为日常烦恼,浑然天成的高段位凡尔赛',
67
+ },
68
+ {
69
+ id: 'q10',
70
+ text: '虽然年薪只有百万出头,但生活嘛,知足常乐就好。',
71
+ score: 87,
72
+ rank: '💎 钻石大师',
73
+ analysis: '"只有"百万,"知足常乐",每个字都是凡尔赛精华',
74
+ },
75
+ ];
76
+ //# sourceMappingURL=classic-quotes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classic-quotes.js","sourceRoot":"","sources":["../../src/data/classic-quotes.ts"],"names":[],"mappings":";;;AAQa,QAAA,cAAc,GAAmB;IAC5C;QACE,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,sBAAsB;KACjC;IACD;QACE,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nalysisRecord {
2
+ id: string;
3
+ /** 用户输入的原始文本 */
4
+ inputText: string;
5
+ /** 凡尔赛指数 0-100 */
6
+ score: number;
7
+ /** 段位名称 */
8
+ rank: string;
9
+ /** 直白翻译 */
10
+ translation: string;
11
+ /** 识别到的模式(JSON 数组字符串) */
12
+ patterns: string;
13
+ /** 高亮片段(JSON 数组字符串) */
14
+ highlights: string;
15
+ createdAt: Date;
16
+ }
17
+ //# sourceMappingURL=analysis-record.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-record.entity.d.ts","sourceRoot":"","sources":["../../src/entities/analysis-record.entity.ts"],"names":[],"mappings":"AAOA,qBACa,cAAc;IAEzB,EAAE,EAAG,MAAM,CAAC;IAEZ,gBAAgB;IAEhB,SAAS,EAAG,MAAM,CAAC;IAEnB,kBAAkB;IAElB,KAAK,EAAG,MAAM,CAAC;IAEf,WAAW;IAEX,IAAI,EAAG,MAAM,CAAC;IAEd,WAAW;IAEX,WAAW,EAAG,MAAM,CAAC;IAErB,yBAAyB;IAEzB,QAAQ,EAAG,MAAM,CAAC;IAElB,uBAAuB;IAEvB,UAAU,EAAG,MAAM,CAAC;IAGpB,SAAS,EAAG,IAAI,CAAC;CAClB"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AnalysisRecord = void 0;
13
+ const core_1 = require("@octo-cyber/core");
14
+ let AnalysisRecord = class AnalysisRecord {
15
+ id;
16
+ /** 用户输入的原始文本 */
17
+ inputText;
18
+ /** 凡尔赛指数 0-100 */
19
+ score;
20
+ /** 段位名称 */
21
+ rank;
22
+ /** 直白翻译 */
23
+ translation;
24
+ /** 识别到的模式(JSON 数组字符串) */
25
+ patterns;
26
+ /** 高亮片段(JSON 数组字符串) */
27
+ highlights;
28
+ createdAt;
29
+ };
30
+ exports.AnalysisRecord = AnalysisRecord;
31
+ __decorate([
32
+ (0, core_1.PrimaryGeneratedColumn)('uuid'),
33
+ __metadata("design:type", String)
34
+ ], AnalysisRecord.prototype, "id", void 0);
35
+ __decorate([
36
+ (0, core_1.Column)({ type: 'text', name: 'input_text' }),
37
+ __metadata("design:type", String)
38
+ ], AnalysisRecord.prototype, "inputText", void 0);
39
+ __decorate([
40
+ (0, core_1.Column)({ type: 'integer' }),
41
+ __metadata("design:type", Number)
42
+ ], AnalysisRecord.prototype, "score", void 0);
43
+ __decorate([
44
+ (0, core_1.Column)({ type: 'varchar', length: 32 }),
45
+ __metadata("design:type", String)
46
+ ], AnalysisRecord.prototype, "rank", void 0);
47
+ __decorate([
48
+ (0, core_1.Column)({ type: 'text' }),
49
+ __metadata("design:type", String)
50
+ ], AnalysisRecord.prototype, "translation", void 0);
51
+ __decorate([
52
+ (0, core_1.Column)({ type: 'text' }),
53
+ __metadata("design:type", String)
54
+ ], AnalysisRecord.prototype, "patterns", void 0);
55
+ __decorate([
56
+ (0, core_1.Column)({ type: 'text' }),
57
+ __metadata("design:type", String)
58
+ ], AnalysisRecord.prototype, "highlights", void 0);
59
+ __decorate([
60
+ (0, core_1.CreateDateColumn)({ name: 'created_at' }),
61
+ __metadata("design:type", Date)
62
+ ], AnalysisRecord.prototype, "createdAt", void 0);
63
+ exports.AnalysisRecord = AnalysisRecord = __decorate([
64
+ (0, core_1.Entity)('hbl_analysis_record')
65
+ ], AnalysisRecord);
66
+ //# sourceMappingURL=analysis-record.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-record.entity.js","sourceRoot":"","sources":["../../src/entities/analysis-record.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAK0B;AAGnB,IAAM,cAAc,GAApB,MAAM,cAAc;IAEzB,EAAE,CAAU;IAEZ,gBAAgB;IAEhB,SAAS,CAAU;IAEnB,kBAAkB;IAElB,KAAK,CAAU;IAEf,WAAW;IAEX,IAAI,CAAU;IAEd,WAAW;IAEX,WAAW,CAAU;IAErB,yBAAyB;IAEzB,QAAQ,CAAU;IAElB,uBAAuB;IAEvB,UAAU,CAAU;IAGpB,SAAS,CAAQ;CAClB,CAAA;AA9BY,wCAAc;AAEzB;IADC,IAAA,6BAAsB,EAAC,MAAM,CAAC;;0CACnB;AAIZ;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;;iDAC1B;AAInB;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;6CACb;AAIf;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;4CAC1B;AAId;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACJ;AAIrB;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDACP;AAIlB;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDACL;AAGpB;IADC,IAAA,uBAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC7B,IAAI;iDAAC;yBA7BN,cAAc;IAD1B,IAAA,aAAM,EAAC,qBAAqB,CAAC;GACjB,cAAc,CA8B1B"}
@@ -0,0 +1,5 @@
1
+ import { AnalysisRecord } from './analysis-record.entity.js';
2
+ import { QuoteCollection } from './quote-collection.entity.js';
3
+ export { AnalysisRecord, QuoteCollection };
4
+ export declare const HUMBLE_BRAG_ENTITIES: readonly [typeof AnalysisRecord, typeof QuoteCollection];
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAE3C,eAAO,MAAM,oBAAoB,0DAGvB,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HUMBLE_BRAG_ENTITIES = exports.QuoteCollection = exports.AnalysisRecord = void 0;
4
+ const analysis_record_entity_js_1 = require("./analysis-record.entity.js");
5
+ Object.defineProperty(exports, "AnalysisRecord", { enumerable: true, get: function () { return analysis_record_entity_js_1.AnalysisRecord; } });
6
+ const quote_collection_entity_js_1 = require("./quote-collection.entity.js");
7
+ Object.defineProperty(exports, "QuoteCollection", { enumerable: true, get: function () { return quote_collection_entity_js_1.QuoteCollection; } });
8
+ exports.HUMBLE_BRAG_ENTITIES = [
9
+ analysis_record_entity_js_1.AnalysisRecord,
10
+ quote_collection_entity_js_1.QuoteCollection,
11
+ ];
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;AAAA,2EAA6D;AAGpD,+FAHA,0CAAc,OAGA;AAFvB,6EAA+D;AAEtC,gGAFhB,4CAAe,OAEgB;AAE3B,QAAA,oBAAoB,GAAG;IAClC,0CAAc;IACd,4CAAe;CACP,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare class QuoteCollection {
2
+ id: string;
3
+ /** 收藏的凡尔赛语录原文 */
4
+ text: string;
5
+ /** 直白翻译(冗余存储,方便展示) */
6
+ translation: string;
7
+ /** 凡尔赛指数 */
8
+ score: number;
9
+ /** 段位 */
10
+ rank: string;
11
+ /** 来源分析记录 ID(可为空,表示内置语录) */
12
+ recordId: string | null;
13
+ /** 用户备注 */
14
+ note: string | null;
15
+ createdAt: Date;
16
+ }
17
+ //# sourceMappingURL=quote-collection.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quote-collection.entity.d.ts","sourceRoot":"","sources":["../../src/entities/quote-collection.entity.ts"],"names":[],"mappings":"AAOA,qBACa,eAAe;IAE1B,EAAE,EAAG,MAAM,CAAC;IAEZ,iBAAiB;IAEjB,IAAI,EAAG,MAAM,CAAC;IAEd,sBAAsB;IAEtB,WAAW,EAAG,MAAM,CAAC;IAErB,YAAY;IAEZ,KAAK,EAAG,MAAM,CAAC;IAEf,SAAS;IAET,IAAI,EAAG,MAAM,CAAC;IAEd,4BAA4B;IAE5B,QAAQ,EAAG,MAAM,GAAG,IAAI,CAAC;IAEzB,WAAW;IAEX,IAAI,EAAG,MAAM,GAAG,IAAI,CAAC;IAGrB,SAAS,EAAG,IAAI,CAAC;CAClB"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.QuoteCollection = void 0;
13
+ const core_1 = require("@octo-cyber/core");
14
+ let QuoteCollection = class QuoteCollection {
15
+ id;
16
+ /** 收藏的凡尔赛语录原文 */
17
+ text;
18
+ /** 直白翻译(冗余存储,方便展示) */
19
+ translation;
20
+ /** 凡尔赛指数 */
21
+ score;
22
+ /** 段位 */
23
+ rank;
24
+ /** 来源分析记录 ID(可为空,表示内置语录) */
25
+ recordId;
26
+ /** 用户备注 */
27
+ note;
28
+ createdAt;
29
+ };
30
+ exports.QuoteCollection = QuoteCollection;
31
+ __decorate([
32
+ (0, core_1.PrimaryGeneratedColumn)('uuid'),
33
+ __metadata("design:type", String)
34
+ ], QuoteCollection.prototype, "id", void 0);
35
+ __decorate([
36
+ (0, core_1.Column)({ type: 'text' }),
37
+ __metadata("design:type", String)
38
+ ], QuoteCollection.prototype, "text", void 0);
39
+ __decorate([
40
+ (0, core_1.Column)({ type: 'text' }),
41
+ __metadata("design:type", String)
42
+ ], QuoteCollection.prototype, "translation", void 0);
43
+ __decorate([
44
+ (0, core_1.Column)({ type: 'integer' }),
45
+ __metadata("design:type", Number)
46
+ ], QuoteCollection.prototype, "score", void 0);
47
+ __decorate([
48
+ (0, core_1.Column)({ type: 'varchar', length: 32 }),
49
+ __metadata("design:type", String)
50
+ ], QuoteCollection.prototype, "rank", void 0);
51
+ __decorate([
52
+ (0, core_1.Column)({ type: 'varchar', length: 36, nullable: true, name: 'record_id' }),
53
+ __metadata("design:type", Object)
54
+ ], QuoteCollection.prototype, "recordId", void 0);
55
+ __decorate([
56
+ (0, core_1.Column)({ type: 'varchar', length: 256, nullable: true }),
57
+ __metadata("design:type", Object)
58
+ ], QuoteCollection.prototype, "note", void 0);
59
+ __decorate([
60
+ (0, core_1.CreateDateColumn)({ name: 'created_at' }),
61
+ __metadata("design:type", Date)
62
+ ], QuoteCollection.prototype, "createdAt", void 0);
63
+ exports.QuoteCollection = QuoteCollection = __decorate([
64
+ (0, core_1.Entity)('hbl_quote_collection')
65
+ ], QuoteCollection);
66
+ //# sourceMappingURL=quote-collection.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quote-collection.entity.js","sourceRoot":"","sources":["../../src/entities/quote-collection.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAK0B;AAGnB,IAAM,eAAe,GAArB,MAAM,eAAe;IAE1B,EAAE,CAAU;IAEZ,iBAAiB;IAEjB,IAAI,CAAU;IAEd,sBAAsB;IAEtB,WAAW,CAAU;IAErB,YAAY;IAEZ,KAAK,CAAU;IAEf,SAAS;IAET,IAAI,CAAU;IAEd,4BAA4B;IAE5B,QAAQ,CAAiB;IAEzB,WAAW;IAEX,IAAI,CAAiB;IAGrB,SAAS,CAAQ;CAClB,CAAA;AA9BY,0CAAe;AAE1B;IADC,IAAA,6BAAsB,EAAC,MAAM,CAAC;;2CACnB;AAIZ;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CACX;AAId;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACJ;AAIrB;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;8CACb;AAIf;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;6CAC1B;AAId;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;;iDAClD;AAIzB;IADC,IAAA,aAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACpC;AAGrB;IADC,IAAA,uBAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BAC7B,IAAI;kDAAC;0BA7BN,eAAe;IAD3B,IAAA,aAAM,EAAC,sBAAsB,CAAC;GAClB,eAAe,CA8B3B"}
@@ -0,0 +1,8 @@
1
+ import type { IModule, IModuleContext, Express } from '@octo-cyber/core';
2
+ export declare class HumbleBragLabModule implements IModule {
3
+ readonly name = "humble-brag-lab";
4
+ readonly entities: (typeof import("./entities/analysis-record.entity.js").AnalysisRecord | typeof import("./entities/quote-collection.entity.js").QuoteCollection)[];
5
+ initialize(_context: IModuleContext): void;
6
+ registerRoutes(app: Express, _context: IModuleContext): void;
7
+ }
8
+ //# sourceMappingURL=humble-brag-lab.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humble-brag-lab.module.d.ts","sourceRoot":"","sources":["../src/humble-brag-lab.module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIzE,qBAAa,mBAAoB,YAAW,OAAO;IACjD,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,QAAQ,oJAA6B;IAE9C,UAAU,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAK1C,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI;CAK7D"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HumbleBragLabModule = void 0;
4
+ const core_1 = require("@octo-cyber/core");
5
+ const index_js_1 = require("./entities/index.js");
6
+ const humble_brag_controller_js_1 = require("./controllers/humble-brag.controller.js");
7
+ class HumbleBragLabModule {
8
+ name = 'humble-brag-lab';
9
+ entities = [...index_js_1.HUMBLE_BRAG_ENTITIES];
10
+ initialize(_context) {
11
+ const logger = core_1.Container.get(core_1.LoggerService);
12
+ logger.info('[HumbleBragLabModule] initialized');
13
+ }
14
+ registerRoutes(app, _context) {
15
+ (0, humble_brag_controller_js_1.registerHumbleBragRoutes)(app);
16
+ const logger = core_1.Container.get(core_1.LoggerService);
17
+ logger.info('[HumbleBragLabModule] routes registered');
18
+ }
19
+ }
20
+ exports.HumbleBragLabModule = HumbleBragLabModule;
21
+ //# sourceMappingURL=humble-brag-lab.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humble-brag-lab.module.js","sourceRoot":"","sources":["../src/humble-brag-lab.module.ts"],"names":[],"mappings":";;;AAAA,2CAA4D;AAE5D,kDAA2D;AAC3D,uFAAmF;AAEnF,MAAa,mBAAmB;IACrB,IAAI,GAAG,iBAAiB,CAAC;IACzB,QAAQ,GAAG,CAAC,GAAG,+BAAoB,CAAC,CAAC;IAE9C,UAAU,CAAC,QAAwB;QACjC,MAAM,MAAM,GAAG,gBAAS,CAAC,GAAG,CAAC,oBAAa,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IACnD,CAAC;IAED,cAAc,CAAC,GAAY,EAAE,QAAwB;QACnD,IAAA,oDAAwB,EAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,gBAAS,CAAC,GAAG,CAAC,oBAAa,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;IACzD,CAAC;CACF;AAdD,kDAcC"}
@@ -0,0 +1,6 @@
1
+ export { HumbleBragLabModule } from './humble-brag-lab.module.js';
2
+ export { AnalysisRecord } from './entities/analysis-record.entity.js';
3
+ export { QuoteCollection } from './entities/quote-collection.entity.js';
4
+ export { HumbleBragAnalyzerService } from './services/humble-brag-analyzer.service.js';
5
+ export type { AnalysisResult, PatternMatch } from './services/humble-brag-analyzer.service.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HumbleBragAnalyzerService = exports.QuoteCollection = exports.AnalysisRecord = exports.HumbleBragLabModule = void 0;
4
+ var humble_brag_lab_module_js_1 = require("./humble-brag-lab.module.js");
5
+ Object.defineProperty(exports, "HumbleBragLabModule", { enumerable: true, get: function () { return humble_brag_lab_module_js_1.HumbleBragLabModule; } });
6
+ var analysis_record_entity_js_1 = require("./entities/analysis-record.entity.js");
7
+ Object.defineProperty(exports, "AnalysisRecord", { enumerable: true, get: function () { return analysis_record_entity_js_1.AnalysisRecord; } });
8
+ var quote_collection_entity_js_1 = require("./entities/quote-collection.entity.js");
9
+ Object.defineProperty(exports, "QuoteCollection", { enumerable: true, get: function () { return quote_collection_entity_js_1.QuoteCollection; } });
10
+ var humble_brag_analyzer_service_js_1 = require("./services/humble-brag-analyzer.service.js");
11
+ Object.defineProperty(exports, "HumbleBragAnalyzerService", { enumerable: true, get: function () { return humble_brag_analyzer_service_js_1.HumbleBragAnalyzerService; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yEAAkE;AAAzD,gIAAA,mBAAmB,OAAA;AAC5B,kFAAsE;AAA7D,2HAAA,cAAc,OAAA;AACvB,oFAAwE;AAA/D,6HAAA,eAAe,OAAA;AACxB,8FAAuF;AAA9E,4IAAA,yBAAyB,OAAA"}
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ export declare const AnalyzeTextSchema: z.ZodObject<{
3
+ text: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ text: string;
6
+ }, {
7
+ text: string;
8
+ }>;
9
+ export declare const AddCollectionSchema: z.ZodObject<{
10
+ text: z.ZodString;
11
+ translation: z.ZodString;
12
+ score: z.ZodNumber;
13
+ rank: z.ZodString;
14
+ recordId: z.ZodOptional<z.ZodString>;
15
+ note: z.ZodOptional<z.ZodString>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ text: string;
18
+ score: number;
19
+ rank: string;
20
+ translation: string;
21
+ recordId?: string | undefined;
22
+ note?: string | undefined;
23
+ }, {
24
+ text: string;
25
+ score: number;
26
+ rank: string;
27
+ translation: string;
28
+ recordId?: string | undefined;
29
+ note?: string | undefined;
30
+ }>;
31
+ export type AnalyzeTextDto = z.infer<typeof AnalyzeTextSchema>;
32
+ export type AddCollectionDto = z.infer<typeof AddCollectionSchema>;
33
+ //# sourceMappingURL=humble-brag.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humble-brag.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/humble-brag.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC/D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddCollectionSchema = exports.AnalyzeTextSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.AnalyzeTextSchema = zod_1.z.object({
6
+ text: zod_1.z.string().min(1, '请输入要分析的文本').max(2000, '文本不能超过 2000 字'),
7
+ });
8
+ exports.AddCollectionSchema = zod_1.z.object({
9
+ text: zod_1.z.string().min(1).max(2000),
10
+ translation: zod_1.z.string().min(1),
11
+ score: zod_1.z.number().int().min(0).max(100),
12
+ rank: zod_1.z.string().min(1),
13
+ recordId: zod_1.z.string().uuid().optional(),
14
+ note: zod_1.z.string().max(256).optional(),
15
+ });
16
+ //# sourceMappingURL=humble-brag.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humble-brag.schema.js","sourceRoot":"","sources":["../../src/schemas/humble-brag.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC;CAChE,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACjC,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACvC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACtC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { AnalysisRecord } from '../entities/analysis-record.entity.js';
2
+ export declare class AnalysisRecordService {
3
+ private get repo();
4
+ saveRecord(data: {
5
+ inputText: string;
6
+ score: number;
7
+ rank: string;
8
+ translation: string;
9
+ patterns: string;
10
+ highlights: string;
11
+ }): Promise<AnalysisRecord>;
12
+ listRecords(limit?: number): Promise<AnalysisRecord[]>;
13
+ getRecord(id: string): Promise<AnalysisRecord | null>;
14
+ }
15
+ //# sourceMappingURL=analysis-record.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-record.service.d.ts","sourceRoot":"","sources":["../../src/services/analysis-record.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEvE,qBACa,qBAAqB;IAChC,OAAO,KAAK,IAAI,GAGf;IAEK,UAAU,CAAC,IAAI,EAAE;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,cAAc,CAAC;IAKrB,WAAW,CAAC,KAAK,SAAK,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIlD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAG5D"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AnalysisRecordService = void 0;
10
+ const core_1 = require("@octo-cyber/core");
11
+ const analysis_record_entity_js_1 = require("../entities/analysis-record.entity.js");
12
+ let AnalysisRecordService = class AnalysisRecordService {
13
+ get repo() {
14
+ const db = core_1.Container.get(core_1.DatabaseService);
15
+ return db.getRepository(analysis_record_entity_js_1.AnalysisRecord);
16
+ }
17
+ async saveRecord(data) {
18
+ const entity = this.repo.create(data);
19
+ return this.repo.save(entity);
20
+ }
21
+ async listRecords(limit = 20) {
22
+ return this.repo.find({ order: { createdAt: 'DESC' }, take: limit });
23
+ }
24
+ async getRecord(id) {
25
+ return this.repo.findOne({ where: { id } });
26
+ }
27
+ };
28
+ exports.AnalysisRecordService = AnalysisRecordService;
29
+ exports.AnalysisRecordService = AnalysisRecordService = __decorate([
30
+ (0, core_1.Service)()
31
+ ], AnalysisRecordService);
32
+ //# sourceMappingURL=analysis-record.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-record.service.js","sourceRoot":"","sources":["../../src/services/analysis-record.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAuE;AAEvE,qFAAuE;AAGhE,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,IAAY,IAAI;QACd,MAAM,EAAE,GAAG,gBAAS,CAAC,GAAG,CAAC,sBAAe,CAAC,CAAC;QAC1C,OAAO,EAAE,CAAC,aAAa,CAAC,0CAAc,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAOhB;QACC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAK,GAAG,EAAE;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,EAAU;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF,CAAA;AAzBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,cAAO,GAAE;GACG,qBAAqB,CAyBjC"}
@@ -0,0 +1,22 @@
1
+ export interface PatternMatch {
2
+ /** 模式名称(i18n key) */
3
+ pattern: string;
4
+ /** 触发该模式的文本片段 */
5
+ snippet: string;
6
+ /** 该模式的基础加分 */
7
+ weight: number;
8
+ }
9
+ export interface AnalysisResult {
10
+ score: number;
11
+ rank: string;
12
+ translation: string;
13
+ patterns: PatternMatch[];
14
+ highlights: string[];
15
+ }
16
+ export declare class HumbleBragAnalyzerService {
17
+ analyze(text: string): AnalysisResult;
18
+ private calculateScore;
19
+ private getRank;
20
+ private buildTranslation;
21
+ }
22
+ //# sourceMappingURL=humble-brag-analyzer.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"humble-brag-analyzer.service.d.ts","sourceRoot":"","sources":["../../src/services/humble-brag-analyzer.service.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAyRD,qBACa,yBAAyB;IACpC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc;IA0BrC,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,gBAAgB;CAUzB"}