cleanup
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
export { ChatPanel } from './ChatPanel';
|
||||
export { EmbeddableChat, usePi, ChatList } from 'apps/Chat';
|
||||
export type { Attachment } from 'apps/Chat';
|
||||
+8
-8
@@ -11,7 +11,7 @@ type ChatPanelProps = {
|
||||
chat: UsePiType;
|
||||
};
|
||||
|
||||
export const ChatPanel = ({ chat }: ChatPanelProps) => {
|
||||
export const ChatScreen = ({ chat }: ChatPanelProps) => {
|
||||
const { isConnected, isGenerating, sessionId, setSelectedModel, sendPrompt } = chat;
|
||||
|
||||
const location = useLocation();
|
||||
@@ -31,16 +31,16 @@ export const ChatPanel = ({ chat }: ChatPanelProps) => {
|
||||
attachmentIds?: string[];
|
||||
images?: { filename: string; dataUrl: string }[];
|
||||
} | null;
|
||||
|
||||
|
||||
const initialMessage = locationState?.initialMessage
|
||||
? {
|
||||
text: locationState.initialMessage,
|
||||
attachmentIds: locationState.attachmentIds,
|
||||
images: locationState.images,
|
||||
cwd: locationState.cwd,
|
||||
}
|
||||
text: locationState.initialMessage,
|
||||
attachmentIds: locationState.attachmentIds,
|
||||
images: locationState.images,
|
||||
cwd: locationState.cwd,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
|
||||
const defaultInput = locationState?.prefillInput ?? '';
|
||||
const initialModel = locationState?.model ?? null;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './ChatScreen';
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import type { LayoutNode } from '@/components/Workspace';
|
||||
import { WorkspaceLayout } from '@/components/Workspace';
|
||||
import { WorkspaceView } from '@/components/Workspace';
|
||||
import { appRegistry } from '../Workspaces/app-registry';
|
||||
|
||||
const initialLayout: LayoutNode = {
|
||||
@@ -30,7 +30,7 @@ export const HomeScreen = () => {
|
||||
|
||||
return (
|
||||
<div className="h-full w-full">
|
||||
<WorkspaceLayout layout={layout} onLayoutChange={setLayout} registry={appRegistry} />
|
||||
<WorkspaceView layout={layout} onLayoutChange={setLayout} registry={appRegistry} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -5,7 +5,6 @@ import { WorkspaceView, createDefaultLayout } from '@/components/Workspace';
|
||||
import type { LayoutNode } from '@/components/Workspace';
|
||||
import { appRegistry } from '../Workspaces/app-registry';
|
||||
|
||||
const defaultLayout: LayoutNode = { type: 'panel', id: 'terminal-root', appType: 'terminal-host' };
|
||||
|
||||
export const TerminalScreen = () => {
|
||||
const { user } = useAuth();
|
||||
@@ -15,7 +14,17 @@ export const TerminalScreen = () => {
|
||||
|
||||
return (
|
||||
<div className="h-full w-full">
|
||||
<WorkspaceView workspace={null} layout={layout} onLayoutChange={setLayout} registry={appRegistry} />
|
||||
<WorkspaceView
|
||||
workspace={null}
|
||||
layout={layout}
|
||||
onLayoutChange={setLayout}
|
||||
registry={appRegistry} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const defaultLayout: LayoutNode = {
|
||||
type: 'panel',
|
||||
id: 'terminal-screen',
|
||||
appType: 'terminal-host'
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useWorkspacesState } from '@/state/useWorkspacesState';
|
||||
import { usePanelChannel } from 'hooks/usePanelChannel';
|
||||
import { FileViewerProvider, FileViewerHeader, FileViewerBody } from 'apps/FileViewer';
|
||||
import { usePi } from 'apps/Chat';
|
||||
import { ChatPanel } from '../Chat/ChatPanel';
|
||||
import { ChatPanel } from 'apps/Chat';
|
||||
import { useVisiblePiModels } from '@/state/useModels';
|
||||
import { ChatHistoryApp as ChatHistory } from '../ChatHistory';
|
||||
import { Files } from '../Files';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export * from './Layout';
|
||||
export * from './Home';
|
||||
export * from './Chat';
|
||||
export * from './ChatScreen';
|
||||
export * from './OnboardingAdmin';
|
||||
export * from './PasskeyGate';
|
||||
export * from './Plans';
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
export type UserSettings = {
|
||||
chat: {
|
||||
defaultProvider: 'pi';
|
||||
defaultModel: string | null;
|
||||
systemPrompt: string;
|
||||
temperature: number;
|
||||
defaultPwd: string;
|
||||
};
|
||||
ai: {
|
||||
enabledModels: string[];
|
||||
enabledProviders: string[];
|
||||
};
|
||||
tasks: {
|
||||
defaultProvider: 'pi';
|
||||
defaultModel: string | null;
|
||||
};
|
||||
appearance: {
|
||||
colorMode: 'light' | 'dark';
|
||||
colorTheme: string;
|
||||
};
|
||||
languages: {
|
||||
spoken: string[];
|
||||
default: string;
|
||||
translateTo: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type UserState = Record<string, unknown>;
|
||||
|
||||
export const DEFAULT_SETTINGS: UserSettings = {
|
||||
chat: {
|
||||
defaultProvider: 'pi',
|
||||
defaultModel: null,
|
||||
systemPrompt: '',
|
||||
temperature: 1,
|
||||
defaultPwd: '~',
|
||||
},
|
||||
ai: {
|
||||
enabledModels: [],
|
||||
enabledProviders: [],
|
||||
},
|
||||
tasks: {
|
||||
defaultProvider: 'pi',
|
||||
defaultModel: null,
|
||||
},
|
||||
appearance: {
|
||||
colorMode: 'light',
|
||||
colorTheme: 'DuckPond',
|
||||
},
|
||||
languages: {
|
||||
spoken: ['en'],
|
||||
default: 'en',
|
||||
translateTo: 'en',
|
||||
},
|
||||
};
|
||||
@@ -3,23 +3,6 @@ import { useAuth } from 'hooks/useAuth';
|
||||
import { useClient } from 'hooks/useClient';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
type SessionWithMessages = {
|
||||
id: string;
|
||||
title: string;
|
||||
model: string;
|
||||
cwd: string;
|
||||
groupSlug?: string | null;
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
messageCount: number;
|
||||
cost: {
|
||||
inputTokens: number;
|
||||
outputTokens: number;
|
||||
totalUSD: number;
|
||||
};
|
||||
messages: Message[];
|
||||
};
|
||||
|
||||
export function useChatSessions() {
|
||||
const client = useClient();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -65,3 +48,22 @@ export function useChatSessions() {
|
||||
searchSessions,
|
||||
};
|
||||
}
|
||||
|
||||
export type UseChatSessionsType = ReturnType<typeof useChatSessions>;
|
||||
|
||||
type SessionWithMessages = {
|
||||
id: string;
|
||||
title: string;
|
||||
model: string;
|
||||
cwd: string;
|
||||
groupSlug?: string | null;
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
messageCount: number;
|
||||
cost: {
|
||||
inputTokens: number;
|
||||
outputTokens: number;
|
||||
totalUSD: number;
|
||||
};
|
||||
messages: Message[];
|
||||
};
|
||||
|
||||
@@ -2,8 +2,6 @@ import { useCallback } from 'react';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { useClient } from 'hooks/useClient';
|
||||
import { useAuth } from 'hooks/useAuth';
|
||||
import type { UserSettings } from './types/user-settings';
|
||||
import { DEFAULT_SETTINGS } from './types/user-settings';
|
||||
|
||||
const QUERY_KEY = ['USER_SETTINGS'];
|
||||
|
||||
@@ -43,3 +41,61 @@ export const useSettings = () => {
|
||||
|
||||
return { settings, saveSettings };
|
||||
};
|
||||
|
||||
export type UseSettingsType = ReturnType<typeof useSettings>;
|
||||
|
||||
export type UserSettings = {
|
||||
chat: {
|
||||
defaultProvider: 'pi';
|
||||
defaultModel: string | null;
|
||||
systemPrompt: string;
|
||||
temperature: number;
|
||||
defaultPwd: string;
|
||||
};
|
||||
ai: {
|
||||
enabledModels: string[];
|
||||
enabledProviders: string[];
|
||||
};
|
||||
tasks: {
|
||||
defaultProvider: 'pi';
|
||||
defaultModel: string | null;
|
||||
};
|
||||
appearance: {
|
||||
colorMode: 'light' | 'dark';
|
||||
colorTheme: string;
|
||||
};
|
||||
languages: {
|
||||
spoken: string[];
|
||||
default: string;
|
||||
translateTo: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type UserState = Record<string, unknown>;
|
||||
|
||||
export const DEFAULT_SETTINGS: UserSettings = {
|
||||
chat: {
|
||||
defaultProvider: 'pi',
|
||||
defaultModel: null,
|
||||
systemPrompt: '',
|
||||
temperature: 1,
|
||||
defaultPwd: '~',
|
||||
},
|
||||
ai: {
|
||||
enabledModels: [],
|
||||
enabledProviders: [],
|
||||
},
|
||||
tasks: {
|
||||
defaultProvider: 'pi',
|
||||
defaultModel: null,
|
||||
},
|
||||
appearance: {
|
||||
colorMode: 'light',
|
||||
colorTheme: 'DuckPond',
|
||||
},
|
||||
languages: {
|
||||
spoken: ['en'],
|
||||
default: 'en',
|
||||
translateTo: 'en',
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user