diff --git a/.env.example b/.env.example new file mode 100644 index 0000000000000000000000000000000000000000..406c10849e0ff8b05e8dcd6de5a88e3ea33ea7e5 --- /dev/null +++ b/.env.example @@ -0,0 +1,11 @@ +OAUTH_CLIENT_ID= +OAUTH_CLIENT_SECRET= +APP_PORT=5173 +REDIRECT_URI=http://localhost:5173/auth/login +DEFAULT_HF_TOKEN= + +# Optional +# By setting this variable, you will bypass the login page + the free requests +# and will use the token directly. +# This is useful for testing purposes or local use. +HF_TOKEN= \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5ef6a520780202a1d6addd833d800ccb1ecac0bb..38d4117ba770f7518a4bc651b80446a4f2f218d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,41 +1,26 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.* -.yarn/* -!.yarn/patches -!.yarn/plugins -!.yarn/releases -!.yarn/versions - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug +# Logs +logs +*.log npm-debug.log* yarn-debug.log* yarn-error.log* -.pnpm-debug.log* - -# env files (can opt-in for committing if needed) -.env* - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +.env +.aider* diff --git a/Dockerfile b/Dockerfile index cbe0188aaee92186937765d2c85d76f7b212c537..8003b5cb2da5b411b794263c7d70bae1f6866ae0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ -FROM node:20-alpine +# Dockerfile +# Use an official Node.js runtime as the base image +FROM node:22.1.0 USER root +RUN apt-get update USER 1000 WORKDIR /usr/src/app # Copy package.json and package-lock.json to the container @@ -13,7 +16,7 @@ RUN npm install RUN npm run build # Expose the application port (assuming your app runs on port 3000) -EXPOSE 3000 +EXPOSE 5173 # Start the application CMD ["npm", "start"] \ No newline at end of file diff --git a/MCP-SERVER.md b/MCP-SERVER.md deleted file mode 100644 index 675acdbb77beeb3bdc3e0b7b49a2e01d39df1b58..0000000000000000000000000000000000000000 --- a/MCP-SERVER.md +++ /dev/null @@ -1,428 +0,0 @@ -# DeepSite MCP Server - -DeepSite is now available as an MCP (Model Context Protocol) server, enabling AI assistants like Claude to create websites directly using natural language. - -## Two Ways to Use DeepSite MCP - -**Quick Comparison:** - -| Feature | Option 1: HTTP Server | Option 2: Local Server | -|---------|----------------------|------------------------| -| **Setup Difficulty** | βœ… Easy (just config) | ⚠️ Requires installation | -| **Authentication** | HF Token in config header | HF Token or session cookie in env | -| **Best For** | Most users | Developers, custom modifications | -| **Maintenance** | βœ… Always up-to-date | Need to rebuild for updates | - -**Recommendation:** Use Option 1 (HTTP Server) unless you need to modify the MCP server code. - ---- - -### 🌐 Option 1: HTTP Server (Recommended) - -**No installation required!** Use DeepSite's hosted MCP server. - -#### Setup for Claude Desktop - -Add to your Claude Desktop configuration file: - -**MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json` -**Windows**: `%APPDATA%\Claude\claude_desktop_config.json` - -```json -{ - "mcpServers": { - "deepsite": { - "url": "https://huggingface.co/deepsite/api/mcp", - "transport": { - "type": "sse" - }, - "headers": { - "Authorization": "Bearer hf_your_token_here" - } - } - } -} -``` - -**Getting Your Hugging Face Token:** - -1. Go to https://huggingface.co/settings/tokens -2. Create a new token with `write` access -3. Copy the token -4. Add it to the `Authorization` header in your config (recommended for security) -5. Alternatively, you can pass it as the `hf_token` parameter when using the tool - -**⚠️ Security Recommendation:** Use the `Authorization` header in your config instead of passing the token in chat. This keeps your token secure and out of conversation history. - -#### Example Usage with Claude - -> "Create a portfolio website using DeepSite. Include a hero section, about section, and contact form." - -Claude will automatically: -1. Use the `create_project` tool -2. Authenticate using the token from your config -3. Create the website on Hugging Face Spaces -4. Return the URLs to access your new site - ---- - -### πŸ’» Option 2: Local Server - -Run the MCP server locally for more control or offline use. - -> **Note:** Most users should use Option 1 (HTTP Server) instead. Option 2 is only needed if you want to run the MCP server locally or modify its behavior. - -#### Installation - -```bash -cd mcp-server -npm install -npm run build -``` - -#### Setup for Claude Desktop - -**Method A: Using HF Token (Recommended)** - -```json -{ - "mcpServers": { - "deepsite-local": { - "command": "node", - "args": ["/absolute/path/to/deepsite-v3/mcp-server/dist/index.js"], - "env": { - "HF_TOKEN": "hf_your_token_here", - "DEEPSITE_API_URL": "https://huggingface.co/deepsite" - } - } - } -} -``` - -**Method B: Using Session Cookie (Alternative)** - -```json -{ - "mcpServers": { - "deepsite-local": { - "command": "node", - "args": ["/absolute/path/to/deepsite-v3/mcp-server/dist/index.js"], - "env": { - "DEEPSITE_AUTH_COOKIE": "your-session-cookie", - "DEEPSITE_API_URL": "https://huggingface.co/deepsite" - } - } - } -} -``` - -**Getting Your Session Cookie (Method B only):** - -1. Log in to https://huggingface.co/deepsite -2. Open Developer Tools (F12) -3. Go to Application β†’ Cookies -4. Copy the session cookie value -5. Set as `DEEPSITE_AUTH_COOKIE` in the config - ---- - -## Available Tools - -### `create_project` - -Creates a new DeepSite project with HTML/CSS/JS files. - -**Parameters:** - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `title` | string | No | Project title (defaults to "DeepSite Project") | -| `pages` | array | Yes | Array of file objects with `path` and `html` | -| `prompt` | string | No | Commit message/description | -| `hf_token` | string | No* | Hugging Face API token (*optional if provided via Authorization header in config) | - -**Page Object:** -```typescript -{ - path: string; // e.g., "index.html", "styles.css", "script.js" - html: string; // File content -} -``` - -**Returns:** -```json -{ - "success": true, - "message": "Project created successfully!", - "projectUrl": "https://huggingface.co/deepsite/username/project-name", - "spaceUrl": "https://huggingface.co/spaces/username/project-name", - "liveUrl": "https://username-project-name.hf.space", - "spaceId": "username/project-name", - "projectId": "space-id", - "files": ["index.html", "styles.css"] -} -``` - ---- - -## Example Prompts for Claude - -### Simple Landing Page -> "Create a modern landing page for my SaaS product using DeepSite. Include a hero section with CTA, features grid, and footer. Use gradient background." - -### Portfolio Website -> "Build a portfolio website with DeepSite. I need: -> - Hero section with my name and photo -> - Projects gallery with 3 sample projects -> - Skills section with tech stack -> - Contact form -> Use dark mode with accent colors." - -### Blog Homepage -> "Create a blog homepage using DeepSite. Include: -> - Header with navigation -> - Featured post section -> - Grid of recent posts (3 cards) -> - Sidebar with categories -> - Footer with social links -> Clean, minimal design." - -### Interactive Dashboard -> "Make an analytics dashboard with DeepSite: -> - Sidebar navigation -> - 4 metric cards at top -> - 2 chart placeholders -> - Data table -> - Modern, professional UI with charts.css" - ---- - -## Direct API Usage - -You can also call the HTTP endpoint directly: - -### Using Authorization Header (Recommended) - -```bash -curl -X POST https://huggingface.co/deepsite/api/mcp \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer hf_your_token_here" \ - -d '{ - "jsonrpc": "2.0", - "id": 1, - "method": "tools/call", - "params": { - "name": "create_project", - "arguments": { - "title": "My Website", - "pages": [ - { - "path": "index.html", - "html": "Hello

Hello World!

" - } - ] - } - } - }' -``` - -### Using Token Parameter (Fallback) - -```bash -curl -X POST https://huggingface.co/deepsite/api/mcp \ - -H "Content-Type: application/json" \ - -d '{ - "jsonrpc": "2.0", - "id": 1, - "method": "tools/call", - "params": { - "name": "create_project", - "arguments": { - "title": "My Website", - "pages": [ - { - "path": "index.html", - "html": "Hello

Hello World!

" - } - ], - "hf_token": "hf_xxxxx" - } - } - }' -``` - -### List Available Tools - -```bash -curl -X POST https://huggingface.co/deepsite/api/mcp \ - -H "Content-Type: application/json" \ - -d '{ - "jsonrpc": "2.0", - "id": 1, - "method": "tools/list", - "params": {} - }' -``` - ---- - -## Testing - -### Test Local Server - -```bash -cd mcp-server -./test.sh -``` - -### Test HTTP Server - -```bash -curl -X POST https://huggingface.co/deepsite/api/mcp \ - -H "Content-Type: application/json" \ - -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' -``` - ---- - -## Migration Guide: From Parameter to Header Auth - -If you're currently passing the token as a parameter in your prompts, here's how to migrate to the more secure header-based authentication: - -### Step 1: Update Your Config - -Edit your Claude Desktop config file and add the `headers` section: - -```json -{ - "mcpServers": { - "deepsite": { - "url": "https://huggingface.co/deepsite/api/mcp", - "transport": { - "type": "sse" - }, - "headers": { - "Authorization": "Bearer hf_your_actual_token_here" - } - } - } -} -``` - -### Step 2: Restart Claude Desktop - -Completely quit and restart Claude Desktop for the changes to take effect. - -### Step 3: Use Simpler Prompts - -Now you can simply say: -> "Create a portfolio website with DeepSite" - -Instead of: -> "Create a portfolio website with DeepSite using token `hf_xxxxx`" - -Your token is automatically included in all requests via the header! - ---- - -## Security Notes - -### HTTP Server (Option 1) -- **βœ… Recommended:** Store your HF token in the `Authorization` header in your Claude Desktop config -- The token is stored locally on your machine and never exposed in chat -- The token is sent with each request but only used to authenticate with Hugging Face API -- DeepSite does not store your token -- Use tokens with minimal required permissions (write access to spaces) -- You can revoke tokens anytime at https://huggingface.co/settings/tokens -- **⚠️ Fallback:** You can still pass the token as a parameter, but this is less secure as it appears in conversation history - -### Local Server (Option 2) -- Use `HF_TOKEN` environment variable (same security as Option 1) -- Or use `DEEPSITE_AUTH_COOKIE` if you prefer session-based auth -- All authentication data stays on your local machine -- Better for development and testing -- No need for both HTTP Server and Local Server - choose one! - ---- - -## Troubleshooting - -### "Invalid Hugging Face token" -- Verify your token at https://huggingface.co/settings/tokens -- Ensure the token has write permissions -- Check that you copied the full token (starts with `hf_`) - -### "At least one page is required" -- Make sure you're providing the `pages` array -- Each page must have both `path` and `html` properties - -### "Failed to create project" -- Check your token permissions -- Ensure the project title doesn't conflict with existing spaces -- Verify your Hugging Face account is in good standing - -### Claude doesn't see the tool -- Restart Claude Desktop after modifying the config -- Check that the JSON config is valid (no trailing commas) -- For HTTP: verify the URL is correct -- For local: check the absolute path to index.js - ---- - -## Architecture - -### HTTP Server Flow -``` -Claude Desktop - ↓ - (HTTP Request) - ↓ -huggingface.co/deepsite/api/mcp - ↓ -Hugging Face API (with user's token) - ↓ -New Space Created - ↓ -URLs returned to Claude -``` - -### Local Server Flow -``` -Claude Desktop - ↓ - (stdio transport) - ↓ -Local MCP Server - ↓ - (HTTP to DeepSite API) - ↓ -huggingface.co/deepsite/api/me/projects - ↓ -New Space Created -``` - ---- - -## Contributing - -The MCP server implementation lives in: -- HTTP Server: `/app/api/mcp/route.ts` -- Local Server: `/mcp-server/index.ts` - -Both use the same core DeepSite logic for creating projects - no duplication! - ---- - -## License - -MIT - ---- - -## Resources - -- [Model Context Protocol Spec](https://modelcontextprotocol.io/) -- [DeepSite Documentation](https://huggingface.co/deepsite) -- [Hugging Face Spaces](https://huggingface.co/docs/hub/spaces) -- [Claude Desktop](https://claude.ai/desktop) - diff --git a/README.md b/README.md index 9154f9026a5ccedb6d9aa26c2b34462372d7741b..606f2489d425f097ed31a2c0be520bff4b1c1201 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,19 @@ --- -title: DeepSite v3 +title: DeepSite emoji: 🐳 colorFrom: blue colorTo: blue sdk: docker pinned: true -app_port: 3000 +app_port: 5173 license: mit -failure_strategy: rollback -short_description: Generate any application by Vibe Coding +short_description: Generate any application with DeepSeek models: - deepseek-ai/DeepSeek-V3-0324 - - deepseek-ai/DeepSeek-R1-0528 - - deepseek-ai/DeepSeek-V3.1 - - deepseek-ai/DeepSeek-V3.1-Terminus - - deepseek-ai/DeepSeek-V3.2-Exp - - Qwen/Qwen3-Coder-480B-A35B-Instruct - - moonshotai/Kimi-K2-Instruct - - moonshotai/Kimi-K2-Instruct-0905 - - zai-org/GLM-4.6 - - MiniMaxAI/MiniMax-M2 - - moonshotai/Kimi-K2-Thinking --- # DeepSite 🐳 +DeepSite is a coding platform powered by DeepSeek AI, designed to make coding smarter and more efficient. Tailored for developers, data scientists, and AI engineers, it integrates generative AI into your coding projects to enhance creativity and productivity. -DeepSite is a Vibe Coding Platform designed to make coding smarter and more efficient. Tailored for developers, data scientists, and AI engineers, it integrates generative AI into your coding projects to enhance creativity and productivity. +## How to use it locally +Follow [this discussion](https://huggingface.co/spaces/enzostvs/deepsite/discussions/74) \ No newline at end of file diff --git a/Stock news screeer b/Stock news screeer new file mode 100644 index 0000000000000000000000000000000000000000..c7bbcbbfda503a152ac53ebec2e1a1776ba57faf --- /dev/null +++ b/Stock news screeer @@ -0,0 +1,71 @@ +// Wall Street Watchdog AI - React Frontend +// Uses TailwindCSS, TradingView widget, and fetches from backend every 5 min + +import React, { useEffect, useState } from 'react'; +import { Card, CardContent } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { ReloadIcon } from "lucide-react"; +import axios from 'axios'; + +const API_ENDPOINT = "/api/alerts"; // Your backend API route + +export default function WatchdogApp() { + const [alerts, setAlerts] = useState([]); + const [loading, setLoading] = useState(false); + const [countdown, setCountdown] = useState(300); + + const fetchAlerts = async () => { + setLoading(true); + try { + const res = await axios.get(API_ENDPOINT); + setAlerts(res.data.alerts); + } catch (err) { + console.error("Error fetching alerts:", err); + } + setLoading(false); + }; + + useEffect(() => { + fetchAlerts(); + const interval = setInterval(fetchAlerts, 300000); // Every 5 minutes + const countdownInterval = setInterval(() => setCountdown((c) => (c > 0 ? c - 1 : 300)), 1000); + return () => { + clearInterval(interval); + clearInterval(countdownInterval); + }; + }, []); + + return ( +
+

Wall Street Watchdog AI

+
+

Auto-refresh in {countdown}s

+ +
+ +
+ {alerts.map((alert, idx) => ( + + +

{alert.ticker} β€” {alert.action}

+

{alert.source}

+

{alert.summary}

+
+