重构了一下 rag的方法, 使用 goframe的框架, 还有redis连接部分
This commit is contained in:
@@ -2,7 +2,8 @@ package ragflow
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
)
|
||||
|
||||
// System 系统管理
|
||||
@@ -10,11 +11,11 @@ import (
|
||||
|
||||
// HealthStatus 健康状态
|
||||
type HealthStatus struct {
|
||||
DB string `json:"db"` // "ok" 或 "nok"
|
||||
Redis string `json:"redis"` // "ok" 或 "nok"
|
||||
DocEngine string `json:"doc_engine"` // "ok" 或 "nok"
|
||||
Storage string `json:"storage"` // "ok" 或 "nok"
|
||||
Status string `json:"status"` // 整体状态: "ok" 或 "nok"
|
||||
DB string `json:"db"` // "ok" 或 "nok"
|
||||
Redis string `json:"redis"` // "ok" 或 "nok"
|
||||
DocEngine string `json:"doc_engine"` // "ok" 或 "nok"
|
||||
Storage string `json:"storage"` // "ok" 或 "nok"
|
||||
Status string `json:"status"` // 整体状态: "ok" 或 "nok"
|
||||
Meta map[string]interface{} `json:"_meta,omitempty"` // 详细错误信息
|
||||
}
|
||||
|
||||
@@ -23,7 +24,7 @@ type HealthStatus struct {
|
||||
func (c *Client) CheckHealth(ctx context.Context) (*HealthStatus, error) {
|
||||
var status HealthStatus
|
||||
if err := c.request(ctx, "GET", "/v1/system/healthz", nil, &status); err != nil {
|
||||
return nil, fmt.Errorf("check health failed: %w", err)
|
||||
return nil, gerror.Newf("check health failed: %v", err)
|
||||
}
|
||||
return &status, nil
|
||||
}
|
||||
@@ -36,4 +37,3 @@ func (c *Client) IsHealthy(ctx context.Context) (bool, error) {
|
||||
}
|
||||
return status.Status == "ok", nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user