Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a FigureYa LLM recommendation system written in Go that provides intelligent chart module recommendations based on user queries. The system features:
The system analyzes user queries using LLM semantic understanding and recommends suitable visualization modules with detailed explanations and direct links to module documentation.
.env supporttype Module struct { Module string `json:"module"` 需求描述 string `json:"需求描述"` // Requirement description 实用场景 string `json:"实用场景"` // Use cases 图片类型 string `json:"图片类型"` // Chart types LLMStatus string `json:"llm_status"` }
Important: JSON parsing uses
map[string]interface{} approach due to Chinese field names in struct tags not being properly handled by Go's JSON decoder.
# Install dependencies go mod tidy # Run development server go run main.go load_env.go # Run on specific port PORT=8080 go run main.go load_env.go # Test API functionality curl -X POST http://localhost:8080/recommend \ -H "Content-Type: application/json" \ -d '{"query": "我想绘制生存曲线图"}'
# Quick deployment (recommended) ./deploy.sh start # Manual Docker commands docker build -t figureya-recommend . docker run -p 8080:8080 --env-file .env figureya-recommend # Docker Compose docker-compose up -d # Production with nginx ./deploy.sh production
# Health check curl http://localhost:8080/health # Frontend test open http://localhost:8080 # Module data check curl http://localhost:8080/modules | jq '.modules[0]'
Required variables (via
.env file or environment):
OPENAI_API_KEY: LLM service API keyBASE_URL: LLM API base URL (auto-appends /v1/chat/completions)MODEL: Model name (e.g., "deepseek-chat", "gpt-3.5-turbo")PORT: Server port (default: 8080)PROVIDER: Provider identifier (default: "openai")Example
.env:
OPENAI_API_KEY=sk-xxxxx BASE_URL=https://api.deepseek.com MODEL=deepseek-chat PROVIDER=openai PORT=8080
GET /: Frontend web interfacePOST /recommend: Get module recommendationsGET /modules: List all available modulesGET /health: System health check with module countGET /static/*: Static assets (CSS, JS, images){ "query": "user query", "recommendations": [ { "module": "FigureYa1survivalCurve_update", "description": "模块需求描述", "useCase": "实用场景说明", "chartType": "图片类型", "score": 0.95, "reason": "推荐理由" } ], "explanation": "整体推荐说明" }
Critical: Chinese field names in struct tags don't work with Go's JSON decoder. Use map-based parsing:
// ❌ This doesn't work type Module struct { 需求描述 string `json:"需求描述"` // Won't parse correctly } // ✅ Use this instead var data map[string]interface{} json.Decode(&data) description := getString(moduleMap, "需求描述")
/static/styles.css, /static/script.js)https://ying-ge.github.io/FigureYa/{module}/{module}.htmlgo run main.go load_env.go # Access: http://localhost:8080
docker build -t figureya-recommend . docker run -p 8080:8080 --env-file .env figureya-recommend # Access: http://localhost:8080
docker-compose --profile production up -d # Access: http://localhost:80 (HTTP) or https://localhost:443 (HTTPS)
/static/ prefix in HTMLPORT=xxxx environment variable# Check module loading curl http://localhost:8080/modules | jq '.modules[0]' # Test recommendation curl -X POST http://localhost:8080/recommend \ -H "Content-Type: application/json" \ -d '{"query": "测试"}' | jq . # Monitor logs docker-compose logs -f figureya-recommend