diff --git a/backend/apps/agents/agents.py b/backend/apps/agents/agents.py index 92889ace..6b90ec12 100644 --- a/backend/apps/agents/agents.py +++ b/backend/apps/agents/agents.py @@ -137,7 +137,7 @@ async def get_all_sessions(dashboard_id: str = "") -> dict: @agents.router.get("/get_session") -async def get_session(session_id: str = Body()) -> dict: +async def get_session(session_id: str) -> dict: return get_agent(session_id).model_dump(mode="json") @@ -436,9 +436,9 @@ async def duplicate_session(session_id: str = Body()) -> dict: @agents.router.get("/get_history") async def get_history( - q: str = Body(default=""), - limit: int = Body(default=20), - offset: int = Body(default=0), + q: str = "", + limit: int = 20, + offset: int = 0, ) -> dict: all_agents: List[Agent] = AGENT_STORE.load_all() all_agents.sort( @@ -455,12 +455,23 @@ async def get_history( continue msgs = agent.messages.messages closed_at: str = msgs[-1].timestamp.isoformat() if msgs else "" + created_at: str = msgs[0].timestamp.isoformat() if msgs else "" + # Generate name from first user message or use default + name: str = "Chat" + for m in msgs: + if m.role == "user" and isinstance(m.content, str): + name = m.content[:50] + ("..." if len(m.content) > 50 else "") + break history.append({ "id": agent.session_id, + "name": name, "status": agent.status, "model": agent.model, "mode": agent.mode, + "created_at": created_at, "closed_at": closed_at, + "cost_usd": 0, # TODO: track cost + "dashboard_id": agent.dashboard_id, }) total: int = len(history) diff --git a/frontend/.lintignore-max-folder-items b/frontend/.lintignore-max-folder-items deleted file mode 100644 index e69de29b..00000000 diff --git a/frontend/components.json b/frontend/components.json deleted file mode 100644 index e123b5f2..00000000 --- a/frontend/components.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema.json", - "style": "new-york", - "rsc": false, - "tsx": true, - "tailwind": { - "config": "", - "css": "src/styles/tailwind.css", - "baseColor": "zinc", - "cssVariables": true, - "prefix": "" - }, - "aliases": { - "components": "@/components", - "utils": "@/lib/utils", - "ui": "@/components/ui", - "lib": "@/lib", - "hooks": "@/hooks" - }, - "iconLibrary": "lucide", - "registries": { - "@assistant-ui": "https://r.assistant-ui.com/{name}.json", - "@tool-ui": "https://www.tool-ui.com/r/{name}.json" - } -} diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs deleted file mode 100644 index 6f90f3c3..00000000 --- a/frontend/eslint.config.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import eslint from "@eslint/js"; -import tseslint from "typescript-eslint"; -import reactHooks from "eslint-plugin-react-hooks"; - -export default tseslint.config( - eslint.configs.recommended, - ...tseslint.configs.recommended, - { - plugins: { - "react-hooks": reactHooks, - }, - rules: { - ...reactHooks.configs.recommended.rules, - "@typescript-eslint/no-unused-vars": [ - "error", - { - argsIgnorePattern: "^_", - varsIgnorePattern: "^_", - }, - ], - }, - }, - { - ignores: ["dist/", "webpack.config.js"], - }, -); diff --git a/frontend/knip.json b/frontend/knip.json deleted file mode 100644 index d931f5f9..00000000 --- a/frontend/knip.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "project": ["src/**/*.{ts,tsx}"] -} diff --git a/frontend/package.json b/frontend/package.json index 0227dd2c..6fdc10a3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,20 +3,12 @@ "version": "1.0.0", "description": "Open Swarm — Agent Orchestrator frontend built with React", "scripts": { - "build": "vite build", - "build:watch": "vite build --watch", - "dev": "vite", - "clean": "rm -rf dist", - "lint": "eslint src/", - "lint:fix": "eslint src/ --fix", - "knip": "knip" + "build": "webpack --mode=production", + "build:watch": "webpack --mode=development --watch", + "dev": "webpack serve --mode=development", + "clean": "rm -rf dist" }, "dependencies": { - "@assistant-ui/core": "^0.1.9", - "@assistant-ui/react": "^0.12.21", - "@assistant-ui/react-lexical": "^0.0.3", - "@assistant-ui/react-markdown": "^0.12.7", - "@codemirror/commands": "^6.10.3", "@codemirror/lang-html": "^6.4.11", "@codemirror/lang-json": "^6.0.2", "@codemirror/lang-python": "^6.2.1", @@ -25,42 +17,47 @@ "@codemirror/view": "^6.39.16", "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.1", - "@eslint/js": "^9.39.4", "@mui/icons-material": "^7.3.9", "@mui/material": "^7.3.9", - "@pierre/diffs": "^1.1.7", "@reduxjs/toolkit": "^2.8.2", - "ansi-to-react": "^6.2.6", - "class-variance-authority": "^0.7.1", - "clsx": "^2.1.1", + "@types/react-syntax-highlighter": "^15.5.13", "codemirror": "^6.0.2", "framer-motion": "^12.35.2", "html-to-image": "^1.11.13", - "lucide-react": "^1.7.0", - "radix-ui": "^1.4.3", "react": "^18.2.0", "react-dom": "^18.2.0", "react-markdown": "^10.1.0", "react-redux": "^9.2.0", "react-router-dom": "^7.13.1", - "remark-gfm": "^4.0.1", - "shiki": "^4.0.2", - "tailwind-merge": "^3.5.0", - "zod": "^4.3.6", - "zustand": "^5.0.12" + "react-syntax-highlighter": "^16.1.1", + "remark-gfm": "^4.0.1" }, "devDependencies": { - "@tailwindcss/postcss": "^4.2.2", + "@babel/core": "^7.28.0", + "@babel/preset-env": "^7.28.0", + "@babel/preset-react": "^7.27.1", + "@babel/preset-typescript": "^7.27.1", "@types/react": "^18.2.0", "@types/react-dom": "^18.2.0", - "@vitejs/plugin-react-swc": "^4.3.0", - "eslint": "^9.39.4", - "eslint-plugin-react-hooks": "^7.0.1", - "knip": "^6.1.0", - "postcss": "^8.5.8", + "@types/react-redux": "^7.1.34", + "babel-loader": "^9.2.1", + "copy-webpack-plugin": "^14.0.0", + "css-loader": "^6.8.0", + "css-modules-types-loader": "^0.6.10", + "html-webpack-plugin": "^5.5.0", "sass": "^1.89.2", + "sass-loader": "^16.0.5", + "style-loader": "^3.3.0", "typescript": "^5.0.0", - "typescript-eslint": "^8.58.0", - "vite": "^8.0.8" + "webpack": "^5.88.0", + "webpack-cli": "^5.1.0", + "webpack-dev-server": "^4.15.0" + }, + "babel": { + "presets": [ + "@babel/preset-env", + "@babel/preset-react", + "@babel/preset-typescript" + ] } } diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js deleted file mode 100644 index e5640725..00000000 --- a/frontend/postcss.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - plugins: { - '@tailwindcss/postcss': {}, - }, -}; diff --git a/frontend/index.html b/frontend/public/index.html similarity index 60% rename from frontend/index.html rename to frontend/public/index.html index c067515a..5294c8ad 100644 --- a/frontend/index.html +++ b/frontend/public/index.html @@ -4,12 +4,11 @@