Text chats

This commit is contained in:
Alex Gleason committed 2025-12-03 01:05:00 -06:00
1 parent 02dcd5cbe8
commit ab039d2fb7
20 files changed
+944 -158

No files matched your search

+6 -1
View File
@@ -48,7 +48,7 @@ const queryClient = new QueryClient({
});
// Get OS-specific default paths for Electron
function getElectronDefaultPaths(): { fsPathProjects: string; fsPathConfig: string; fsPathTmp: string; fsPathPlugins: string; fsPathTemplates: string } {
function getElectronDefaultPaths(): { fsPathProjects: string; fsPathConfig: string; fsPathTmp: string; fsPathPlugins: string; fsPathTemplates: string; fsPathChats: string } {
if (!globalThis.electron) {
// Browser defaults - use virtual filesystem paths
return {
@@ -57,6 +57,7 @@ function getElectronDefaultPaths(): { fsPathProjects: string; fsPathConfig: stri
fsPathTmp: "/tmp",
fsPathPlugins: "/plugins",
fsPathTemplates: "/templates",
fsPathChats: "/chats",
};
}
@@ -72,6 +73,7 @@ function getElectronDefaultPaths(): { fsPathProjects: string; fsPathConfig: stri
fsPathTmp: "~/AppData/Local/Temp/shakespeare",
fsPathPlugins: "~/AppData/Local/shakespeare/plugins",
fsPathTemplates: "~/AppData/Local/shakespeare/templates",
fsPathChats: "~/Documents/Chats",
};
} else if (platform.includes('mac')) {
// macOS
@@ -81,6 +83,7 @@ function getElectronDefaultPaths(): { fsPathProjects: string; fsPathConfig: stri
fsPathTmp: "/tmp/shakespeare",
fsPathPlugins: "~/Library/Application Support/shakespeare/plugins",
fsPathTemplates: "~/Library/Application Support/shakespeare/templates",
fsPathChats: "~/Chats",
};
} else {
// Linux and other Unix-like systems
@@ -90,6 +93,7 @@ function getElectronDefaultPaths(): { fsPathProjects: string; fsPathConfig: stri
fsPathTmp: "/tmp/shakespeare",
fsPathPlugins: "~/.config/shakespeare/plugins",
fsPathTemplates: "~/.config/shakespeare/templates",
fsPathChats: "~/Chats",
};
}
}
@@ -135,6 +139,7 @@ const defaultConfig: AppConfig = {
fsPathTmp: electronPaths.fsPathTmp,
fsPathPlugins: electronPaths.fsPathPlugins,
fsPathTemplates: electronPaths.fsPathTemplates,
fsPathChats: electronPaths.fsPathChats,
sentryDsn: import.meta.env.VITE_SENTRY_DSN || "",
sentryEnabled: true,
};
+2
View File
@@ -21,6 +21,7 @@ import VercelOAuth from "./pages/VercelOAuth";
import { NIP19Page } from "./pages/NIP19Page";
import NotFound from "./pages/NotFound";
import { ProjectView } from "./pages/ProjectView";
import { ChatView } from "./pages/ChatView";
import { SettingsLayout } from "./components/SettingsLayout";
export function AppRouter() {
@@ -51,6 +52,7 @@ export function AppRouter() {
<Route path="about" element={<AboutSettings />} />
</Route>
<Route path="/project/:projectId" element={<ProjectView />} />
<Route path="/chat/:chatId" element={<ChatView />} />
{/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */}
<Route path="/:nip19" element={<NIP19Page />} />
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
+59 -49
View File
@@ -27,6 +27,7 @@ interface ActionsMenuProps {
isBuildLoading?: boolean;
disabled?: boolean;
onFirstInteraction?: () => void;
isChat?: boolean; // Flag to indicate this is a chat, not a project
}
export function ActionsMenu({
@@ -38,6 +39,7 @@ export function ActionsMenu({
isBuildLoading = false,
disabled = false,
onFirstInteraction: _onFirstInteraction,
isChat = false,
}: ActionsMenuProps) {
const [gitHistoryOpen, setGitHistoryOpen] = useState(false);
const [gitDialogOpen, setGitDialogOpen] = useState(false);
@@ -71,65 +73,73 @@ export function ActionsMenu({
New Chat
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setGitHistoryOpen(true)}
disabled={isAnyLoading}
className="gap-2"
>
<History className="h-4 w-4" />
Rollback
</DropdownMenuItem>
{!isChat && (
<>
<DropdownMenuItem
onClick={() => setGitHistoryOpen(true)}
disabled={isAnyLoading}
className="gap-2"
>
<History className="h-4 w-4" />
Rollback
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setGitDialogOpen(true)}
disabled={isAnyLoading}
className="gap-2"
>
<GitBranch className="h-4 w-4" />
Repository
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setGitDialogOpen(true)}
disabled={isAnyLoading}
className="gap-2"
>
<GitBranch className="h-4 w-4" />
Repository
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setDeployDialogOpen(true)}
disabled={isAnyLoading}
className="gap-2"
>
<Rocket className="h-4 w-4" />
Deploy
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setDeployDialogOpen(true)}
disabled={isAnyLoading}
className="gap-2"
>
<Rocket className="h-4 w-4" />
Deploy
</DropdownMenuItem>
<DropdownMenuItem
onClick={onProjectDetails}
disabled={isAnyLoading}
className="gap-2"
>
<Folder className="h-4 w-4" />
Project Details
</DropdownMenuItem>
<DropdownMenuItem
onClick={onProjectDetails}
disabled={isAnyLoading}
className="gap-2"
>
<Folder className="h-4 w-4" />
Project Details
</DropdownMenuItem>
</>
)}
</DropdownMenuContent>
</DropdownMenu>
{/* Dialogs */}
<GitDialog
projectId={projectId}
open={gitDialogOpen}
onOpenChange={setGitDialogOpen}
/>
{/* Dialogs - only show for projects, not chats */}
{!isChat && (
<>
<GitDialog
projectId={projectId}
open={gitDialogOpen}
onOpenChange={setGitDialogOpen}
/>
<GitHistoryDialog
projectId={projectId}
open={gitHistoryOpen}
onOpenChange={setGitHistoryOpen}
/>
<GitHistoryDialog
projectId={projectId}
open={gitHistoryOpen}
onOpenChange={setGitHistoryOpen}
/>
<DeployDialog
projectId={projectId}
projectName={projectName}
open={deployDialogOpen}
onOpenChange={setDeployDialogOpen}
/>
<DeployDialog
projectId={projectId}
projectName={projectName}
open={deployDialogOpen}
onOpenChange={setDeployDialogOpen}
/>
</>
)}
</>
);
+2
View File
@@ -47,6 +47,7 @@ const AppConfigSchema = z.object({
fsPathTmp: z.string().min(1),
fsPathPlugins: z.string().min(1),
fsPathTemplates: z.string().min(1),
fsPathChats: z.string().min(1),
sentryDsn: z.string(),
sentryEnabled: z.boolean(),
}) satisfies z.ZodType<AppConfig>;
@@ -85,6 +86,7 @@ export function AppProvider(props: AppProviderProps) {
config.fsPathTmp = expandPath(config.fsPathTmp);
config.fsPathPlugins = expandPath(config.fsPathPlugins);
config.fsPathTemplates = expandPath(config.fsPathTemplates);
config.fsPathChats = expandPath(config.fsPathChats);
const appContextValue: AppContextType = {
config,
+99 -15
View File
@@ -1,16 +1,18 @@
import React, { useEffect, useState, useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { Plus, Folder, GitBranch, Loader2, ChevronDown, Star, Columns2, X, Settings, HelpCircle, Search } from 'lucide-react';
import { Plus, Folder, GitBranch, Loader2, ChevronDown, Star, Columns2, X, Settings, HelpCircle, Search, MessageSquare } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';
import { Input } from '@/components/ui/input';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
import { useProjects } from '@/hooks/useProjects';
import { useChats } from '@/hooks/useChats';
import { useProjectSessionStatus } from '@/hooks/useProjectSessionStatus';
import { useLocalStorage } from '@/hooks/useLocalStorage';
import { useIsMobile } from '@/hooks/useIsMobile';
import type { Project } from '@/lib/ProjectsManager';
import type { Chat } from '@/lib/ChatsManager';
import { cn } from '@/lib/utils';
import { useQueryClient } from '@tanstack/react-query';
import { ShakespeareLogo } from '@/components/ShakespeareLogo';
@@ -75,6 +77,51 @@ const ProjectItem: React.FC<ProjectItemProps> = ({ project, isSelected, onSelect
ProjectItem.displayName = 'ProjectItem';
interface ChatItemProps {
chat: Chat;
isSelected: boolean;
onSelect: (chat: Chat) => void;
}
const ChatItem: React.FC<ChatItemProps> = ({ chat, isSelected, onSelect }) => {
const navigate = useNavigate();
const handleClick = () => {
onSelect(chat);
navigate(`/chat/${chat.id}`);
};
return (
<div
className={cn(
"group relative rounded-lg transition-all duration-200 hover:bg-gradient-to-r hover:from-primary/10 hover:to-accent/10",
isSelected && "bg-gradient-to-r from-primary/15 to-accent/15 shadow-sm"
)}
>
<div className="w-full px-3 py-2 text-left text-sidebar-foreground">
<button
onClick={handleClick}
className="absolute inset-0"
/>
<div className="flex items-center gap-3">
<div className="flex-shrink-0">
<MessageSquare className="h-4 w-4 text-primary" />
</div>
<div className="flex justify-between gap-2 flex-1 min-w-0">
<div className="min-w-0 flex-1 flex items-center">
<h3 className="font-medium text-sm truncate">
{chat.name}
</h3>
</div>
</div>
</div>
</div>
</div>
);
};
ChatItem.displayName = 'ChatItem';
interface ProjectSidebarProps {
selectedProject: Project | null;
onSelectProject: (project: Project | null) => void;
@@ -92,14 +139,18 @@ export function ProjectSidebar({
}: ProjectSidebarProps) {
const { t } = useTranslation();
const queryClient = useQueryClient();
const { data: projects = [], isLoading, error } = useProjects();
const { data: projects = [], isLoading: isLoadingProjects, error: projectsError } = useProjects();
const { data: chats = [], isLoading: isLoadingChats, error: chatsError } = useChats();
const [favorites] = useLocalStorage<string[]>('project-favorites', []);
const [searchQuery, setSearchQuery] = useState('');
const isMobile = useIsMobile();
const navigate = useNavigate();
// Fast in-memory search filtering
const isLoading = isLoadingProjects || isLoadingChats;
const error = projectsError || chatsError;
// Fast in-memory search filtering for projects
const filteredProjects = useMemo(() => {
if (!searchQuery.trim()) {
return projects;
@@ -112,6 +163,30 @@ export function ProjectSidebar({
);
}, [projects, searchQuery]);
// Fast in-memory search filtering for chats
const filteredChats = useMemo(() => {
if (!searchQuery.trim()) {
return chats;
}
const query = searchQuery.toLowerCase();
return chats.filter(chat =>
chat.id.toLowerCase().includes(query) ||
chat.name.toLowerCase().includes(query)
);
}, [chats, searchQuery]);
// Combine projects and chats, sorted by lastModified
const combinedItems = useMemo(() => {
const items: Array<{ type: 'project' | 'chat'; item: Project | Chat; lastModified: Date }> = [
...filteredProjects.map(p => ({ type: 'project' as const, item: p, lastModified: p.lastModified })),
...filteredChats.map(c => ({ type: 'chat' as const, item: c, lastModified: c.lastModified })),
];
// Sort by lastModified (newest first)
return items.sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime());
}, [filteredProjects, filteredChats]);
// Custom navigate function that closes sidebar on mobile
const navigateAndClose = (path: string) => {
navigate(path);
@@ -212,7 +287,7 @@ export function ProjectSidebar({
</div>
{/* Search Input */}
{projects.length > 0 && (
{(projects.length > 0 || chats.length > 0) && (
<div className="relative">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" />
<Input
@@ -237,13 +312,13 @@ export function ProjectSidebar({
</div>
))}
</div>
) : projects.length === 0 ? (
) : combinedItems.length === 0 && projects.length === 0 && chats.length === 0 ? (
<div className="text-center p-6 text-muted-foreground">
<Folder className="h-8 w-8 mx-auto mb-2 opacity-50" />
<p className="text-sm">{t('noProjectsYet')}</p>
<p className="text-xs">{t('createFirstProject')}</p>
</div>
) : filteredProjects.length === 0 ? (
) : combinedItems.length === 0 ? (
<div className="text-center p-6 text-muted-foreground">
<Search className="h-8 w-8 mx-auto mb-2 opacity-50" />
<p className="text-sm">{t('noProjectsFound')}</p>
@@ -251,15 +326,24 @@ export function ProjectSidebar({
</div>
) : (
<div className="space-y-1">
{filteredProjects.map((project) => (
<ProjectItem
key={project.id}
project={project}
isSelected={selectedProject?.id === project.id}
onSelect={onSelectProject}
isFavorite={favorites.includes(project.id)}
/>
))}
{combinedItems.map(({ type, item }) =>
type === 'project' ? (
<ProjectItem
key={`project-${item.id}`}
project={item as Project}
isSelected={selectedProject?.id === item.id}
onSelect={onSelectProject}
isFavorite={favorites.includes(item.id)}
/>
) : (
<ChatItem
key={`chat-${item.id}`}
chat={item as Chat}
isSelected={false}
onSelect={() => {}}
/>
)
)}
</div>
)}
</div>
+4
View File
@@ -40,6 +40,7 @@ describe('SentryProvider', () => {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
};
render(
@@ -77,6 +78,7 @@ describe('SentryProvider', () => {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
};
render(
@@ -115,6 +117,7 @@ describe('SentryProvider', () => {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
};
render(
@@ -156,6 +159,7 @@ describe('SentryProvider', () => {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
};
render(
+22 -2
View File
@@ -59,6 +59,7 @@ interface ChatPaneProps {
isBuildLoading?: boolean;
consoleError?: ProjectPreviewConsoleError | null;
onDismissConsoleError?: () => void;
isChat?: boolean; // Flag to indicate this is a chat session, not a project
}
export interface ChatPaneRef {
@@ -72,6 +73,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
onLoadingChange,
isLoading: externalIsLoading,
isBuildLoading: externalIsBuildLoading,
isChat = false,
consoleError,
onDismissConsoleError,
}, ref) => {
@@ -143,7 +145,8 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
}, [projectId, providerModel]);
// Initialize AI chat with tools
const cwd = `${projectsPath}/${projectId}`;
const { chatsPath } = useFSPaths();
const cwd = isChat ? `${chatsPath}/${projectId}` : `${projectsPath}/${projectId}`;
const esmUrlRef = useRef(config.esmUrl);
const sessionManager = useSessionManager();
@@ -158,6 +161,23 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
// Separate built-in tools from MCP tools for clarity
const builtInTools = useMemo(() => {
// For chat mode, provide minimal tools (no project-specific tools)
if (isChat) {
const tools: Record<string, Tool<unknown>> = {
nostr_read_nip: new NostrReadNipTool(),
nostr_fetch_event: new NostrFetchEventTool(),
nostr_read_kind: new NostrReadKindTool(),
nostr_read_tag: new NostrReadTagTool(),
nostr_read_protocol: new NostrReadProtocolTool(),
nostr_read_nips_index: new NostrReadNipsIndexTool(),
nostr_generate_kind: new NostrGenerateKindTool(),
nostr_publish_events: new NostrPublishEventsTool(),
// TODO: Add start_project tool here
};
return tools;
}
// For project mode, provide full set of tools
const tools: Record<string, Tool<unknown>> = {
git_commit: new GitCommitTool(fs, cwd, git),
text_editor_view: new TextEditorViewTool(fs, cwd, { projectsPath }),
@@ -186,7 +206,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
}
return tools;
}, [fs, git, cwd, user, projectId, projectsPath, tmpPath, pluginsPath, config.corsProxy, handleFileChanged]);
}, [isChat, fs, git, cwd, user, projectId, projectsPath, tmpPath, pluginsPath, config.corsProxy, handleFileChanged]);
// MCP tools wrapped for execution
const mcpToolWrappers = useMemo(() => createMCPTools(mcpClients), [mcpClients]);
+2
View File
@@ -51,6 +51,8 @@ export interface AppConfig {
fsPathPlugins: string;
/** VFS path for templates directory */
fsPathTemplates: string;
/** VFS path for chats directory */
fsPathChats: string;
/** Sentry DSN for error reporting (empty string = disabled) */
sentryDsn: string;
/** Whether the user has enabled Sentry error reporting */
+20
View File
@@ -0,0 +1,20 @@
import { useQuery } from '@tanstack/react-query';
import { useChatsManager } from '@/hooks/useChatsManager';
import type { Chat } from '@/lib/ChatsManager';
export function useChats() {
const chatsManager = useChatsManager();
return useQuery({
queryKey: ['chats'],
queryFn: async (): Promise<Chat[]> => {
await chatsManager.init();
const chats = await chatsManager.getChats();
// Sort chats by lastModified (newest first)
return chats.sort((a, b) => {
return b.lastModified.getTime() - a.lastModified.getTime();
});
},
});
}
+16
View File
@@ -0,0 +1,16 @@
import { useMemo } from 'react';
import { useFS } from '@/hooks/useFS';
import { useFSPaths } from '@/hooks/useFSPaths';
import { ChatsManager } from '@/lib/ChatsManager';
export function useChatsManager() {
const { fs } = useFS();
const { chatsPath } = useFSPaths();
return useMemo(() => {
return new ChatsManager({
fs,
chatsPath,
});
}, [fs, chatsPath]);
}
+2
View File
@@ -19,5 +19,7 @@ export function useFSPaths() {
pluginsPath: config.fsPathPlugins,
/** Templates directory path (default: /templates) */
templatesPath: config.fsPathTemplates,
/** Chats directory path (default: /chats) */
chatsPath: config.fsPathChats,
};
}
+20 -9
View File
@@ -73,6 +73,7 @@ describe('useGenerateProjectInfo', () => {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
sentryDsn: '',
sentryEnabled: false,
};
@@ -226,6 +227,7 @@ describe('useGenerateProjectInfo', () => {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
sentryDsn: '',
sentryEnabled: false,
};
@@ -330,10 +332,13 @@ describe('useGenerateProjectInfo', () => {
const { result } = renderHook(() => useGenerateProjectInfo());
const projectInfo = await result.current.generateProjectInfo('openai/gpt-4', 'test prompt');
const generatedInfo = await result.current.generateProjectInfo('openai/gpt-4', 'test prompt');
expect(projectInfo.template.url).toBe('https://gitlab.com/soapbox-pub/mkstack.git');
expect(projectInfo.projectId).toBe('untitled');
expect(generatedInfo.type).toBe('project');
if (generatedInfo.type === 'project') {
expect(generatedInfo.info.template.url).toBe('https://gitlab.com/soapbox-pub/mkstack.git');
expect(generatedInfo.info.projectId).toBe('untitled');
}
});
it('should increment AI-generated ID when project already exists', async () => {
@@ -363,10 +368,13 @@ describe('useGenerateProjectInfo', () => {
const { result } = renderHook(() => useGenerateProjectInfo());
const projectInfo = await result.current.generateProjectInfo('openai/gpt-4', 'test prompt');
const generatedInfo = await result.current.generateProjectInfo('openai/gpt-4', 'test prompt');
expect(projectInfo.projectId).toBe('test-project-name-1');
expect(projectInfo.template.url).toBe('https://gitlab.com/soapbox-pub/mkstack.git');
expect(generatedInfo.type).toBe('project');
if (generatedInfo.type === 'project') {
expect(generatedInfo.info.projectId).toBe('test-project-name-1');
expect(generatedInfo.info.template.url).toBe('https://gitlab.com/soapbox-pub/mkstack.git');
}
expect(mockGetProject).toHaveBeenCalledTimes(2);
expect(mockGetProject).toHaveBeenNthCalledWith(1, 'test-project-name');
expect(mockGetProject).toHaveBeenNthCalledWith(2, 'test-project-name-1');
@@ -400,10 +408,13 @@ describe('useGenerateProjectInfo', () => {
const { result } = renderHook(() => useGenerateProjectInfo());
const projectInfo = await result.current.generateProjectInfo('openai/gpt-4', 'test prompt');
const generatedInfo = await result.current.generateProjectInfo('openai/gpt-4', 'test prompt');
expect(projectInfo.projectId).toBe('test-project-name-2');
expect(projectInfo.template.url).toBe('https://gitlab.com/soapbox-pub/mkstack.git');
expect(generatedInfo.type).toBe('project');
if (generatedInfo.type === 'project') {
expect(generatedInfo.info.projectId).toBe('test-project-name-2');
expect(generatedInfo.info.template.url).toBe('https://gitlab.com/soapbox-pub/mkstack.git');
}
expect(mockGetProject).toHaveBeenCalledTimes(3);
expect(mockGetProject).toHaveBeenNthCalledWith(1, 'test-project-name');
expect(mockGetProject).toHaveBeenNthCalledWith(2, 'test-project-name-1');
+119 -37
View File
@@ -20,6 +20,14 @@ interface ProjectInfo {
};
}
interface ChatInfo {
chatId: string;
}
type GeneratedInfo =
| { type: 'project'; info: ProjectInfo }
| { type: 'chat'; info: ChatInfo };
export function useGenerateProjectInfo({ onError }: UseGenerateProjectInfoOptions = {}) {
const [isLoading, setIsLoading] = useState(false);
const { settings, isConfigured } = useAISettings();
@@ -59,7 +67,7 @@ export function useGenerateProjectInfo({ onError }: UseGenerateProjectInfoOption
};
}, [projectsManager]);
const generateProjectInfo = useCallback(async (providerModel: string, prompt: string): Promise<ProjectInfo> => {
const generateProjectInfo = useCallback(async (providerModel: string, prompt: string): Promise<GeneratedInfo> => {
if (!isConfigured) {
throw new Error('AI settings not configured');
}
@@ -80,11 +88,11 @@ export function useGenerateProjectInfo({ onError }: UseGenerateProjectInfoOption
const openai = createAIClient(provider, user, config.corsProxy);
// Create project creation tool
const createProjectTool: ChatCompletionTool = {
const startProjectTool: ChatCompletionTool = {
type: 'function',
function: {
name: 'create_project',
description: 'Create a new project by choosing a name and selecting the most appropriate template. You must call this tool to create the project.',
name: 'start_project',
description: 'Start a new project by choosing a name and selecting the most appropriate template. Call this when the user wants to build an app or website.',
parameters: {
type: 'object',
properties: {
@@ -103,66 +111,136 @@ export function useGenerateProjectInfo({ onError }: UseGenerateProjectInfoOption
},
};
const systemPrompt = `You are a product expert helping users create new projects. Given the user's project description, you must:
// Create chat start tool
const startChatTool: ChatCompletionTool = {
type: 'function',
function: {
name: 'start_chat',
description: 'Start a general conversation or chat session. Call this when the user wants to have a conversation, ask questions, or discuss ideas without building a specific app.',
parameters: {
type: 'object',
properties: {
chat_name: {
type: 'string',
description: 'A short, descriptive name for the chat. Should be lowercase, use hyphens instead of spaces, and contain only alphanumeric characters and hyphens.',
},
},
required: ['chat_name'],
},
},
};
1. Generate a short, unique, and memorable name for their product or brand. The name should be lowercase, use hyphens instead of spaces, and contain only alphanumeric characters and hyphens. Avoid using special characters or underscores.
const systemPrompt = `You are an AI assistant helping users either create projects or start conversations.
2. Select the most appropriate template from the available options:
${config.templates.map(t => ` - ${t.name}: ${t.description} (${t.url})`).join('\n')}
**First and foremost, you must decide whether to create a project or start a chat:**
- If the user expresses a desire to build, create, develop, or launch an app, website, or software product, they want to start a project.
- If the user wants to have a discussion, ask questions, brainstorm ideas, or seek advice without building a specific app, they want to start a chat.
You MUST call the create_project tool with your choices.`;
1. If the user wants to **create a project** (build an app or website) - use start_project tool
- Generate a short, unique, and memorable name for their product or brand
- Name should be lowercase, use hyphens instead of spaces, and contain only alphanumeric characters and hyphens
- Select the most appropriate template from:
${config.templates.map(t => ` - ${t.name}: ${t.description} (${t.url})`).join('\n')}
2. If the user wants to **start a chat** (general conversation, questions, brainstorming) - use start_chat tool
- Generate a short, descriptive name for the chat topic
- Name should be lowercase, use hyphens instead of spaces, and contain only alphanumeric characters and hyphens
You MUST call either start_project or start_chat based on the user's intent.`;
const messages: ChatCompletionMessageParam[] = [
{ role: 'system', content: systemPrompt },
{ role: 'user', content: prompt }
];
// Call AI with tool
// Call AI with both tools
const completion = await openai.chat.completions.create({
model,
messages,
tools: [createProjectTool],
tool_choice: { type: 'function', function: { name: 'create_project' } },
tools: [startProjectTool, startChatTool],
tool_choice: "required",
temperature: 1,
});
const toolCall = completion.choices[0]?.message?.tool_calls?.[0];
if (!toolCall || toolCall.type !== 'function' || toolCall.function.name !== 'create_project') {
throw new Error('AI failed to create the project');
if (!toolCall || toolCall.type !== 'function') {
throw new Error('AI failed to determine action');
}
const args = JSON.parse(toolCall.function.arguments);
const templateUrl = args.template_url as string;
const projectId = args.project_name as string;
// Validate template URL
const selectedTemplate = config.templates.find(t => t.url === templateUrl);
if (!selectedTemplate) {
// Fallback to first template if invalid URL selected
console.warn(`Invalid template URL selected: ${templateUrl}, falling back to first template`);
return await generateIncrementedId('untitled', config.templates[0], false);
}
// Handle start_chat tool call
if (toolCall.function.name === 'start_chat') {
const chatId = args.chat_name as string;
// Validate the generated project ID
const validIdRegex = /^[a-z0-9]+(-[a-z0-9]+)*$/;
if (projectId && projectId.length <= 50 && validIdRegex.test(projectId)) {
// Check if project exists
const existingProject = await projectsManager.getProject(projectId);
if (existingProject === null) {
// Valid and unique project ID
// Validate the generated chat ID
const validIdRegex = /^[a-z0-9]+(-[a-z0-9]+)*$/;
if (chatId && chatId.length <= 50 && validIdRegex.test(chatId)) {
return {
projectId,
template: selectedTemplate,
type: 'chat',
info: { chatId },
};
}
// Project already exists - increment the AI-generated ID (baseExists = true)
return await generateIncrementedId(projectId, selectedTemplate, true);
// Fallback to auto-generated chat ID if validation fails
return {
type: 'chat',
info: { chatId: 'chat' },
};
}
// If we reach here, the regex failed - fall back to "untitled" with number suffixes
return await generateIncrementedId('untitled', selectedTemplate, false);
// Handle start_project tool call
if (toolCall.function.name === 'start_project') {
const templateUrl = args.template_url as string;
const projectId = args.project_name as string;
// Validate template URL
const selectedTemplate = config.templates.find(t => t.url === templateUrl);
if (!selectedTemplate) {
// Fallback to first template if invalid URL selected
console.warn(`Invalid template URL selected: ${templateUrl}, falling back to first template`);
const fallbackInfo = await generateIncrementedId('untitled', config.templates[0], false);
return {
type: 'project',
info: fallbackInfo,
};
}
// Validate the generated project ID
const validIdRegex = /^[a-z0-9]+(-[a-z0-9]+)*$/;
if (projectId && projectId.length <= 50 && validIdRegex.test(projectId)) {
// Check if project exists
const existingProject = await projectsManager.getProject(projectId);
if (existingProject === null) {
// Valid and unique project ID
return {
type: 'project',
info: {
projectId,
template: selectedTemplate,
},
};
}
// Project already exists - increment the AI-generated ID (baseExists = true)
const fallbackInfo = await generateIncrementedId(projectId, selectedTemplate, true);
return {
type: 'project',
info: fallbackInfo,
};
}
// If we reach here, the regex failed - fall back to "untitled" with number suffixes
const fallbackInfo = await generateIncrementedId('untitled', selectedTemplate, false);
return {
type: 'project',
info: fallbackInfo,
};
}
// Unknown tool call
throw new Error(`Unknown tool call: ${toolCall.function.name}`);
} catch (error) {
// On any error, fall back to first template with untitled name
console.error('Error generating project info:', error);
@@ -173,7 +251,11 @@ You MUST call the create_project tool with your choices.`;
throw new Error(errorMessage);
}
return await generateIncrementedId('untitled', config.templates[0], false);
const fallbackInfo = await generateIncrementedId('untitled', config.templates[0], false);
return {
type: 'project',
info: fallbackInfo,
};
} finally {
setIsLoading(false);
}
+1
View File
@@ -50,6 +50,7 @@ function createWrapper(corsProxy: string) {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
sentryDsn: '',
sentryEnabled: false,
};
+251
View File
@@ -0,0 +1,251 @@
import type { JSRuntimeFS } from '@/lib/JSRuntime';
import { DotAI } from '@/lib/DotAI';
import type OpenAI from 'openai';
export interface Chat {
id: string;
name: string;
path: string;
lastModified: Date;
}
export interface ChatsManagerOptions {
fs: JSRuntimeFS;
/** Chats directory path (default: /chats) */
chatsPath: string;
}
export class ChatsManager {
fs: JSRuntimeFS;
dir: string;
constructor(options: ChatsManagerOptions) {
this.fs = options.fs;
this.dir = options.chatsPath;
}
async init() {
try {
await this.fs.mkdir(this.dir);
} catch {
// Directory might already exist
}
}
/**
* Get all chats
*/
async getChats(): Promise<Chat[]> {
try {
const chatDirs = await this.fs.readdir(this.dir);
const chats: Chat[] = [];
for (const chatId of chatDirs) {
const chatPath = `${this.dir}/${chatId}`;
try {
const stat = await this.fs.stat(chatPath);
if (stat.isDirectory()) {
chats.push({
id: chatId,
name: chatId,
path: chatPath,
lastModified: new Date(stat.mtimeMs || Date.now()),
});
}
} catch {
// Skip if we can't stat this directory
continue;
}
}
return chats;
} catch {
return [];
}
}
/**
* Get a single chat by ID
*/
async getChat(chatId: string): Promise<Chat | null> {
try {
const chatPath = `${this.dir}/${chatId}`;
const stat = await this.fs.stat(chatPath);
if (!stat.isDirectory()) {
return null;
}
return {
id: chatId,
name: chatId,
path: chatPath,
lastModified: new Date(stat.mtimeMs || Date.now()),
};
} catch {
return null;
}
}
/**
* Create a new chat with an initial message
*/
async createChat(
chatId: string,
initialMessage: string,
): Promise<Chat> {
const chatPath = `${this.dir}/${chatId}`;
// Create the chat directory
await this.fs.mkdir(chatPath, { recursive: true });
// Create messages file with initial user message
const messagesPath = `${chatPath}/messages.jsonl`;
const userMessage: OpenAI.Chat.Completions.ChatCompletionMessageParam = {
role: 'user',
content: initialMessage,
};
await this.fs.writeFile(messagesPath, JSON.stringify(userMessage) + '\n');
const stat = await this.fs.stat(chatPath);
return {
id: chatId,
name: chatId,
path: chatPath,
lastModified: new Date(stat.mtimeMs || Date.now()),
};
}
/**
* Delete a chat
*/
async deleteChat(chatId: string): Promise<void> {
const chatPath = `${this.dir}/${chatId}`;
try {
// Recursively delete the chat directory
await this.deleteChatDirectory(chatPath);
} catch (error) {
console.error(`Failed to delete chat ${chatId}:`, error);
throw error;
}
}
/**
* Recursively delete a directory and all its contents
*/
private async deleteChatDirectory(dirPath: string): Promise<void> {
try {
const entries = await this.fs.readdir(dirPath);
for (const entry of entries) {
const entryPath = `${dirPath}/${entry}`;
const stat = await this.fs.stat(entryPath);
if (stat.isDirectory()) {
await this.deleteChatDirectory(entryPath);
} else {
await this.fs.unlink(entryPath);
}
}
await this.fs.rmdir(dirPath);
} catch (error) {
console.error(`Failed to delete directory ${dirPath}:`, error);
throw error;
}
}
/**
* Read messages from a chat
*/
async readMessages(chatId: string): Promise<OpenAI.Chat.Completions.ChatCompletionMessageParam[]> {
const messagesPath = `${this.dir}/${chatId}/messages.jsonl`;
try {
const content = await this.fs.readFile(messagesPath, 'utf8');
const lines = content.trim().split('\n').filter(line => line.trim());
const messages: OpenAI.Chat.Completions.ChatCompletionMessageParam[] = [];
for (const line of lines) {
try {
const message = JSON.parse(line) as OpenAI.Chat.Completions.ChatCompletionMessageParam;
messages.push(message);
} catch (parseError) {
console.warn('Failed to parse message from chat:', parseError);
}
}
return messages;
} catch {
return [];
}
}
/**
* Write messages to a chat
*/
async writeMessages(
chatId: string,
messages: OpenAI.Chat.Completions.ChatCompletionMessageParam[],
): Promise<void> {
const messagesPath = `${this.dir}/${chatId}/messages.jsonl`;
try {
// Convert messages to JSONL format
const jsonlContent = messages.map(message => JSON.stringify(message)).join('\n');
const finalContent = jsonlContent + (messages.length > 0 ? '\n' : '');
// Write the entire file
await this.fs.writeFile(messagesPath, finalContent);
} catch (error) {
console.warn(`Failed to write messages to chat: ${error}`);
throw error;
}
}
/**
* Append a message to a chat
*/
async appendMessage(
chatId: string,
message: OpenAI.Chat.Completions.ChatCompletionMessageParam,
): Promise<void> {
const messagesPath = `${this.dir}/${chatId}/messages.jsonl`;
try {
const messageJson = JSON.stringify(message) + '\n';
// Append to the file
try {
const existingContent = await this.fs.readFile(messagesPath, 'utf8');
await this.fs.writeFile(messagesPath, existingContent + messageJson);
} catch {
// File doesn't exist, create it
await this.fs.writeFile(messagesPath, messageJson);
}
} catch (error) {
console.warn(`Failed to append message to chat: ${error}`);
throw error;
}
}
/**
* Generate a unique chat ID
*/
static generateChatId(): string {
const now = new Date();
const dateString = now.toISOString();
// Generate a random 3-character suffix to avoid collisions
const randomSuffix = Math.random().toString(36).substring(2, 5);
// Format: YYYY-MM-DDTHH-MM-SSZ-suffix
const chatId = `${
dateString.replace(/:/g, "-").slice(0, dateString.indexOf("."))
}Z-${randomSuffix}`;
return chatId;
}
}
+1
View File
@@ -54,6 +54,7 @@ const testConfig: AppConfig = {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
sentryDsn: '',
sentryEnabled: false,
};
+1
View File
@@ -41,6 +41,7 @@ const testConfig: AppConfig = {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
sentryDsn: '',
sentryEnabled: false,
};
+239
View File
@@ -0,0 +1,239 @@
import { useState, useEffect, useCallback, useRef } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { type Chat } from '@/lib/ChatsManager';
import { useChatsManager } from '@/hooks/useChatsManager';
import { ChatPane, type ChatPaneRef } from '@/components/Shakespeare/ChatPane';
import { ProjectSidebar } from '@/components/ProjectSidebar';
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from '@/components/ui/resizable';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';
import { ArrowLeft, Menu } from 'lucide-react';
import { ActionsMenu } from '@/components/ActionsMenu';
import { useIsMobile } from '@/hooks/useIsMobile';
export function ChatView() {
const { chatId } = useParams<{ chatId: string }>();
const { t } = useTranslation();
const [chat, setChat] = useState<Chat | null>(null);
const [isLoading, setIsLoading] = useState(true);
const [isAILoading, setIsAILoading] = useState(false);
const chatsManager = useChatsManager();
const chatPaneRef = useRef<ChatPaneRef>(null);
const navigate = useNavigate();
const isMobile = useIsMobile();
const [isSidebarVisible, setIsSidebarVisible] = useState(!isMobile);
const loadChat = useCallback(async () => {
if (!chatId) return;
try {
const chatData = await chatsManager.getChat(chatId);
setChat(chatData);
} catch (error) {
console.error('Failed to load chat:', error);
} finally {
setIsLoading(false);
}
}, [chatId, chatsManager]);
useEffect(() => {
loadChat();
}, [loadChat]);
const handleNewChat = () => {
// Call the ChatPane's startNewSession function
if (chatPaneRef.current) {
chatPaneRef.current.startNewSession();
}
};
const handleAILoadingChange = (loading: boolean) => {
setIsAILoading(loading);
};
// Handle first user interaction to enable audio context
const handleFirstInteraction = () => {
// This will be handled automatically by the useKeepAlive hook
// when isAILoading becomes true after user interaction
};
const handleChatDeleted = async () => {
setChat(null);
navigate('/');
};
if (!chat && !isLoading) {
return (
<div className="min-h-screen bg-background flex items-center justify-center">
<div className="text-center">
<h1 className="text-2xl font-bold mb-2">Chat Not Found</h1>
<Button onClick={() => navigate('/')} variant="outline">
<ArrowLeft className="mr-2 h-4 w-4" />
Back to Home
</Button>
</div>
</div>
);
}
if (isMobile) {
return (
<div className="h-dvh flex flex-col bg-background">
<header className="pt-safe bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur">
<div className="h-12 border-b px-4 py-3 flex items-center justify-between">
<div className="flex items-center space-x-2 overflow-hidden">
<Button
variant="ghost"
size="sm"
onClick={() => setIsSidebarVisible(!isSidebarVisible)}
>
<Menu className="h-4 w-4" />
</Button>
<div className="flex min-w-0 flex-1">
{chat ? (
<div className="text-sm font-semibold truncate">
{chat.name}
</div>
) : (
<Skeleton className="h-5 w-32" />
)}
</div>
</div>
<div className="flex items-center gap-2">
{chat ? (
<ActionsMenu
projectId={chat.id}
projectName={chat.name}
onNewChat={handleNewChat}
isLoading={isAILoading}
isBuildLoading={false}
onFirstInteraction={handleFirstInteraction}
isChat={true}
/>
) : (
<Skeleton className="h-8 w-8 rounded" />
)}
</div>
</div>
</header>
{/* Mobile Sidebar Overlay */}
{isSidebarVisible && (
<div className="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm">
{/* Backdrop - only covers the area not occupied by the sidebar */}
<div
className="absolute inset-0"
onClick={() => setIsSidebarVisible(false)}
/>
{/* Sidebar */}
<div className="absolute left-0 top-0 bottom-0 w-64 bg-sidebar">
<ProjectSidebar
selectedProject={null}
onSelectProject={() => {}}
onClose={() => setIsSidebarVisible(false)}
/>
</div>
</div>
)}
<div className="flex-1 overflow-hidden">
{chat && (
<ChatPane
ref={chatPaneRef}
projectId={chat.id}
onNewChat={handleNewChat}
onFirstInteraction={handleFirstInteraction}
onLoadingChange={handleAILoadingChange}
isLoading={isAILoading}
isChat={true}
/>
)}
</div>
</div>
);
}
// Desktop layout
return (
<div className="h-screen flex flex-col bg-background">
<ResizablePanelGroup direction="horizontal">
{isSidebarVisible && (
<>
<ResizablePanel defaultSize={20} minSize={15} maxSize={30}>
<ProjectSidebar
selectedProject={null}
onSelectProject={() => {}}
onToggleSidebar={() => setIsSidebarVisible(false)}
/>
</ResizablePanel>
<ResizableHandle withHandle />
</>
)}
<ResizablePanel defaultSize={isSidebarVisible ? 80 : 100}>
<div className="h-screen flex flex-col">
<header className="pt-safe bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10 backdrop-blur">
<div className="h-12 border-b px-4 py-3 flex items-center justify-between">
<div className="flex items-center space-x-2 overflow-hidden">
{!isSidebarVisible && (
<Button
variant="ghost"
size="sm"
onClick={() => setIsSidebarVisible(true)}
>
<Menu className="h-4 w-4" />
</Button>
)}
<div className="flex min-w-0 flex-1">
{chat ? (
<div className="text-sm font-semibold truncate">
{chat.name}
</div>
) : (
<Skeleton className="h-5 w-32" />
)}
</div>
</div>
<div className="flex items-center gap-2">
{chat ? (
<ActionsMenu
projectId={chat.id}
projectName={chat.name}
onNewChat={handleNewChat}
isLoading={isAILoading}
isBuildLoading={false}
onFirstInteraction={handleFirstInteraction}
isChat={true}
/>
) : (
<Skeleton className="h-8 w-8 rounded" />
)}
</div>
</div>
</header>
<div className="flex-1 overflow-hidden">
{chat && (
<ChatPane
ref={chatPaneRef}
projectId={chat.id}
onNewChat={handleNewChat}
onFirstInteraction={handleFirstInteraction}
onLoadingChange={handleAILoadingChange}
isLoading={isAILoading}
isChat={true}
/>
)}
</div>
</div>
</ResizablePanel>
</ResizablePanelGroup>
</div>
);
}
+77 -45
View File
@@ -2,12 +2,14 @@ import { useState, useEffect } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { useProjectsManager } from '@/hooks/useProjectsManager';
import { useChatsManager } from '@/hooks/useChatsManager';
import { useGenerateProjectInfo } from '@/hooks/useGenerateProjectInfo';
import { useFS } from '@/hooks/useFS';
import { useLocalStorage } from '@/hooks/useLocalStorage';
import { useIsMobile } from '@/hooks/useIsMobile';
import { useAISettings } from '@/hooks/useAISettings';
import { useAppContext } from '@/hooks/useAppContext';
import { ChatsManager } from '@/lib/ChatsManager';
import { AppLayout } from '@/components/AppLayout';
import { OnboardingDialog } from '@/components/OnboardingDialog';
import { Act1Dialog } from '@/components/Act1Dialog';
@@ -40,6 +42,7 @@ export default function Index() {
const navigate = useNavigate();
const location = useLocation();
const projectsManager = useProjectsManager();
const chatsManager = useChatsManager();
const { fs } = useFS();
const { generateProjectInfo, isLoading: isGeneratingInfo } = useGenerateProjectInfo();
const { settings, addRecentlyUsedModel } = useAISettings();
@@ -218,64 +221,93 @@ export default function Index() {
const handleCreateProject = async () => {
if (!prompt.trim() || !providerModel.trim()) return;
// Clear stored prompt when creating project
// Clear stored prompt when creating project/chat
setStoredPrompt('');
setIsCreating(true);
try {
// Use AI to generate project ID and select template
const { projectId, template } = await generateProjectInfo(providerModel, prompt.trim());
// Use AI to determine whether to create a project or start a chat
const result = await generateProjectInfo(providerModel, prompt.trim());
// Add model to recently used when creating project with AI
// Add model to recently used
addRecentlyUsedModel(providerModel.trim());
// Create project with AI-generated ID and selected template
const project = await projectsManager.createProject(
prompt.trim(),
template.url,
projectId,
() => {
// Show a toast if template update fails (non-critical)
toast({
title: t('templateUpdateFailed'),
description: t('templateUpdateFailedDescription'),
variant: 'default',
});
},
{ name: template.name, description: template.description }
);
if (result.type === 'chat') {
// Create a chat
const { chatId } = result.info;
// Build message content from input and attached files
// Images are converted to base64-encoded data URLs
const messageContent = await buildMessageContent(
prompt.trim(),
attachedFiles,
fs,
undefined
);
// Generate unique chat ID with timestamp if needed
let finalChatId = chatId;
const existingChat = await chatsManager.getChat(chatId);
if (existingChat !== null) {
// Chat exists, generate unique ID with timestamp
finalChatId = ChatsManager.generateChatId();
}
// Store the initial message in chat history using DotAI
const dotAI = new DotAI(fs, `${config.fsPathProjects}/${project.id}`);
const sessionName = DotAI.generateSessionName();
// Create chat with initial message
await chatsManager.createChat(finalChatId, prompt.trim());
const initialMessage: AIMessage = {
role: 'user',
content: messageContent
};
await dotAI.setHistory(sessionName, [initialMessage]);
// Clear attached files after successful creation
setAttachedFiles([]);
// Clear attached files after successful creation
setAttachedFiles([]);
// Navigate to the chat with autostart parameter and model
const searchParams = new URLSearchParams({
autostart: 'true',
...(providerModel.trim() && { model: providerModel.trim() })
});
navigate(`/chat/${finalChatId}?${searchParams.toString()}`);
} else {
// Create a project
const { projectId, template } = result.info;
// Navigate to the project with autostart parameter and model
const searchParams = new URLSearchParams({
autostart: 'true',
build: 'true',
...(providerModel.trim() && { model: providerModel.trim() })
});
navigate(`/project/${project.id}?${searchParams.toString()}`);
// Create project with AI-generated ID and selected template
const project = await projectsManager.createProject(
prompt.trim(),
template.url,
projectId,
() => {
// Show a toast if template update fails (non-critical)
toast({
title: t('templateUpdateFailed'),
description: t('templateUpdateFailedDescription'),
variant: 'default',
});
},
{ name: template.name, description: template.description }
);
// Build message content from input and attached files
// Images are converted to base64-encoded data URLs
const messageContent = await buildMessageContent(
prompt.trim(),
attachedFiles,
fs,
undefined
);
// Store the initial message in chat history using DotAI
const dotAI = new DotAI(fs, `${config.fsPathProjects}/${project.id}`);
const sessionName = DotAI.generateSessionName();
const initialMessage: AIMessage = {
role: 'user',
content: messageContent
};
await dotAI.setHistory(sessionName, [initialMessage]);
// Clear attached files after successful creation
setAttachedFiles([]);
// Navigate to the project with autostart parameter and model
const searchParams = new URLSearchParams({
autostart: 'true',
build: 'true',
...(providerModel.trim() && { model: providerModel.trim() })
});
navigate(`/project/${project.id}?${searchParams.toString()}`);
}
} catch (error) {
console.error('Failed to create project:', error);
console.error('Failed to create project/chat:', error);
setQuillyError(error instanceof Error ? error : new Error("An unexpected error occurred"));
} finally {
setIsCreating(false);
+1
View File
@@ -55,6 +55,7 @@ export function TestApp({ children }: TestAppProps) {
fsPathTmp: '/tmp',
fsPathPlugins: '/plugins',
fsPathTemplates: '/templates',
fsPathChats: '/chats',
sentryDsn: '',
sentryEnabled: false,
};