Merge remote-tracking branch 'origin/main' into nuke-ngit

This commit is contained in:
Alex Gleason committed 2025-12-25 14:42:24 -06:00
commit b2afa2bc3e
6 files changed
+86 -22

No files matched your search

+49 -3
View File
@@ -288,6 +288,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
messages,
streamingMessage,
isLoading: internalIsLoading,
isLoadingHistory,
totalCost,
lastInputTokens,
addMessage,
@@ -701,8 +702,53 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
</div>
)}
{/* Loading skeleton while loading history */}
{isLoadingHistory && (
<div className="space-y-6">
{/* User message skeleton */}
<div className="flex justify-end py-6">
<div className="max-w-[80%] bg-secondary rounded-2xl rounded-br-md px-4 py-3">
<div className="space-y-2">
<Skeleton className="h-4 w-64" />
<Skeleton className="h-4 w-48" />
</div>
</div>
</div>
{/* Assistant message skeleton */}
<div className="flex py-6">
<div className="flex-1 min-w-0">
<div className="space-y-2">
<Skeleton className="h-4 w-full" />
<Skeleton className="h-4 w-5/6" />
<Skeleton className="h-4 w-4/5" />
</div>
</div>
</div>
{/* Another user message skeleton */}
<div className="flex justify-end py-6">
<div className="max-w-[80%] bg-secondary rounded-2xl rounded-br-md px-4 py-3">
<div className="space-y-2">
<Skeleton className="h-4 w-56" />
</div>
</div>
</div>
{/* Another assistant message skeleton */}
<div className="flex py-6">
<div className="flex-1 min-w-0">
<div className="space-y-2">
<Skeleton className="h-4 w-full" />
<Skeleton className="h-4 w-11/12" />
</div>
</div>
</div>
</div>
)}
{/* Empty state when no messages and not loading */}
{messages.length === 0 && !streamingMessage && !isLoading && (
{!isLoadingHistory && messages.length === 0 && !streamingMessage && !isLoading && (
<div className="flex-1 flex items-center justify-center min-h-[400px]">
<div className="text-center space-y-4 max-w-md mx-auto">
<div className="mb-6">
@@ -726,7 +772,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
</div>
)}
{messages.map((message, index) => {
{!isLoadingHistory && messages.map((message, index) => {
// Find the corresponding tool call for tool messages
let toolCall: OpenAI.Chat.Completions.ChatCompletionMessageToolCall | undefined = undefined;
if (message.role === 'tool') {
@@ -749,7 +795,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
);
})}
{renderStreamingMessage()}
{!isLoadingHistory && renderStreamingMessage()}
{/* Error Alert (Console or AI) - Don't show while assistant is loading */}
{displayError && !isLoading && (
+6 -1
View File
@@ -526,6 +526,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
className="h-8 gap-2 relative"
>
<Bug className="h-4 w-4" />
<span className="hidden lg:inline">Logs</span>
{hasConsoleErrors && (
<span className="absolute -top-1 -right-1 h-3 w-3 rounded-full border-2 border-background bg-red-500" />
)}
@@ -618,7 +619,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
size="sm"
onClick={toggleFullscreen}
className="h-8 w-8 p-0"
title={isFullscreen ? 'Exit immersive view' : 'Enter immersive view'}
title={isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen'}
>
{isFullscreen ? (
<Shrink className="h-4 w-4" />
@@ -661,6 +662,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
) : (
<Hammer className="h-4 w-4" />
)}
<span className="hidden lg:inline">Build</span>
</Button>
{(!isMobile && onToggleView && isPreviewable) && (
<Button
@@ -670,6 +672,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
className="h-8 gap-2"
>
<Code className="h-4 w-4" />
<span className="hidden lg:inline">Code</span>
</Button>
)}
<ConsoleDropdown />
@@ -837,6 +840,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
className="gap-2 text-muted-foreground hover:text-foreground"
>
<Terminal className="h-4 w-4" />
<span className="hidden lg:inline">Terminal</span>
</Button>
</div>
)}
@@ -851,6 +855,7 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
className="gap-2 text-muted-foreground hover:text-foreground"
>
<Terminal className="h-4 w-4" />
<span className="hidden lg:inline">Terminal</span>
</Button>
<GitStatusIndicator projectId={projectId} />
</div>
+8 -8
View File
@@ -253,14 +253,6 @@ export function SyncStep({ projectId, remoteUrl }: SyncStepProps) {
<h3 className="font-semibold">{providerInfo?.name}</h3>
</div>
<div className="flex items-center gap-1">
<Button
variant="ghost"
size="icon"
className="h-8 w-8"
onClick={handleOpenExternal}
>
<ExternalLink className="h-4 w-4" />
</Button>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="icon" className="h-8 w-8">
@@ -297,6 +289,14 @@ export function SyncStep({ projectId, remoteUrl }: SyncStepProps) {
<Copy className="h-4 w-4" />
)}
</Button>
<Button
size="sm"
variant="outline"
onClick={handleOpenExternal}
className="shrink-0 h-10"
>
<ExternalLink className="h-4 w-4" />
</Button>
</div>
</div>
+1 -1
View File
@@ -123,7 +123,7 @@ export function BrowserAddressBar({
variant="ghost"
size="sm"
onClick={onRefresh}
className="size-6 absolute right-1 top-1/2 -translate-y-1/2 hover:bg-muted/50 rounded-full transition-colors group"
className="size-6 absolute right-1 top-1/2 -translate-y-1/2 hover:bg-muted/50 rounded-full transition-colors group px-1.5"
title="Refresh"
>
<RefreshCw className="size-3 text-muted-foreground transition-colors group-hover:text-foreground" />
+15 -8
View File
@@ -43,16 +43,22 @@ export function useAIChat({
const [isLoading, setIsLoading] = useState<boolean>(false);
const [totalCost, setTotalCost] = useState<number>(0);
const [lastInputTokens, setLastInputTokens] = useState<number>(0);
const [isLoadingHistory, setIsLoadingHistory] = useState<boolean>(true);
const initSession = useCallback(async () => {
// Load or update session
const session = await sessionManager.loadSession(projectId, tools, customTools, maxSteps);
// Initialize individual state variables from existing session
setMessages([...session.messages]);
setStreamingMessage(session.streamingMessage ? { ...session.streamingMessage } : undefined);
setIsLoading(session.isLoading);
setTotalCost(session.totalCost || 0);
setLastInputTokens(session.lastInputTokens || 0);
setIsLoadingHistory(true);
try {
// Load or update session
const session = await sessionManager.loadSession(projectId, tools, customTools, maxSteps);
// Initialize individual state variables from existing session
setMessages([...session.messages]);
setStreamingMessage(session.streamingMessage ? { ...session.streamingMessage } : undefined);
setIsLoading(session.isLoading);
setTotalCost(session.totalCost || 0);
setLastInputTokens(session.lastInputTokens || 0);
} finally {
setIsLoadingHistory(false);
}
}, [sessionManager, projectId, tools, customTools, maxSteps]);
// Initialize session
@@ -166,6 +172,7 @@ export function useAIChat({
messages,
streamingMessage,
isLoading,
isLoadingHistory,
totalCost,
lastInputTokens,
sendMessage,
+7 -1
View File
@@ -40,6 +40,7 @@ import { useGitFetch } from '@/hooks/useGitFetch';
import { useQueryClient } from '@tanstack/react-query';
import JSZip from 'jszip';
import { cn } from '@/lib/utils';
import { useProjectSessionStatus } from '@/hooks/useProjectSessionStatus';
export function ProjectView() {
const { projectId } = useParams<{ projectId: string }>();
@@ -72,6 +73,7 @@ export function ProjectView() {
const build = useBuildProject(projectId!);
const { data: isPreviewable = false } = useIsProjectPreviewable(projectId!);
const { hasRunningSessions } = useProjectSessionStatus(projectId || '');
// Automatically fetch from remote to keep git status updated
useGitFetch(projectId ? `${projectsPath}/${projectId}` : undefined);
@@ -402,7 +404,11 @@ export function ProjectView() {
className={cn("flex-1 rounded-none mobile-nav-button text-muted-foreground", { "text-foreground": mobileView === 'chat' })}
disabled={!project}
>
<MessageSquare className="h-4 w-4 mr-1" />
{project && hasRunningSessions ? (
<Loader2 className="h-4 w-4 mr-1 animate-spin text-blue-600 dark:text-blue-400" />
) : (
<MessageSquare className="h-4 w-4 mr-1" />
)}
{t('chat')}
</Button>
{isPreviewable && (