feat: enhance localization and configuration support

- Added timezone and language settings to the environment configuration.
- Introduced built-in agent configurations with multilingual support for various agents.
- Updated Docker Compose to utilize new environment variables for timezone and language.
- Created new prompt templates for question generation, summary generation, and keywords extraction.
This commit is contained in:
wizardchen
2026-03-17 15:33:19 +08:00
committed by lyingbug
parent 09d9fe5ddb
commit 139a9c40ff
54 changed files with 2524 additions and 1482 deletions
+15
View File
@@ -16,6 +16,7 @@ import (
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"github.com/Tencent/WeKnora/internal/types/interfaces"
secutils "github.com/Tencent/WeKnora/internal/utils"
"github.com/gin-gonic/gin"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
@@ -169,6 +170,13 @@ func (h *SystemHandler) ReconnectDocReader(c *gin.Context) {
return
}
// SSRF validation for docreader address
if err := secutils.ValidateURLForSSRF(addr); err != nil {
logger.Warnf(c.Request.Context(), "SSRF validation failed for docreader addr: %v", err)
c.JSON(400, gin.H{"code": 1, "msg": fmt.Sprintf("地址未通过安全校验: %v", err)})
return
}
if h.documentReader == nil {
c.JSON(500, gin.H{"code": 1, "msg": "document converter not initialized"})
return
@@ -637,11 +645,18 @@ func sanitizeStorageCheckError(err error) string {
// isBlockedStorageEndpoint checks whether a storage endpoint resolves to a dangerous
// address (cloud metadata, loopback, link-local). Unlike the stricter IsSSRFSafeURL,
// this allows private IPs since MinIO is commonly deployed on internal networks.
// It also respects the SSRF_WHITELIST environment variable for whitelisted hosts.
func isBlockedStorageEndpoint(endpoint string) (bool, string) {
host, _, err := net.SplitHostPort(endpoint)
if err != nil {
host = endpoint
}
// Check SSRF whitelist first – whitelisted hosts bypass the block check.
if secutils.IsSSRFWhitelisted(host) {
return false, ""
}
hostLower := strings.ToLower(host)
blockedHosts := []string{