mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-02 05:47:31 +08:00
Go: fix list services (#17664)
### Summary 1. Fix admin list services; 2. Fix admin show service 'service_name'; Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -66,14 +66,14 @@ type DocEngine interface {
|
||||
GetAggregation(chunks []map[string]interface{}, fieldName string) []map[string]interface{}
|
||||
GetHighlight(chunks []map[string]interface{}, keywords []string, fieldName string) map[string]string
|
||||
|
||||
// Run SQL
|
||||
// RunSQL runs a SQL query
|
||||
RunSQL(ctx context.Context, tableName string, sqlText string, kbIDs []string, format string) ([]map[string]interface{}, error)
|
||||
|
||||
GetChunkIDs(chunks []map[string]interface{}) []string
|
||||
KNNScores(ctx context.Context, chunks []map[string]interface{}, queryVector []float64, topK int) (map[string]interface{}, error)
|
||||
GetScores(searchResult map[string]interface{}) map[string]float64
|
||||
|
||||
// Health check
|
||||
// Ping check the engine is alive
|
||||
Ping(ctx context.Context) error
|
||||
Close() error
|
||||
|
||||
@@ -101,6 +101,7 @@ func Type(docEngine DocEngine) EngineType {
|
||||
|
||||
type MessageQueue interface {
|
||||
Init() error
|
||||
Type() string
|
||||
InitConsumer(subject string) error
|
||||
PublishTask(subject string, payload []byte) error
|
||||
GetMessages(messageCount int) ([]common.TaskHandle, error)
|
||||
|
||||
@@ -97,6 +97,10 @@ func (n *NatsEngine) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *NatsEngine) Type() string {
|
||||
return "nats"
|
||||
}
|
||||
|
||||
func (n *NatsEngine) PublishTask(subject string, payload []byte) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
@@ -374,7 +374,7 @@ func (r *Client) SetNX(key string, value string, exp time.Duration) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
// GetOrCreateSecretKey atomically retrieves an existing key or creates a new one
|
||||
// GetOrCreateKey atomically retrieves an existing key or creates a new one
|
||||
// Uses Redis SETNX command to ensure atomicity across multiple goroutines/processes
|
||||
func (r *Client) GetOrCreateKey(key string, value string) (string, error) {
|
||||
if r.client == nil {
|
||||
|
||||
Reference in New Issue
Block a user