Skip to content

Commit

Permalink
feat: display logs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulclindo committed Dec 18, 2024
1 parent 360b07f commit 44709da
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions apps/shinkai-desktop/src/windows/shinkai-node-manager/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { z } from 'zod';

import logo from '../../../src-tauri/icons/[email protected]';
import { OllamaModels } from '../../components/shinkai-node-manager/ollama-models';
import { useRetrieveLogsQuery } from '../../lib/shinkai-logs/logs-client';
import { ALLOWED_OLLAMA_MODELS } from '../../lib/shinkai-node-manager/ollama-models';
import {
shinkaiNodeQueryClient,
Expand Down Expand Up @@ -84,6 +85,7 @@ const App = () => {
const setLogout = useAuth((auth) => auth.setLogout);
const { setShinkaiNodeOptions } = useShinkaiNodeManager();
const logsScrollRef = useRef<HTMLDivElement | null>(null);
const tauriLogsScrollRef = useRef<HTMLDivElement | null>(null);
const [isConfirmResetDialogOpened, setIsConfirmResetDialogOpened] =
useState<boolean>(false);
const { data: shinkaiNodeIsRunning } = useShinkaiNodeIsRunningQuery({
Expand All @@ -94,10 +96,11 @@ const App = () => {
});
const { data: lastNLogs } = useShinkaiNodeGetLastNLogsQuery(
{ length: 100 },
{
refetchInterval: 1000,
},
{ refetchInterval: 1000 },
);

const { data: tauriLogs } = useRetrieveLogsQuery();

const {
isPending: shinkaiNodeSpawnIsPending,
mutateAsync: shinkaiNodeSpawn,
Expand Down Expand Up @@ -314,7 +317,19 @@ const App = () => {
>
<TabsList className="w-full">
<TabsTrigger className="grow" value="logs">
Logs
Shinkai Node Logs
</TabsTrigger>
<TabsTrigger
className="grow"
onClick={() => {
tauriLogsScrollRef.current?.scrollIntoView({
behavior: 'smooth',
block: 'end',
});
}}
value="tauri-logs"
>
Tauri Logs
</TabsTrigger>
<TabsTrigger className="grow" value="options">
Options
Expand Down Expand Up @@ -342,6 +357,16 @@ const App = () => {
</div>
</ScrollArea>
</TabsContent>
<TabsContent className="h-full overflow-hidden" value="tauri-logs">
<ScrollArea className="flex h-full flex-1 flex-col overflow-auto [&>div>div]:!block">
<div
className="text-gray-80 whitespace-pre-wrap p-1 font-mono text-xs leading-relaxed"
ref={tauriLogsScrollRef}
>
{tauriLogs}
</div>
</ScrollArea>
</TabsContent>
<TabsContent className="h-full overflow-hidden" value="options">
<ScrollArea className="flex h-full flex-1 flex-col overflow-auto [&>div>div]:!block">
<div className="flex flex-row justify-end pr-4">
Expand Down

0 comments on commit 44709da

Please sign in to comment.