mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 10:08:27 +00:00
fix: ui fixes
This commit is contained in:
parent
654de54ab9
commit
c1c93e0cb1
@ -41,7 +41,7 @@ export const LogOptions = ({ id }: LogOptionsProps) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (deleteFetcher.state === "idle" && deleteFetcher.data?.success) {
|
||||
redirect(`/home/logs`);
|
||||
redirect(`/home/inbox`);
|
||||
}
|
||||
}, [deleteFetcher.state, deleteFetcher.data]);
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ import {
|
||||
import {
|
||||
Activity,
|
||||
Columns3,
|
||||
Inbox,
|
||||
LayoutGrid,
|
||||
MessageSquare,
|
||||
Network,
|
||||
@ -24,7 +25,12 @@ import { ConversationList } from "../conversation";
|
||||
const data = {
|
||||
navMain: [
|
||||
{
|
||||
title: "Conversation",
|
||||
title: "Inbox",
|
||||
url: "/home/inbox",
|
||||
icon: Inbox,
|
||||
},
|
||||
{
|
||||
title: "Chat",
|
||||
url: "/home/conversation",
|
||||
icon: MessageSquare,
|
||||
},
|
||||
@ -38,11 +44,6 @@ const data = {
|
||||
url: "/home/space",
|
||||
icon: Columns3,
|
||||
},
|
||||
{
|
||||
title: "Activity",
|
||||
url: "/home/logs",
|
||||
icon: Activity,
|
||||
},
|
||||
{
|
||||
title: "Integrations",
|
||||
url: "/home/integrations",
|
||||
|
||||
@ -11,7 +11,6 @@ import { ContributionGraph } from "~/components/activity/contribution-graph";
|
||||
export default function LogsAll() {
|
||||
const [selectedSource, setSelectedSource] = useState<string | undefined>();
|
||||
const [selectedStatus, setSelectedStatus] = useState<string | undefined>();
|
||||
const contributionFetcher = useFetcher<any>();
|
||||
|
||||
const {
|
||||
logs,
|
||||
@ -26,35 +25,10 @@ export default function LogsAll() {
|
||||
status: selectedStatus,
|
||||
});
|
||||
|
||||
// Fetch contribution data on mount
|
||||
useEffect(() => {
|
||||
if (contributionFetcher.state === "idle" && !contributionFetcher.data) {
|
||||
contributionFetcher.load("/api/v1/activity/contribution");
|
||||
}
|
||||
}, [contributionFetcher]);
|
||||
|
||||
// Get contribution data from fetcher
|
||||
const contributionData = contributionFetcher.data?.success
|
||||
? contributionFetcher.data.data.contributionData
|
||||
: [];
|
||||
const totalActivities = contributionFetcher.data?.success
|
||||
? contributionFetcher.data.data.totalActivities
|
||||
: 0;
|
||||
const isContributionLoading =
|
||||
contributionFetcher.state === "loading" || !contributionFetcher.data;
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title="Logs" />
|
||||
<PageHeader title="Inbox" />
|
||||
<div className="flex h-[calc(100vh_-_56px)] w-full flex-col items-center space-y-6 py-4">
|
||||
{/* Contribution Graph */}
|
||||
<div className="mb-0 w-full max-w-5xl px-4">
|
||||
{isContributionLoading ? (
|
||||
<LoaderCircle className="text-primary h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<ContributionGraph data={contributionData} />
|
||||
)}
|
||||
</div>
|
||||
{isInitialLoad ? (
|
||||
<>
|
||||
<LoaderCircle className="text-primary h-4 w-4 animate-spin" />
|
||||
@ -24,7 +24,7 @@ import { parse } from "@conform-to/zod";
|
||||
import { type RawTriplet } from "~/components/graph/type";
|
||||
import { addToQueue } from "~/lib/ingest.server";
|
||||
import { EpisodeType } from "@core/types";
|
||||
import { activityPath } from "~/utils/pathBuilder";
|
||||
import { inboxPath } from "~/utils/pathBuilder";
|
||||
|
||||
const schema = z.object({
|
||||
answers: z.string(),
|
||||
@ -34,7 +34,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
const user = await requireUser(request);
|
||||
|
||||
if (user.onboardingComplete) {
|
||||
return redirect(activityPath());
|
||||
return redirect(inboxPath());
|
||||
}
|
||||
|
||||
return json({ user });
|
||||
@ -76,7 +76,7 @@ export async function action({ request }: ActionFunctionArgs) {
|
||||
userId,
|
||||
);
|
||||
|
||||
return redirect("/home/logs");
|
||||
return redirect("/home/inbox");
|
||||
} catch (e: any) {
|
||||
return json({ errors: { body: e.message } }, { status: 400 });
|
||||
}
|
||||
|
||||
@ -43,3 +43,44 @@ export async function getEpisodeFacts(episodeUuid: string, userId: string) {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDocumentFacts(documentId: string, userId: string) {
|
||||
try {
|
||||
const facts = await getEpisodeStatements({
|
||||
episodeUuid,
|
||||
userId,
|
||||
});
|
||||
|
||||
const invalidFacts = await getStatementsInvalidatedByEpisode({
|
||||
episodeUuid,
|
||||
userId,
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
facts: facts.map((fact) => ({
|
||||
uuid: fact.uuid,
|
||||
fact: fact.fact,
|
||||
createdAt: fact.createdAt.toISOString(),
|
||||
validAt: fact.validAt.toISOString(),
|
||||
invalidAt: fact.invalidAt ? fact.invalidAt.toISOString() : null,
|
||||
attributes: fact.attributes,
|
||||
})),
|
||||
invalidFacts: invalidFacts.map((fact) => ({
|
||||
uuid: fact.uuid,
|
||||
fact: fact.fact,
|
||||
createdAt: fact.createdAt.toISOString(),
|
||||
validAt: fact.validAt.toISOString(),
|
||||
invalidAt: fact.invalidAt ? fact.invalidAt.toISOString() : null,
|
||||
attributes: fact.attributes,
|
||||
})),
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching episode facts:", error);
|
||||
return {
|
||||
success: false,
|
||||
error: "Failed to fetch episode facts",
|
||||
facts: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,6 +297,8 @@ export class KnowledgeGraphService {
|
||||
previousEpisodes,
|
||||
);
|
||||
|
||||
console.log(extractedNodes.map((node) => node.name));
|
||||
|
||||
const extractedTime = Date.now();
|
||||
logger.log(`Extracted entities in ${extractedTime - normalizedTime} ms`);
|
||||
|
||||
@ -440,6 +442,7 @@ export class KnowledgeGraphService {
|
||||
let entities: EntityNode[] = [];
|
||||
|
||||
const outputMatch = responseText.match(/<output>([\s\S]*?)<\/output>/);
|
||||
|
||||
if (outputMatch && outputMatch[1]) {
|
||||
responseText = outputMatch[1].trim();
|
||||
const extractedEntities = JSON.parse(responseText || "{}").entities || [];
|
||||
|
||||
@ -113,7 +113,6 @@ You are given a conversation context and a CURRENT EPISODE. Your task is to extr
|
||||
- Text: "authentication system" → ❌ Extract: "authentication system" (should be "Authentication", "System")
|
||||
- Text: "payment service" → ❌ Extract: "payment service" (should be "Payment", "Service")
|
||||
|
||||
Format your response as a JSON object with the following structure:
|
||||
<output>
|
||||
{
|
||||
"entities": [
|
||||
|
||||
@ -14,8 +14,8 @@ export function dashboardPath() {
|
||||
return `/home/dashboard`;
|
||||
}
|
||||
|
||||
export function activityPath() {
|
||||
return `/home/logs`;
|
||||
export function inboxPath() {
|
||||
return `/home/inbox`;
|
||||
}
|
||||
|
||||
export function conversationPath() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user