mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
feat: channel gateway implementation and multi-bot refactor
- Refactor channel manager with support for Sender/Receiver interfaces and hot-swappable adapters. - Implement identity routing and pre-authentication logic for inbound messages. - Update database schema to support bot pre-auth keys and extended channel session metadata. - Add Telegram and Feishu channel configuration and adapter enhancements. - Update Swagger documentation and internal handlers for channel management. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -211,7 +211,7 @@ func (s *Service) CountByClientType(ctx context.Context, clientType ClientType)
|
||||
|
||||
// toGetResponse converts a database provider to a response
|
||||
func (s *Service) toGetResponse(provider sqlc.LlmProvider) GetResponse {
|
||||
var metadata map[string]interface{}
|
||||
var metadata map[string]any
|
||||
if len(provider.Metadata) > 0 {
|
||||
_ = json.Unmarshal(provider.Metadata, &metadata)
|
||||
}
|
||||
@@ -268,4 +268,3 @@ func maskAPIKey(apiKey string) string {
|
||||
}
|
||||
return apiKey[:8] + strings.Repeat("*", len(apiKey)-8)
|
||||
}
|
||||
|
||||
|
||||
+18
-19
@@ -15,32 +15,32 @@ const (
|
||||
|
||||
// CreateRequest represents a request to create a new LLM provider
|
||||
type CreateRequest struct {
|
||||
Name string `json:"name" validate:"required"`
|
||||
ClientType ClientType `json:"client_type" validate:"required"`
|
||||
BaseURL string `json:"base_url" validate:"required,url"`
|
||||
APIKey string `json:"api_key"`
|
||||
Metadata map[string]interface{} `json:"metadata,omitempty"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
ClientType ClientType `json:"client_type" validate:"required"`
|
||||
BaseURL string `json:"base_url" validate:"required,url"`
|
||||
APIKey string `json:"api_key"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateRequest represents a request to update an existing LLM provider
|
||||
type UpdateRequest struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
ClientType *ClientType `json:"client_type,omitempty"`
|
||||
BaseURL *string `json:"base_url,omitempty"`
|
||||
APIKey *string `json:"api_key,omitempty"`
|
||||
Metadata map[string]interface{} `json:"metadata,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
ClientType *ClientType `json:"client_type,omitempty"`
|
||||
BaseURL *string `json:"base_url,omitempty"`
|
||||
APIKey *string `json:"api_key,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// GetResponse represents the response for getting a provider
|
||||
type GetResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ClientType string `json:"client_type"`
|
||||
BaseURL string `json:"base_url"`
|
||||
APIKey string `json:"api_key,omitempty"` // masked in response
|
||||
Metadata map[string]interface{} `json:"metadata,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ClientType string `json:"client_type"`
|
||||
BaseURL string `json:"base_url"`
|
||||
APIKey string `json:"api_key,omitempty"` // masked in response
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// ListResponse represents the response for listing providers
|
||||
@@ -68,4 +68,3 @@ type TestResponse struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Latency int64 `json:"latency_ms,omitempty"` // latency in milliseconds
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user