File size: 3,920 Bytes
4dc3b79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# 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