Merge remote-tracking branch 'origin/main' into parseImageURLs

This commit is contained in:
Alex Gleason committed 2025-11-23 11:30:50 -06:00
commit 1f570a0d8f
72 files changed
+2283 -614

No files matched your search

+4
View File
@@ -36,6 +36,7 @@ import { useNavigate, Link } from 'react-router-dom';
import type { AIProvider } from '@/contexts/AISettingsContext';
import { AI_PROVIDER_PRESETS, type PresetProvider } from '@/lib/aiProviderPresets';
import { ExternalFavicon } from '@/components/ExternalFavicon';
import { MCPServersSection } from '@/components/MCPServersSection';
import { PluginsSection } from '@/components/PluginsSection';
interface SortableProviderItemProps {
@@ -566,6 +567,9 @@ export function AISettings() {
</Accordion>
</div>
{/* MCP Servers Section */}
<MCPServersSection />
{/* Plugins Section */}
<PluginsSection />
</div>
+16 -2
View File
@@ -24,9 +24,11 @@ import { ArrowUp } from 'lucide-react';
import { useSeoMeta } from '@unhead/react';
import { ShakespeareLogo } from '@/components/ShakespeareLogo';
import { AppShowcase } from '@/components/AppShowcase';
import { useToast } from '@/hooks/useToast';
export default function Index() {
const { t } = useTranslation();
const { toast } = useToast();
const [prompt, setPrompt] = useState('');
const [isCreating, setIsCreating] = useState(false);
const [storedPrompt, setStoredPrompt] = useLocalStorage('shakespeare-draft-prompt', '');
@@ -227,8 +229,20 @@ export default function Index() {
// Add model to recently used when creating project with AI
addRecentlyUsedModel(providerModel.trim());
// Create project with AI-generated ID
const project = await projectsManager.createProject(prompt.trim(), config.projectTemplate, projectId);
// Create project with AI-generated ID and handle template update errors
const project = await projectsManager.createProject(
prompt.trim(),
config.projectTemplate,
projectId,
() => {
// Show a toast if template update fails (non-critical)
toast({
title: t('templateUpdateFailed'),
description: t('templateUpdateFailedDescription'),
variant: 'default',
});
}
);
// Build message content from input and attached files
// Images are converted to base64-encoded data URLs
+123 -16
View File
@@ -13,6 +13,7 @@ import { useAppContext } from "@/hooks/useAppContext";
import { useOffline } from "@/hooks/useOffline";
import { useToast } from "@/hooks/useToast";
import { defaultSystemPrompt } from "@/lib/system";
import { Terminal } from "@/components/Terminal";
export function SystemSettings() {
const { t } = useTranslation();
@@ -32,6 +33,7 @@ export function SystemSettings() {
const [fsPathConfigInput, setFsPathConfigInput] = useState(config.fsPathConfig);
const [fsPathTmpInput, setFsPathTmpInput] = useState(config.fsPathTmp);
const [fsPathPluginsInput, setFsPathPluginsInput] = useState(config.fsPathPlugins);
const [fsPathTemplatesInput, setFsPathTemplatesInput] = useState(config.fsPathTemplates);
const [sentryDsnInput, setSentryDsnInput] = useState(config.sentryDsn);
const [systemPromptInput, setSystemPromptInput] = useState(config.systemPrompt || defaultSystemPrompt);
@@ -48,86 +50,134 @@ export function SystemSettings() {
fsPathConfig: config.fsPathConfig !== defaultConfig.fsPathConfig,
fsPathTmp: config.fsPathTmp !== defaultConfig.fsPathTmp,
fsPathPlugins: config.fsPathPlugins !== defaultConfig.fsPathPlugins,
fsPathTemplates: config.fsPathTemplates !== defaultConfig.fsPathTemplates,
sentryDsn: config.sentryDsn !== defaultConfig.sentryDsn,
systemPrompt: (config.systemPrompt || defaultSystemPrompt) !== (defaultConfig.systemPrompt || defaultSystemPrompt),
}), [config, defaultConfig]);
// Restore functions
// Restore functions - clear the value from config to use the default
const restoreProjectTemplate = () => {
const defaultValue = defaultConfig.projectTemplate;
setProjectTemplateInput(defaultValue);
updateConfig((current) => ({ ...current, projectTemplate: defaultValue }));
updateConfig((current) => {
const { projectTemplate, ...rest } = current;
return rest;
});
};
const restoreEsmUrl = () => {
const defaultValue = defaultConfig.esmUrl;
setEsmUrlInput(defaultValue);
updateConfig((current) => ({ ...current, esmUrl: defaultValue }));
updateConfig((current) => {
const { esmUrl, ...rest } = current;
return rest;
});
};
const restoreCorsProxy = () => {
const defaultValue = defaultConfig.corsProxy;
setCorsProxyInput(defaultValue);
updateConfig((current) => ({ ...current, corsProxy: defaultValue }));
updateConfig((current) => {
const { corsProxy, ...rest } = current;
return rest;
});
};
const restoreFaviconUrl = () => {
const defaultValue = defaultConfig.faviconUrl;
setFaviconUrlInput(defaultValue);
updateConfig((current) => ({ ...current, faviconUrl: defaultValue }));
updateConfig((current) => {
const { faviconUrl, ...rest } = current;
return rest;
});
};
const restorePreviewDomain = () => {
const defaultValue = defaultConfig.previewDomain;
setPreviewDomainInput(defaultValue);
updateConfig((current) => ({ ...current, previewDomain: defaultValue }));
updateConfig((current) => {
const { previewDomain, ...rest } = current;
return rest;
});
};
const restoreShowcaseEnabled = () => {
const defaultValue = defaultConfig.showcaseEnabled;
updateConfig((current) => ({ ...current, showcaseEnabled: defaultValue }));
updateConfig((current) => {
const { showcaseEnabled, ...rest } = current;
return rest;
});
};
const restoreShowcaseModerator = () => {
const defaultValue = defaultConfig.showcaseModerator;
setShowcaseModeratorInput(defaultValue);
updateConfig((current) => ({ ...current, showcaseModerator: defaultValue }));
updateConfig((current) => {
const { showcaseModerator, ...rest } = current;
return rest;
});
};
const restoreFsPathProjects = () => {
const defaultValue = defaultConfig.fsPathProjects;
setFsPathProjectsInput(defaultValue);
updateConfig((current) => ({ ...current, fsPathProjects: defaultValue }));
updateConfig((current) => {
const { fsPathProjects, ...rest } = current;
return rest;
});
};
const restoreFsPathConfig = () => {
const defaultValue = defaultConfig.fsPathConfig;
setFsPathConfigInput(defaultValue);
updateConfig((current) => ({ ...current, fsPathConfig: defaultValue }));
updateConfig((current) => {
const { fsPathConfig, ...rest } = current;
return rest;
});
};
const restoreFsPathTmp = () => {
const defaultValue = defaultConfig.fsPathTmp;
setFsPathTmpInput(defaultValue);
updateConfig((current) => ({ ...current, fsPathTmp: defaultValue }));
updateConfig((current) => {
const { fsPathTmp, ...rest } = current;
return rest;
});
};
const restoreFsPathPlugins = () => {
const defaultValue = defaultConfig.fsPathPlugins;
setFsPathPluginsInput(defaultValue);
updateConfig((current) => ({ ...current, fsPathPlugins: defaultValue }));
updateConfig((current) => {
const { fsPathPlugins, ...rest } = current;
return rest;
});
};
const restoreFsPathTemplates = () => {
const defaultValue = defaultConfig.fsPathTemplates;
setFsPathTemplatesInput(defaultValue);
updateConfig((current) => {
const { fsPathTemplates, ...rest } = current;
return rest;
});
};
const restoreSentryDsn = () => {
const defaultValue = defaultConfig.sentryDsn;
setSentryDsnInput(defaultValue);
updateConfig((current) => ({ ...current, sentryDsn: defaultValue }));
updateConfig((current) => {
const { sentryDsn, ...rest } = current;
return rest;
});
};
const restoreSystemPrompt = () => {
const defaultValue = defaultSystemPrompt;
setSystemPromptInput(defaultValue);
updateConfig((current) => ({ ...current, systemPrompt: defaultValue }));
updateConfig((current) => {
const { systemPrompt, ...rest } = current;
return rest;
});
};
// Service Worker state
@@ -748,7 +798,7 @@ export function SystemSettings() {
<AccordionTrigger className="px-4 py-3 hover:no-underline">
<div className="flex items-center gap-2">
<h4 className="text-sm font-medium">{t('filesystemPaths')}</h4>
{(isModified.fsPathProjects || isModified.fsPathConfig || isModified.fsPathTmp || isModified.fsPathPlugins) && (
{(isModified.fsPathProjects || isModified.fsPathConfig || isModified.fsPathTmp || isModified.fsPathPlugins || isModified.fsPathTemplates) && (
<div className="h-2 w-2 rounded-full bg-yellow-500" title={t('modified')} />
)}
</div>
@@ -918,6 +968,47 @@ export function SystemSettings() {
{t('pluginsDirectoryDescription')}
</p>
</div>
<div className="space-y-2">
<div className="flex items-center gap-2">
<Label htmlFor="fs-path-templates" className="text-sm font-medium">
{t('templatesDirectory')}
</Label>
{isModified.fsPathTemplates && (
<div className="h-2 w-2 rounded-full bg-yellow-500" title={t('modified')} />
)}
</div>
<div className="flex gap-2">
<Input
id="fs-path-templates"
type="text"
placeholder="/templates"
value={fsPathTemplatesInput}
onChange={(e) => {
const value = e.target.value;
setFsPathTemplatesInput(value);
updateConfig((current) => ({
...current,
fsPathTemplates: value,
}));
}}
className="flex-1"
/>
{isModified.fsPathTemplates && (
<Button
variant="outline"
size="icon"
onClick={restoreFsPathTemplates}
title={t('restoreToDefault')}
>
<RotateCcw className="h-4 w-4" />
</Button>
)}
</div>
<p className="text-xs text-muted-foreground">
{t('templatesDirectoryDescription')}
</p>
</div>
</div>
</AccordionContent>
</AccordionItem>
@@ -969,6 +1060,22 @@ export function SystemSettings() {
</AccordionContent>
</AccordionItem>
</Accordion>
{/* Terminal */}
<Accordion type="single" collapsible className="w-full">
<AccordionItem value="terminal" className="border rounded-lg">
<AccordionTrigger className="px-4 py-3 hover:no-underline">
<div className="flex items-center gap-2">
<h4 className="text-sm font-medium">{t('terminal')}</h4>
</div>
</AccordionTrigger>
<AccordionContent className="px-0 pb-0">
<div className="h-[500px]">
<Terminal cwd="/" />
</div>
</AccordionContent>
</AccordionItem>
</Accordion>
</div>
</div>
);