yao/kb/api/consts.go
Max 704c0331b1 Enhance Assistant stream functionality and remove history handling
- Added permission validation in the Assistant's Stream method to ensure user authorization before processing input messages.
- Introduced conversation initialization within the Stream method to prepare the context for chat interactions.
- Removed the history.go file, which previously contained a placeholder method for handling chat history, streamlining the Assistant's codebase.
- Updated the Knowledge Base API integration in collection management, ensuring all collection operations utilize the new API structure for improved consistency and error handling.
2025-12-08 10:28:26 +08:00

57 lines
1.7 KiB
Go

package api
import "github.com/yaoapp/gou/model"
// Collection field definitions
var (
// AvailableCollectionFields defines all available fields for security filtering
AvailableCollectionFields = map[string]bool{
"id": true, "collection_id": true, "name": true, "description": true,
"status": true, "preset": true, "public": true, "share": true, "sort": true, "cover": true,
"document_count": true, "embedding_provider_id": true, "embedding_option_id": true,
"embedding_properties": true, "locale": true, "dimension": true,
"distance_metric": true, "hnsw_m": true, "ef_construction": true,
"ef_search": true, "num_lists": true, "num_probes": true,
"created_at": true, "updated_at": true,
}
// DefaultCollectionFields defines the default compact field list
DefaultCollectionFields = []interface{}{
"id", "collection_id", "name", "description", "status", "preset", "public", "share",
"sort", "cover", "document_count", "embedding_provider_id", "embedding_option_id",
"locale", "dimension", "distance_metric", "created_at", "updated_at",
}
// ValidCollectionSortFields defines valid fields for sorting
ValidCollectionSortFields = map[string]bool{
"created_at": true,
"updated_at": true,
"name": true,
"sort": true,
"document_count": true,
"status": true,
}
)
// Default pagination settings
const (
DefaultPage = 1
DefaultPageSize = 20
MaxPageSize = 100
)
// Default sort settings
const (
DefaultSortField = "created_at"
DefaultSortOrder = "desc"
)
// DefaultSort defines the default sort order for collection queries
var DefaultSort = []model.QueryOrder{
{Column: DefaultSortField, Option: DefaultSortOrder},
}
// Default locale
const (
DefaultLocale = "en"
)