feat: Phase 3 - architecture & maintainability
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Build (push) Has been cancelled

- Split 1474-line dashboard.go into 5 domain files (clients, providers, users, system)
- Unit tests for ModelRegistry.FindModel and CalculateCost
- go mod tidy + verify (deps clean)
- .gitignore excludes tool cache dirs (.pi-lens/, .opencode/)
This commit is contained in:
2026-04-26 14:52:10 -04:00
parent 1f574d8134
commit af2c5b95f7
9 changed files with 904 additions and 954 deletions
-5
View File
@@ -12,7 +12,6 @@ import (
"github.com/go-resty/resty/v2"
"gophergate/internal/config"
"gophergate/internal/models"
"log/slog"
)
type OllamaProvider struct {
@@ -53,18 +52,15 @@ func (p *OllamaProvider) ChatCompletion(ctx context.Context, req *models.Unified
Post(url)
if err != nil {
fmt.Printf("[Ollama] Request error: %v\n", err)
return nil, fmt.Errorf("request failed: %w", err)
}
if !resp.IsSuccess() {
fmt.Printf("[Ollama] API error %d: %s\n", resp.StatusCode(), resp.String())
return nil, fmt.Errorf("Ollama API error (%d): %s", resp.StatusCode(), resp.String())
}
var respJSON map[string]interface{}
if err := json.Unmarshal(resp.Body(), &respJSON); err != nil {
fmt.Printf("[Ollama] Parse error: %v\n", err)
return nil, fmt.Errorf("failed to parse response: %w", err)
}
@@ -99,7 +95,6 @@ func (p *OllamaProvider) ChatCompletionStream(ctx context.Context, req *models.U
defer close(ch)
err := StreamOllama(resp.RawBody(), ch, req.Model)
if err != nil {
fmt.Printf("Stream error: %v\n", err)
}
}()