Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
All services: admin-v2, studio-v2, website, ai-compliance-sdk, consent-service, klausur-service, voice-service, and infrastructure. Large PDFs and compiled binaries excluded via .gitignore.
97 lines
3.0 KiB
Go
97 lines
3.0 KiB
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// Response represents a standard API response
|
|
type Response struct {
|
|
Success bool `json:"success"`
|
|
Data interface{} `json:"data,omitempty"`
|
|
Error string `json:"error,omitempty"`
|
|
Code string `json:"code,omitempty"`
|
|
}
|
|
|
|
// SuccessResponse creates a success response
|
|
func SuccessResponse(c *gin.Context, data interface{}) {
|
|
c.JSON(http.StatusOK, Response{
|
|
Success: true,
|
|
Data: data,
|
|
})
|
|
}
|
|
|
|
// ErrorResponse creates an error response
|
|
func ErrorResponse(c *gin.Context, status int, err string, code string) {
|
|
c.JSON(status, Response{
|
|
Success: false,
|
|
Error: err,
|
|
Code: code,
|
|
})
|
|
}
|
|
|
|
// StateData represents state response data
|
|
type StateData struct {
|
|
TenantID string `json:"tenantId"`
|
|
State interface{} `json:"state"`
|
|
Version int `json:"version"`
|
|
LastModified string `json:"lastModified"`
|
|
}
|
|
|
|
// ValidationError represents a validation error
|
|
type ValidationError struct {
|
|
RuleID string `json:"ruleId"`
|
|
Field string `json:"field"`
|
|
Message string `json:"message"`
|
|
Severity string `json:"severity"`
|
|
}
|
|
|
|
// CheckpointResult represents checkpoint validation result
|
|
type CheckpointResult struct {
|
|
CheckpointID string `json:"checkpointId"`
|
|
Passed bool `json:"passed"`
|
|
ValidatedAt string `json:"validatedAt"`
|
|
ValidatedBy string `json:"validatedBy"`
|
|
Errors []ValidationError `json:"errors"`
|
|
Warnings []ValidationError `json:"warnings"`
|
|
}
|
|
|
|
// SearchResult represents a RAG search result
|
|
type SearchResult struct {
|
|
ID string `json:"id"`
|
|
Content string `json:"content"`
|
|
Source string `json:"source"`
|
|
Score float64 `json:"score"`
|
|
Metadata map[string]string `json:"metadata,omitempty"`
|
|
Highlights []string `json:"highlights,omitempty"`
|
|
}
|
|
|
|
// GenerateRequest represents a document generation request
|
|
type GenerateRequest struct {
|
|
TenantID string `json:"tenantId" binding:"required"`
|
|
Context map[string]interface{} `json:"context"`
|
|
Template string `json:"template,omitempty"`
|
|
Language string `json:"language,omitempty"`
|
|
UseRAG bool `json:"useRag"`
|
|
RAGQuery string `json:"ragQuery,omitempty"`
|
|
MaxTokens int `json:"maxTokens,omitempty"`
|
|
Temperature float64 `json:"temperature,omitempty"`
|
|
}
|
|
|
|
// GenerateResponse represents a document generation response
|
|
type GenerateResponse struct {
|
|
Content string `json:"content"`
|
|
GeneratedAt string `json:"generatedAt"`
|
|
Model string `json:"model"`
|
|
TokensUsed int `json:"tokensUsed"`
|
|
RAGSources []SearchResult `json:"ragSources,omitempty"`
|
|
Confidence float64 `json:"confidence,omitempty"`
|
|
}
|
|
|
|
// Timestamps helper
|
|
func now() string {
|
|
return time.Now().UTC().Format(time.RFC3339)
|
|
}
|