Download scripts/setup_environment.ps1 from aionaion/chatdoc: direct link, hf CLI and curl.
- Browser
- Download file 3.92 kB
-
https://huggingface.co/spaces/aionaion/chatdoc/resolve/main/scripts/setup_environment.ps1
- Command line
-
hf download hf://spaces/aionaion/chatdoc/scripts/setup_environment.ps1
-
curl -L -o setup_environment.ps1 https://huggingface.co/spaces/aionaion/chatdoc/resolve/main/scripts/setup_environment.ps1
3.92 kB
| # PowerShell Setup Script for RAG Project | |
| Write-Host "========================================" -ForegroundColor Cyan | |
| Write-Host " Setup do Projeto RAG com Chroma " -ForegroundColor Cyan | |
| Write-Host "========================================`n" -ForegroundColor Cyan | |
| # Check Python | |
| Write-Host "Verificando Python..." -ForegroundColor Green | |
| try { | |
| $pythonVersion = & python --version 2>&1 | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "Python not found" | |
| } | |
| Write-Host "Python encontrado: $pythonVersion`n" -ForegroundColor Green | |
| } | |
| catch { | |
| Write-Host "ERRO: Python não encontrado!" -ForegroundColor Red | |
| Write-Host "Instale Python 3.8 ou superior: https://www.python.org/downloads/" -ForegroundColor Yellow | |
| exit 1 | |
| } | |
| # Create virtual environment | |
| Write-Host "Criando ambiente virtual..." -ForegroundColor Green | |
| try { | |
| & python -m venv venv | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "Failed to create virtual environment" | |
| } | |
| } | |
| catch { | |
| Write-Host "ERRO: Falha ao criar ambiente virtual" -ForegroundColor Red | |
| Write-Host "Tente executar: python -m pip install virtualenv" -ForegroundColor Yellow | |
| exit 1 | |
| } | |
| # Activate virtual environment | |
| Write-Host "Ativando ambiente virtual..." -ForegroundColor Green | |
| $activateScript = ".\venv\Scripts\Activate.ps1" | |
| if (Test-Path $activateScript) { | |
| try { | |
| & $activateScript | |
| } | |
| catch { | |
| Write-Host "AVISO: Não foi possível ativar o ambiente virtual automaticamente." -ForegroundColor Yellow | |
| Write-Host "Execute manualmente: .\venv\Scripts\Activate.ps1" -ForegroundColor White | |
| } | |
| } | |
| else { | |
| Write-Host "AVISO: Script de ativação não encontrado. Ative manualmente." -ForegroundColor Yellow | |
| } | |
| # Upgrade pip | |
| Write-Host "Atualizando pip..." -ForegroundColor Green | |
| & python -m pip install --upgrade pip | |
| # Install dependencies | |
| Write-Host "Instalando dependências..." -ForegroundColor Green | |
| & pip install -r requirements.txt | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Host "AVISO: Algumas dependências podem ter falhado." -ForegroundColor Yellow | |
| Write-Host "Tente instalar manualmente: pip install -r requirements.txt" -ForegroundColor White | |
| } | |
| # Copy .env.example to .env if it doesn't exist | |
| if (!(Test-Path ".env")) { | |
| Write-Host "Criando arquivo .env..." -ForegroundColor Green | |
| Copy-Item ".env.example" ".env" -ErrorAction SilentlyContinue | |
| Write-Host "Arquivo .env criado. Configure as variáveis de ambiente." -ForegroundColor Yellow | |
| } | |
| # Create some test documents | |
| Write-Host "`nCriando documentos de exemplo..." -ForegroundColor Green | |
| $testDocs = @" | |
| Sistema X - Documentação Técnica | |
| Descrição: Sistema X É uma aplicação web desenvolvida em Java 11 com Spring Boot. | |
| Arquitetura: | |
| - Backend: Java 11, Spring Boot 2.7 | |
| - Frontend: React 18 | |
| - Banco de Dados: PostgreSQL 14 | |
| - Cache: Redis 7 | |
| Credenciais de Homologação: | |
| - Usuário: homolog_user | |
| - Senha: H0m0l0g@2024 | |
| - URL: https://homolog.sistema-x.com.br | |
| Responsáveis: | |
| - Desenvolvimento: Celio L. Rodrigues | |
| - Infraestrutura: Celio L. Rodrigues | |
| "@ | |
| $testDocs | Out-File -FilePath "data\raw_documents\sistema_x.txt" -Encoding UTF8 -Force | |
| $testDocs2 = @" | |
| # Sistema Y - Especificações | |
| ## Tecnologias | |
| - Linguagem: Python 3.9 | |
| - Framework: FastAPI | |
| - Banco: MongoDB 5.0 | |
| ## Ambientes | |
| ### Desenvolvimento | |
| - URL: http://localhost:8000 | |
| - Usuário: dev_admin | |
| - Senha: Dev@1234 | |
| ### Homologação | |
| - URL: https://homolog.sistema-y.com | |
| - Usuário: homolog_user | |
| - Senha: HomoL0g@2024 | |
| - Banco: mongodb://homolog:27017 | |
| ### Produção | |
| - URL: https://sistema-y.com | |
| - Usuário: production_user | |
| - Senha: Pr0d@2024S3cr3t! | |
| ## Dependências | |
| - Redis para cache | |
| - RabbitMQ para mensageria | |
| - Elasticsearch para logs | |
| "@ | |
| $testDocs2 | Out-File -FilePath "data\raw_documents\sistema_y.md" -Encoding UTF8 -Force | |