mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
feat(insight): integrate JSONL file reading utility and enhance base CSS styles
This commit is contained in:
parent
7b845ea3a6
commit
338387f93a
2 changed files with 544 additions and 249 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { read as readJsonlFile } from '@qwen-code/qwen-code-core';
|
||||
import type {
|
||||
InsightData,
|
||||
HeatMapData,
|
||||
|
|
@ -13,33 +14,7 @@ import type {
|
|||
AchievementData,
|
||||
StreakData,
|
||||
} from '../types/StaticInsightTypes.js';
|
||||
|
||||
// Define ChatRecord interface locally to avoid import issues
|
||||
interface ChatRecord {
|
||||
uuid: string;
|
||||
parentUuid: string | null;
|
||||
sessionId: string;
|
||||
timestamp: string;
|
||||
usageMetadata?: {
|
||||
promptTokenCount?: number;
|
||||
candidatesTokenCount?: number;
|
||||
totalTokenCount?: number;
|
||||
};
|
||||
}
|
||||
|
||||
// Simple JSONL reader function
|
||||
async function readJsonlFile<T>(filePath: string): Promise<T[]> {
|
||||
try {
|
||||
const content = await fs.readFile(filePath, 'utf-8');
|
||||
return content
|
||||
.split('\n')
|
||||
.filter((line) => line.trim())
|
||||
.map((line) => JSON.parse(line) as T);
|
||||
} catch (error) {
|
||||
console.error(`Error reading JSONL file ${filePath}:`, error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
import type { ChatRecord } from '@qwen-code/qwen-code-core';
|
||||
|
||||
export class DataProcessor {
|
||||
// Helper function to format date as YYYY-MM-DD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue