Spaces:
Running
Running
Commit
·
fc14c05
1
Parent(s):
aaf7d3b
making docker run build work
Browse files
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# Stage 1: Build frontend
|
| 2 |
FROM node:20-alpine AS frontend-builder
|
| 3 |
WORKDIR /app/frontend
|
| 4 |
-
COPY frontend/package.json ./
|
| 5 |
RUN npm install
|
| 6 |
COPY frontend/ ./
|
| 7 |
RUN npm run build
|
|
@@ -9,43 +9,47 @@ RUN npm run build
|
|
| 9 |
# Stage 2: Production
|
| 10 |
FROM python:3.12-slim
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
# Create user with UID 1000 (required for HF Spaces)
|
| 13 |
RUN useradd -m -u 1000 user
|
| 14 |
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
# Install system dependencies
|
| 18 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 19 |
git \
|
| 20 |
curl \
|
| 21 |
-
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
|
| 22 |
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
|
| 24 |
-
|
|
|
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
|
| 28 |
-
RUN uv sync --extra agent --no-dev
|
| 29 |
|
| 30 |
-
# Copy application code
|
| 31 |
-
COPY
|
| 32 |
-
COPY
|
| 33 |
-
COPY
|
| 34 |
|
| 35 |
# Copy built frontend
|
| 36 |
-
COPY --from=frontend-builder
|
| 37 |
|
| 38 |
-
# Create directories
|
| 39 |
-
RUN mkdir -p /app/session_logs &&
|
|
|
|
| 40 |
|
| 41 |
# Switch to non-root user
|
| 42 |
USER user
|
| 43 |
|
| 44 |
# Set environment
|
| 45 |
ENV HOME=/home/user \
|
| 46 |
-
PATH=/home/user/.local/bin:$PATH \
|
| 47 |
PYTHONUNBUFFERED=1 \
|
| 48 |
-
PYTHONPATH=/app
|
|
|
|
| 49 |
|
| 50 |
# Expose port
|
| 51 |
EXPOSE 7860
|
|
|
|
| 1 |
# Stage 1: Build frontend
|
| 2 |
FROM node:20-alpine AS frontend-builder
|
| 3 |
WORKDIR /app/frontend
|
| 4 |
+
COPY frontend/package.json frontend/package-lock.json ./
|
| 5 |
RUN npm install
|
| 6 |
COPY frontend/ ./
|
| 7 |
RUN npm run build
|
|
|
|
| 9 |
# Stage 2: Production
|
| 10 |
FROM python:3.12-slim
|
| 11 |
|
| 12 |
+
# Install uv directly from official image
|
| 13 |
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
| 14 |
+
|
| 15 |
# Create user with UID 1000 (required for HF Spaces)
|
| 16 |
RUN useradd -m -u 1000 user
|
| 17 |
|
| 18 |
WORKDIR /app
|
| 19 |
|
| 20 |
+
# Install system dependencies
|
| 21 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 22 |
git \
|
| 23 |
curl \
|
|
|
|
| 24 |
&& rm -rf /var/lib/apt/lists/*
|
| 25 |
|
| 26 |
+
# Copy dependency files
|
| 27 |
+
COPY pyproject.toml uv.lock ./
|
| 28 |
|
| 29 |
+
# Install dependencies into /app/.venv
|
| 30 |
+
# Use --frozen to ensure exact versions from uv.lock
|
| 31 |
+
RUN uv sync --extra agent --no-dev --frozen
|
| 32 |
|
| 33 |
+
# Copy application code
|
| 34 |
+
COPY agent/ ./agent/
|
| 35 |
+
COPY backend/ ./backend/
|
| 36 |
+
COPY configs/ ./configs/
|
| 37 |
|
| 38 |
# Copy built frontend
|
| 39 |
+
COPY --from=frontend-builder /app/frontend/dist ./static/
|
| 40 |
|
| 41 |
+
# Create directories and set ownership
|
| 42 |
+
RUN mkdir -p /app/session_logs && \
|
| 43 |
+
chown -R user:user /app
|
| 44 |
|
| 45 |
# Switch to non-root user
|
| 46 |
USER user
|
| 47 |
|
| 48 |
# Set environment
|
| 49 |
ENV HOME=/home/user \
|
|
|
|
| 50 |
PYTHONUNBUFFERED=1 \
|
| 51 |
+
PYTHONPATH=/app \
|
| 52 |
+
PATH="/app/.venv/bin:$PATH"
|
| 53 |
|
| 54 |
# Expose port
|
| 55 |
EXPOSE 7860
|
frontend/src/components/Chat/ApprovalFlow.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import CancelIcon from '@mui/icons-material/Cancel';
|
|
| 7 |
import { useAgentStore } from '@/store/agentStore';
|
| 8 |
import { useLayoutStore } from '@/store/layoutStore';
|
| 9 |
import { useSessionStore } from '@/store/sessionStore';
|
| 10 |
-
import type { Message } from '@/types/agent';
|
| 11 |
|
| 12 |
interface ApprovalFlowProps {
|
| 13 |
message: Message;
|
|
@@ -19,7 +19,7 @@ export default function ApprovalFlow({ message }: ApprovalFlowProps) {
|
|
| 19 |
const { activeSessionId } = useSessionStore();
|
| 20 |
const [currentIndex, setCurrentIndex] = useState(0);
|
| 21 |
const [feedback, setFeedback] = useState('');
|
| 22 |
-
const [decisions, setDecisions] = useState<
|
| 23 |
|
| 24 |
const approvalData = message.approval;
|
| 25 |
|
|
|
|
| 7 |
import { useAgentStore } from '@/store/agentStore';
|
| 8 |
import { useLayoutStore } from '@/store/layoutStore';
|
| 9 |
import { useSessionStore } from '@/store/sessionStore';
|
| 10 |
+
import type { Message, ToolApproval } from '@/types/agent';
|
| 11 |
|
| 12 |
interface ApprovalFlowProps {
|
| 13 |
message: Message;
|
|
|
|
| 19 |
const { activeSessionId } = useSessionStore();
|
| 20 |
const [currentIndex, setCurrentIndex] = useState(0);
|
| 21 |
const [feedback, setFeedback] = useState('');
|
| 22 |
+
const [decisions, setDecisions] = useState<ToolApproval[]>([]);
|
| 23 |
|
| 24 |
const approvalData = message.approval;
|
| 25 |
|
frontend/src/components/Layout/AppLayout.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import {
|
| 2 |
import {
|
| 3 |
Box,
|
| 4 |
Drawer,
|
|
@@ -7,7 +7,6 @@ import {
|
|
| 7 |
} from '@mui/material';
|
| 8 |
import MenuIcon from '@mui/icons-material/Menu';
|
| 9 |
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
|
| 10 |
-
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
| 11 |
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
| 12 |
|
| 13 |
import { useSessionStore } from '@/store/sessionStore';
|
|
|
|
| 1 |
+
import { useCallback, useRef, useEffect } from 'react';
|
| 2 |
import {
|
| 3 |
Box,
|
| 4 |
Drawer,
|
|
|
|
| 7 |
} from '@mui/material';
|
| 8 |
import MenuIcon from '@mui/icons-material/Menu';
|
| 9 |
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
|
|
|
|
| 10 |
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
| 11 |
|
| 12 |
import { useSessionStore } from '@/store/sessionStore';
|
frontend/src/components/SessionSidebar/SessionSidebar.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
| 6 |
IconButton,
|
| 7 |
Typography,
|
| 8 |
Button,
|
| 9 |
-
Divider,
|
| 10 |
Tooltip,
|
| 11 |
} from '@mui/material';
|
| 12 |
import DeleteIcon from '@mui/icons-material/Delete';
|
|
|
|
| 6 |
IconButton,
|
| 7 |
Typography,
|
| 8 |
Button,
|
|
|
|
| 9 |
Tooltip,
|
| 10 |
} from '@mui/material';
|
| 11 |
import DeleteIcon from '@mui/icons-material/Delete';
|
frontend/src/hooks/useAgentWebSocket.ts
CHANGED
|
@@ -35,7 +35,6 @@ export function useAgentWebSocket({
|
|
| 35 |
clearTraceLogs,
|
| 36 |
setPanelContent,
|
| 37 |
setPlan,
|
| 38 |
-
traceLogs,
|
| 39 |
setCurrentTurnMessageId,
|
| 40 |
updateCurrentTurnTrace,
|
| 41 |
} = useAgentStore();
|
|
|
|
| 35 |
clearTraceLogs,
|
| 36 |
setPanelContent,
|
| 37 |
setPlan,
|
|
|
|
| 38 |
setCurrentTurnMessageId,
|
| 39 |
updateCurrentTurnTrace,
|
| 40 |
} = useAgentStore();
|
frontend/src/types/agent.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface Message {
|
|
| 15 |
content: string;
|
| 16 |
timestamp: string;
|
| 17 |
toolName?: string;
|
| 18 |
-
|
| 19 |
trace?: TraceLog[];
|
| 20 |
approval?: {
|
| 21 |
status: 'pending' | 'approved' | 'rejected';
|
|
@@ -34,9 +34,9 @@ export interface ToolCall {
|
|
| 34 |
}
|
| 35 |
|
| 36 |
export interface ToolApproval {
|
| 37 |
-
|
| 38 |
approved: boolean;
|
| 39 |
-
feedback?: string;
|
| 40 |
}
|
| 41 |
|
| 42 |
export interface ApprovalBatch {
|
|
|
|
| 15 |
content: string;
|
| 16 |
timestamp: string;
|
| 17 |
toolName?: string;
|
| 18 |
+
tool_call_id?: string;
|
| 19 |
trace?: TraceLog[];
|
| 20 |
approval?: {
|
| 21 |
status: 'pending' | 'approved' | 'rejected';
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
export interface ToolApproval {
|
| 37 |
+
tool_call_id: string;
|
| 38 |
approved: boolean;
|
| 39 |
+
feedback?: string | null;
|
| 40 |
}
|
| 41 |
|
| 42 |
export interface ApprovalBatch {
|