mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-06 04:55:45 +08:00
feat: add jsonlPath to session data and database schema
This commit is contained in:
@@ -45,6 +45,7 @@ export async function processClaudeSessions() {
|
|||||||
result.sessionName,
|
result.sessionName,
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
|
file,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export async function processCodexSessions() {
|
|||||||
result.sessionName,
|
result.sessionName,
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
|
file,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ export async function processCursorSessions() {
|
|||||||
result.sessionName,
|
result.sessionName,
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
|
file,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export async function processGeminiSessions() {
|
|||||||
result.sessionName,
|
result.sessionName,
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
|
file,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ const onUpdate = async (
|
|||||||
sessionName,
|
sessionName,
|
||||||
createdAt,
|
createdAt,
|
||||||
updatedAt,
|
updatedAt,
|
||||||
|
filePath,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ export const runMigrations = (db: Database) => {
|
|||||||
const sessionColumnNames = sessionsTableInfo.map((col) => col.name);
|
const sessionColumnNames = sessionsTableInfo.map((col) => col.name);
|
||||||
addColumnToTableIfNotExists(db, "sessions", sessionColumnNames, "created_at", "DATETIME");
|
addColumnToTableIfNotExists(db, "sessions", sessionColumnNames, "created_at", "DATETIME");
|
||||||
addColumnToTableIfNotExists(db, "sessions", sessionColumnNames, "updated_at", "DATETIME");
|
addColumnToTableIfNotExists(db, "sessions", sessionColumnNames, "updated_at", "DATETIME");
|
||||||
|
addColumnToTableIfNotExists(db, "sessions", sessionColumnNames, "jsonl_path", "TEXT");
|
||||||
db.exec("UPDATE sessions SET created_at = COALESCE(created_at, CURRENT_TIMESTAMP)");
|
db.exec("UPDATE sessions SET created_at = COALESCE(created_at, CURRENT_TIMESTAMP)");
|
||||||
db.exec("UPDATE sessions SET updated_at = COALESCE(updated_at, CURRENT_TIMESTAMP)");
|
db.exec("UPDATE sessions SET updated_at = COALESCE(updated_at, CURRENT_TIMESTAMP)");
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ type SessionNameLookupRow = {
|
|||||||
|
|
||||||
type SessionMetadataLookupRow = Pick<
|
type SessionMetadataLookupRow = Pick<
|
||||||
SessionsRow,
|
SessionsRow,
|
||||||
'session_id' | 'provider' | 'workspace_path' | 'created_at' | 'updated_at'
|
'session_id' | 'provider' | 'workspace_path' | 'jsonl_path' | 'created_at' | 'updated_at'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
function normalizeTimestamp(value?: string): string | null {
|
function normalizeTimestamp(value?: string): string | null {
|
||||||
@@ -65,6 +65,7 @@ export const sessionsDb = {
|
|||||||
customName?: string,
|
customName?: string,
|
||||||
createdAt?: string,
|
createdAt?: string,
|
||||||
updatedAt?: string,
|
updatedAt?: string,
|
||||||
|
jsonlPath?: string | null,
|
||||||
): void {
|
): void {
|
||||||
const db = getConnection();
|
const db = getConnection();
|
||||||
const createdAtValue = normalizeTimestamp(createdAt);
|
const createdAtValue = normalizeTimestamp(createdAt);
|
||||||
@@ -76,13 +77,22 @@ export const sessionsDb = {
|
|||||||
workspaceOriginalPathsDb.createWorkspacePath(normalizedWorkspacePath);
|
workspaceOriginalPathsDb.createWorkspacePath(normalizedWorkspacePath);
|
||||||
|
|
||||||
db.prepare(
|
db.prepare(
|
||||||
`INSERT INTO sessions (session_id, provider, custom_name, workspace_path, created_at, updated_at)
|
`INSERT INTO sessions (session_id, provider, custom_name, workspace_path, jsonl_path, created_at, updated_at)
|
||||||
VALUES (?, ?, ?, ?, COALESCE(?, CURRENT_TIMESTAMP), COALESCE(?, CURRENT_TIMESTAMP))
|
VALUES (?, ?, ?, ?, ?, COALESCE(?, CURRENT_TIMESTAMP), COALESCE(?, CURRENT_TIMESTAMP))
|
||||||
ON CONFLICT(session_id) DO UPDATE SET
|
ON CONFLICT(session_id) DO UPDATE SET
|
||||||
updated_at = excluded.updated_at,
|
updated_at = excluded.updated_at,
|
||||||
workspace_path = excluded.workspace_path
|
workspace_path = excluded.workspace_path,
|
||||||
|
jsonl_path = excluded.jsonl_path
|
||||||
WHERE sessions.provider = excluded.provider`
|
WHERE sessions.provider = excluded.provider`
|
||||||
).run(session_id, provider, customName, normalizedWorkspacePath, createdAtValue, updatedAtValue);
|
).run(
|
||||||
|
session_id,
|
||||||
|
provider,
|
||||||
|
customName,
|
||||||
|
normalizedWorkspacePath,
|
||||||
|
jsonlPath ?? null,
|
||||||
|
createdAtValue,
|
||||||
|
updatedAtValue,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Updates a custom session name by session id, regardless of provider. */
|
/** Updates a custom session name by session id, regardless of provider. */
|
||||||
@@ -109,7 +119,7 @@ export const sessionsDb = {
|
|||||||
const db = getConnection();
|
const db = getConnection();
|
||||||
const row = db
|
const row = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT session_id, provider, workspace_path, created_at, updated_at
|
`SELECT session_id, provider, workspace_path, jsonl_path, created_at, updated_at
|
||||||
FROM sessions
|
FROM sessions
|
||||||
WHERE session_id = ?`
|
WHERE session_id = ?`
|
||||||
)
|
)
|
||||||
@@ -122,7 +132,7 @@ export const sessionsDb = {
|
|||||||
const db = getConnection();
|
const db = getConnection();
|
||||||
return db
|
return db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT session_id, provider, workspace_path, custom_name, created_at, updated_at
|
`SELECT session_id, provider, workspace_path, jsonl_path, custom_name, created_at, updated_at
|
||||||
FROM sessions`
|
FROM sessions`
|
||||||
)
|
)
|
||||||
.all() as SessionsRow[];
|
.all() as SessionsRow[];
|
||||||
@@ -132,7 +142,7 @@ export const sessionsDb = {
|
|||||||
const db = getConnection();
|
const db = getConnection();
|
||||||
return db
|
return db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT session_id, provider, workspace_path, custom_name, created_at, updated_at
|
`SELECT session_id, provider, workspace_path, jsonl_path, custom_name, created_at, updated_at
|
||||||
FROM sessions
|
FROM sessions
|
||||||
WHERE workspace_path = ?`
|
WHERE workspace_path = ?`
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ CREATE TABLE IF NOT EXISTS sessions (
|
|||||||
provider TEXT NOT NULL,
|
provider TEXT NOT NULL,
|
||||||
custom_name TEXT,
|
custom_name TEXT,
|
||||||
workspace_path TEXT NOT NULL,
|
workspace_path TEXT NOT NULL,
|
||||||
|
jsonl_path TEXT,
|
||||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
FOREIGN KEY (workspace_path) REFERENCES workspace_original_paths(workspace_path)
|
FOREIGN KEY (workspace_path) REFERENCES workspace_original_paths(workspace_path)
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export type SessionsRow = {
|
|||||||
session_id: string;
|
session_id: string;
|
||||||
provider: LLMProvider;
|
provider: LLMProvider;
|
||||||
workspace_path: string;
|
workspace_path: string;
|
||||||
|
jsonl_path: string | null;
|
||||||
custom_name: string | null;
|
custom_name: string | null;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ export type SessionData = {
|
|||||||
sessionId: string;
|
sessionId: string;
|
||||||
workspacePath: string;
|
workspacePath: string;
|
||||||
sessionName?: string;
|
sessionName?: string;
|
||||||
|
jsonlPath?: string | null;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user