feat: Implement hard delete for LlmLog items older than 3 days when billing is enabled; refactor LlmLogsTable by removing unused fields and action buttons

This commit is contained in:
Nawaz Dhandala
2025-12-16 10:25:31 +00:00
parent 931a5f9e63
commit 5652298f38
2 changed files with 4 additions and 45 deletions

View File

@@ -1,9 +1,13 @@
import DatabaseService from "./DatabaseService";
import Model from "../../Models/DatabaseModels/LlmLog";
import { IsBillingEnabled } from "../EnvironmentConfig";
export class Service extends DatabaseService<Model> {
public constructor() {
super(Model);
if (IsBillingEnabled) {
this.hardDeleteItemsOlderThanInDays("createdAt", 3);
}
}
}

View File

@@ -36,23 +36,6 @@ const LlmLogsTable: FunctionComponent<LlmLogsTableProps> = (
type: FieldType.Text,
noValueMessage: "-",
},
{
field: { llmType: true },
title: "Type",
type: FieldType.Text,
noValueMessage: "-",
},
{
field: { modelName: true },
title: "Model",
type: FieldType.Text,
noValueMessage: "-",
},
{
field: { isGlobalProvider: true },
title: "Global",
type: FieldType.Boolean,
},
{
field: { feature: true },
title: "Feature",
@@ -164,8 +147,6 @@ const LlmLogsTable: FunctionComponent<LlmLogsTableProps> = (
...(props.query || {}),
}}
selectMoreFields={{
requestPrompt: true,
responsePreview: true,
statusMessage: true,
}}
cardProps={{
@@ -183,32 +164,6 @@ const LlmLogsTable: FunctionComponent<LlmLogsTableProps> = (
columns={defaultColumns}
filters={defaultFilters}
actionButtons={[
{
title: "View Request",
buttonStyleType: ButtonStyleType.NORMAL,
icon: IconProp.List,
onClick: async (item: LlmLog, onCompleteAction: VoidFunction) => {
setModalText(
(item["requestPrompt"] as string) || "No request data",
);
setModalTitle("Request Prompt");
setShowModal(true);
onCompleteAction();
},
},
{
title: "View Response",
buttonStyleType: ButtonStyleType.NORMAL,
icon: IconProp.File,
onClick: async (item: LlmLog, onCompleteAction: VoidFunction) => {
setModalText(
(item["responsePreview"] as string) || "No response data",
);
setModalTitle("Response Preview");
setShowModal(true);
onCompleteAction();
},
},
{
title: "View Error",
buttonStyleType: ButtonStyleType.NORMAL,