Files
office-data-matcher/frontend/wailsjs/go/models.ts
RainySY b5a91cb115 perf: optimize hot path & reorganize project config
Backend (app.go):
- AICache: replace linear scan with map-based O(1) lookup (get/getRow/put/putRow)
- runMatchOnData: pre-compute B-column cleaned values, parsed times, extract values
  to eliminate O(n*m) regex/time-parse from inner loop
- calcSimilarity: eliminate double rune conversion (levenshteinDistance now takes []rune)
- Add similarityFromCleaned to skip redundant regex step in hot path
- Fix corrupted bare 'n' literal causing build failure
- Move saveToFile out of inner match loop (was called per item)
- dataMu: Mutex -> RWMutex (exportHeaders/ExportResults use RLock)
- buildGenericAIPrompt: fix truncation check order (check after write)

Project:
- .gitignore: deduplicate & tighten rules; track package-lock.json and .vscode/*
- Clean up stale root binary (data-matcher.exe)
2026-05-20 14:16:13 +08:00

84 lines
2.5 KiB
TypeScript

export namespace main {
export class AICacheInfo {
count: number;
filePath: string;
static createFrom(source: any = {}) {
return new AICacheInfo(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.count = source["count"];
this.filePath = source["filePath"];
}
}
export class MatchConfig {
fileAPath: string;
fileBPath: string;
colAMatchIndex: number;
colATimeIndex: number;
colBMatchIndex: number;
colBTimeIndex: number;
colBExtractIndex: number;
regexPattern: string;
timeWindow: number;
threshold: number;
allMatches: boolean;
caseSensitive: boolean;
sortBy: string;
maxPreview: number;
exportFormat: string;
includeHeader: boolean;
static createFrom(source: any = {}) {
return new MatchConfig(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.fileAPath = source["fileAPath"];
this.fileBPath = source["fileBPath"];
this.colAMatchIndex = source["colAMatchIndex"];
this.colATimeIndex = source["colATimeIndex"];
this.colBMatchIndex = source["colBMatchIndex"];
this.colBTimeIndex = source["colBTimeIndex"];
this.colBExtractIndex = source["colBExtractIndex"];
this.regexPattern = source["regexPattern"];
this.timeWindow = source["timeWindow"];
this.threshold = source["threshold"];
this.allMatches = source["allMatches"];
this.caseSensitive = source["caseSensitive"];
this.sortBy = source["sortBy"];
this.maxPreview = source["maxPreview"];
this.exportFormat = source["exportFormat"];
this.includeHeader = source["includeHeader"];
}
}
export class MatchResult {
rowAData: string[];
rowBKey: string;
extractValue: string;
timeDiff: string;
similarityScore: number;
aiMatched: boolean;
static createFrom(source: any = {}) {
return new MatchResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.rowAData = source["rowAData"];
this.rowBKey = source["rowBKey"];
this.extractValue = source["extractValue"];
this.timeDiff = source["timeDiff"];
this.similarityScore = source["similarityScore"];
this.aiMatched = source["aiMatched"];
}
}
}