refactor: 项目更名 WeKnora → Academy
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名) - 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块) - docreader proto 描述符采用等长替换,保持序列化字节布局有效 - Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像 - 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
This commit is contained in:
1 parent
9097ee699d
commit
9058149576
3136 files changed
+18018
-18004
No files matched your search
@@ -4,9 +4,9 @@ package router
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
sessionhandler "github.com/Tencent/WeKnora/internal/handler/session"
|
||||
"academy/internal/config"
|
||||
"academy/internal/handler"
|
||||
sessionhandler "academy/internal/handler/session"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/sandbox"
|
||||
"github.com/Tencent/WeKnora/internal/sandbox/allocation"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/sandbox"
|
||||
"academy/internal/sandbox/allocation"
|
||||
)
|
||||
|
||||
func deploymentCapabilitiesFromRouter(params RouterParams) handler.DeploymentCapabilitiesData {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/service"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/sandbox"
|
||||
"academy/internal/application/service"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/sandbox"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -35,7 +35,7 @@ func TestEmbedFramePolicy(t *testing.T) {
|
||||
webDir := t.TempDir()
|
||||
require.NoError(t, os.WriteFile(filepath.Join(webDir, "index.html"), []byte("main SPA"), 0o600))
|
||||
require.NoError(t, os.WriteFile(filepath.Join(webDir, "embed.html"), []byte("embed entry"), 0o600))
|
||||
t.Setenv("WEKNORA_WEB_DIR", webDir)
|
||||
t.Setenv("ACADEMY_WEB_DIR", webDir)
|
||||
r := gin.New()
|
||||
r.Use(embedFrameAncestorsMiddleware(framePolicyService{}))
|
||||
serveFrontendStatic(r)
|
||||
|
||||
+11
-11
@@ -10,16 +10,16 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/access"
|
||||
filesvc "github.com/Tencent/WeKnora/internal/application/service/file"
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
apperrors "github.com/Tencent/WeKnora/internal/errors"
|
||||
"github.com/Tencent/WeKnora/internal/filetransport"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/application/access"
|
||||
filesvc "academy/internal/application/service/file"
|
||||
"academy/internal/config"
|
||||
apperrors "academy/internal/errors"
|
||||
"academy/internal/filetransport"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
secutils "academy/internal/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -256,7 +256,7 @@ func serveFilesWithResources(
|
||||
}
|
||||
|
||||
// serveResourceGrants exposes short, revocable capability URLs for clients
|
||||
// such as IM platforms that cannot attach a WeKnora bearer/embed token.
|
||||
// such as IM platforms that cannot attach a Academy bearer/embed token.
|
||||
func serveResourceGrants(
|
||||
r *gin.Engine,
|
||||
resourceCatalog interfaces.ResourceCatalog,
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"academy/internal/config"
|
||||
"academy/internal/handler"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package router
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/agent/operations"
|
||||
"academy/internal/agent/operations"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,18 +9,18 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/agent/approval"
|
||||
"github.com/Tencent/WeKnora/internal/agent/operations"
|
||||
"github.com/Tencent/WeKnora/internal/agent/tools"
|
||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/application/service"
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/event"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/mcp"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/agent/approval"
|
||||
"academy/internal/agent/operations"
|
||||
"academy/internal/agent/tools"
|
||||
"academy/internal/application/repository"
|
||||
"academy/internal/application/service"
|
||||
"academy/internal/config"
|
||||
"academy/internal/event"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/mcp"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
"academy/internal/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
sdkmcp "github.com/mark3labs/mcp-go/mcp"
|
||||
sdkserver "github.com/mark3labs/mcp-go/server"
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/agent/operations"
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/handler/session"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/agent/operations"
|
||||
"academy/internal/config"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/handler/session"
|
||||
"academy/internal/types"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/config"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -39,7 +39,7 @@ import (
|
||||
// uniformly.
|
||||
//
|
||||
// NO — Tenant-wide infrastructure: Model, VectorStore, IM channel,
|
||||
// WebSearchProvider, DataSource, MCPService, WeKnoraCloud
|
||||
// WebSearchProvider, DataSource, MCPService, AcademyCloud
|
||||
// credentials.
|
||||
// => Mutating routes use Admin().
|
||||
// There is no "creator-of-the-vector-store" concept; configuring
|
||||
|
||||
+20
-20
@@ -13,20 +13,20 @@ import (
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
"go.uber.org/dig"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/agent/operations"
|
||||
"github.com/Tencent/WeKnora/internal/application/service"
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/handler/orgcenter"
|
||||
"github.com/Tencent/WeKnora/internal/handler/session"
|
||||
"github.com/Tencent/WeKnora/internal/handler/training"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/mcpserver"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/agent/operations"
|
||||
"academy/internal/application/service"
|
||||
"academy/internal/config"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/handler/orgcenter"
|
||||
"academy/internal/handler/session"
|
||||
"academy/internal/handler/training"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/mcpserver"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/tracing/langfuse"
|
||||
"academy/internal/types/interfaces"
|
||||
|
||||
_ "github.com/Tencent/WeKnora/docs" // swagger docs
|
||||
_ "academy/docs" // swagger docs
|
||||
)
|
||||
|
||||
// RouterParams 路由参数
|
||||
@@ -94,7 +94,7 @@ type RouterParams struct {
|
||||
RedisClient *redis.Client
|
||||
DataSourceHandler *handler.DataSourceHandler
|
||||
DataSourceCredentialsHandler *handler.DataSourceCredentialsHandler
|
||||
WeKnoraCloudHandler *handler.WeKnoraCloudHandler
|
||||
AcademyCloudHandler *handler.AcademyCloudHandler
|
||||
WikiPageHandler *handler.WikiPageHandler
|
||||
MemoryHandler *handler.MemoryHandler
|
||||
AutomationHandler *handler.AutomationHandler
|
||||
@@ -116,7 +116,7 @@ func NewRouter(params RouterParams) *gin.Engine {
|
||||
// embed endpoints rate-limit per (channel, ClientIP), so a spoofed XFF would
|
||||
// trivially bypass the limiter. Restrict to the fronting proxy network so
|
||||
// only the real client IP (appended by nginx) is returned. Configurable via
|
||||
// WEKNORA_TRUSTED_PROXIES (comma-separated CIDRs/IPs).
|
||||
// ACADEMY_TRUSTED_PROXIES (comma-separated CIDRs/IPs).
|
||||
if err := r.SetTrustedProxies(trustedProxies()); err != nil {
|
||||
logger.Errorf(context.Background(), "[Router] failed to set trusted proxies: %v", err)
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func NewRouter(params RouterParams) *gin.Engine {
|
||||
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
AllowHeaders: []string{
|
||||
"Origin", "Content-Type", "Accept", "Authorization", "X-API-Key", "X-Request-ID", "X-Tenant-ID",
|
||||
"X-Embed-Session", "X-External-User-ID", "X-External-User-Token", "X-WeKnora-Desktop-Token",
|
||||
"X-Embed-Session", "X-External-User-ID", "X-External-User-Token", "X-Academy-Desktop-Token",
|
||||
// Streamable HTTP MCP clients running in a browser send these on
|
||||
// the /mcp/:endpoint_id surface.
|
||||
"MCP-Protocol-Version", "Mcp-Method", "Mcp-Name", "Mcp-Session-Id", "Last-Event-ID",
|
||||
@@ -199,7 +199,7 @@ func NewRouter(params RouterParams) *gin.Engine {
|
||||
RegisterMCPServerRoutes(r, params.MCPServer, params.MCPEndpointService, params.TenantService)
|
||||
|
||||
// Short-lived capability URLs for IM and other clients that cannot attach
|
||||
// WeKnora authentication headers.
|
||||
// Academy authentication headers.
|
||||
serveResourceGrants(r, params.ResourceCatalog, params.TenantService, params.FileService, params.StorageBackendResolver)
|
||||
|
||||
// Sandbox terminal WebSocket (self-authenticated via a short-lived
|
||||
@@ -332,7 +332,7 @@ func NewRouter(params RouterParams) *gin.Engine {
|
||||
RegisterEmbedChannelRoutes(v1, params.EmbedChannelHandler, rbacGuards)
|
||||
RegisterMCPEndpointRoutes(v1, params.MCPEndpointHandler, rbacGuards)
|
||||
RegisterDataSourceRoutes(v1, params.DataSourceHandler, params.DataSourceCredentialsHandler, rbacGuards)
|
||||
RegisterWeKnoraCloudRoutes(v1, params.WeKnoraCloudHandler, rbacGuards)
|
||||
RegisterAcademyCloudRoutes(v1, params.AcademyCloudHandler, rbacGuards)
|
||||
RegisterWikiPageRoutes(v1, params.WikiPageHandler, rbacGuards)
|
||||
RegisterMemoryRoutes(v1, params.MemoryHandler, rbacGuards)
|
||||
RegisterAutomationRoutes(v1, params.AutomationHandler, rbacGuards)
|
||||
@@ -358,10 +358,10 @@ func NewRouter(params RouterParams) *gin.Engine {
|
||||
// trustedProxies returns the proxy CIDRs/IPs whose X-Forwarded-For headers
|
||||
// gin should trust when resolving the client IP. Defaults to loopback and
|
||||
// private ranges (covers the bundled nginx in a container network); override
|
||||
// with WEKNORA_TRUSTED_PROXIES (comma-separated). An explicit empty value
|
||||
// with ACADEMY_TRUSTED_PROXIES (comma-separated). An explicit empty value
|
||||
// disables proxy trust entirely so ClientIP() returns the direct peer.
|
||||
func trustedProxies() []string {
|
||||
raw, ok := os.LookupEnv("WEKNORA_TRUSTED_PROXIES")
|
||||
raw, ok := os.LookupEnv("ACADEMY_TRUSTED_PROXIES")
|
||||
if !ok {
|
||||
return []string{
|
||||
"127.0.0.0/8",
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
sessionhandler "github.com/Tencent/WeKnora/internal/handler/session"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/handler"
|
||||
sessionhandler "academy/internal/handler/session"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -350,7 +350,7 @@ func TestTenantInfrastructureRoutesDeclareSpecificCapabilities(t *testing.T) {
|
||||
RegisterEmbedChannelRoutes(v1, &handler.EmbedChannelHandler{}, g)
|
||||
RegisterIMChannelRoutes(v1, &handler.IMHandler{}, g)
|
||||
RegisterDataSourceRoutes(v1, &handler.DataSourceHandler{}, &handler.DataSourceCredentialsHandler{}, g)
|
||||
RegisterWeKnoraCloudRoutes(v1, &handler.WeKnoraCloudHandler{}, g)
|
||||
RegisterAcademyCloudRoutes(v1, &handler.AcademyCloudHandler{}, g)
|
||||
|
||||
capabilitiesPolicy := mustLookupAPIKeyPolicy(t, g, http.MethodGet, "/api/v1/system/capabilities")
|
||||
if capabilitiesPolicy.RequireFullAccess || len(capabilitiesPolicy.Capabilities) != 0 {
|
||||
@@ -380,7 +380,7 @@ func TestTenantInfrastructureRoutesDeclareSpecificCapabilities(t *testing.T) {
|
||||
{http.MethodGet, "/api/v1/embed-channels", types.APIKeyCapabilityManageChannels},
|
||||
{http.MethodGet, "/api/v1/im-channels", types.APIKeyCapabilityManageChannels},
|
||||
{http.MethodGet, "/api/v1/datasource", types.APIKeyCapabilityManageDataSources},
|
||||
{http.MethodGet, "/api/v1/models/weknoracloud/status", types.APIKeyCapabilityManageModels},
|
||||
{http.MethodGet, "/api/v1/models/academycloud/status", types.APIKeyCapabilityManageModels},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
apprepo "github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
apprepo "academy/internal/application/repository"
|
||||
"academy/internal/config"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
secutils "academy/internal/utils"
|
||||
)
|
||||
|
||||
// stubTenantService is a minimal stub of interfaces.TenantService that only
|
||||
@@ -68,7 +68,7 @@ func (s *stubTenantService) GetTenantByIDForUser(context.Context, uint64, string
|
||||
panic("unexpected")
|
||||
}
|
||||
|
||||
func (s *stubTenantService) GetWeKnoraCloudCredentials(context.Context) *types.WeKnoraCloudCredentials {
|
||||
func (s *stubTenantService) GetAcademyCloudCredentials(context.Context) *types.AcademyCloudCredentials {
|
||||
panic("unexpected")
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func setupPresignedTestServer(t *testing.T) (engine *gin.Engine, baseDir string,
|
||||
t.Helper()
|
||||
gin.SetMode(gin.TestMode)
|
||||
t.Setenv("SYSTEM_SIGNING_KEY", "")
|
||||
t.Setenv("SYSTEM_AES_KEY", "weknora-test-aes-key-32bytes!!!")
|
||||
t.Setenv("SYSTEM_AES_KEY", "academy-test-aes-key-32bytes!!!")
|
||||
|
||||
baseDir = t.TempDir()
|
||||
|
||||
@@ -105,7 +105,7 @@ func setupPresignedTestServer(t *testing.T) (engine *gin.Engine, baseDir string,
|
||||
engine.HEAD("/api/v1/files/presigned", handler)
|
||||
|
||||
signURL = func(filePath string, tenantID uint64, ttl time.Duration) string {
|
||||
signed, err := secutils.SignFileURL("https://weknora.example.com", filePath, tenantID, ttl)
|
||||
signed, err := secutils.SignFileURL("https://academy.example.com", filePath, tenantID, ttl)
|
||||
if err != nil {
|
||||
t.Fatalf("SignFileURL: %v", err)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestFrontendStaticDoesNotInterceptResourceGrant(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
webDir := t.TempDir()
|
||||
require.NoError(t, os.WriteFile(filepath.Join(webDir, "index.html"), []byte("spa"), 0o600))
|
||||
t.Setenv("WEKNORA_WEB_DIR", webDir)
|
||||
t.Setenv("ACADEMY_WEB_DIR", webDir)
|
||||
|
||||
r := gin.New()
|
||||
serveFrontendStatic(r)
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
apprepo "github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
apprepo "academy/internal/application/repository"
|
||||
"academy/internal/config"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/embedpolicy"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/embedpolicy"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
// RegisterCustomAgentRoutes registers custom agent routes.
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// RegisterTenantRoutes 注册空间相关的路由
|
||||
|
||||
@@ -3,7 +3,7 @@ package router
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"academy/internal/handler"
|
||||
)
|
||||
|
||||
// RegisterAutomationRoutes registers the caller's automations and in-app
|
||||
|
||||
@@ -3,8 +3,8 @@ package router
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/handler/session"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/handler/session"
|
||||
)
|
||||
|
||||
// RegisterMessageRoutes 注册消息相关的路由。
|
||||
|
||||
@@ -3,7 +3,7 @@ package router
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"academy/internal/handler"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/types"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"academy/internal/handler"
|
||||
)
|
||||
|
||||
// Models are tenant-wide infrastructure (LLM credentials, embeddings,
|
||||
@@ -153,7 +153,7 @@ func RegisterMCPServiceRoutes(
|
||||
// MCP OAuth provider redirect. Registered OUTSIDE the /mcp-services group
|
||||
// to avoid a static-vs-":id" route conflict, and left unauthenticated
|
||||
// (allow-listed in middleware/auth.go) because the third-party browser
|
||||
// redirect carries no WeKnora bearer — the single-use state authenticates.
|
||||
// redirect carries no Academy bearer — the single-use state authenticates.
|
||||
r.GET("/mcp-oauth/callback", oauthHandler.Callback)
|
||||
|
||||
mcpServices := g.apiKeyGroup(r.Group("/mcp-services"), apiKeyManageMCPServices(apiKeyFullAccess()))
|
||||
@@ -351,11 +351,11 @@ func RegisterDataSourceRoutes(
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterWeKnoraCloudRoutes 注册 WeKnoraCloud 初始化路由
|
||||
// RegisterWeKnoraCloudRoutes registers the WeKnoraCloud credential
|
||||
// RegisterAcademyCloudRoutes 注册 AcademyCloud 初始化路由
|
||||
// RegisterAcademyCloudRoutes registers the AcademyCloud credential
|
||||
// management endpoints. SaveCredentials persists external SaaS keys
|
||||
// for the tenant (Admin+), Status is a low-risk readiness probe (Viewer+).
|
||||
func RegisterWeKnoraCloudRoutes(r *gin.RouterGroup, handler *handler.WeKnoraCloudHandler, g *rbacGuards) {
|
||||
g.apiKeyRoute(r, http.MethodPost, "/weknoracloud/credentials", apiKeyManageModels(apiKeyFullAccess()), g.Admin(), handler.SaveCredentials)
|
||||
g.apiKeyRoute(r, http.MethodGet, "/models/weknoracloud/status", apiKeyManageModels(apiKeyFullAccess()), g.Viewer(), handler.Status)
|
||||
func RegisterAcademyCloudRoutes(r *gin.RouterGroup, handler *handler.AcademyCloudHandler, g *rbacGuards) {
|
||||
g.apiKeyRoute(r, http.MethodPost, "/academycloud/credentials", apiKeyManageModels(apiKeyFullAccess()), g.Admin(), handler.SaveCredentials)
|
||||
g.apiKeyRoute(r, http.MethodGet, "/models/academycloud/status", apiKeyManageModels(apiKeyFullAccess()), g.Viewer(), handler.Status)
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"academy/internal/handler"
|
||||
)
|
||||
|
||||
// RegisterChunkerDebugRoutes wires the read-only chunker preview endpoint
|
||||
|
||||
@@ -3,10 +3,10 @@ package router
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/mcpserver"
|
||||
"github.com/Tencent/WeKnora/internal/middleware"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/mcpserver"
|
||||
"academy/internal/middleware"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/service"
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"github.com/Tencent/WeKnora/internal/mcpserver"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/application/service"
|
||||
"academy/internal/config"
|
||||
"academy/internal/handler"
|
||||
"academy/internal/mcpserver"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package router
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/handler"
|
||||
"academy/internal/handler"
|
||||
)
|
||||
|
||||
// RegisterMemoryRoutes registers the personal long-term memory endpoints.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/Tencent/WeKnora/internal/handler/orgcenter"
|
||||
"academy/internal/handler/orgcenter"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/Tencent/WeKnora/internal/handler/training"
|
||||
"academy/internal/handler/training"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"academy/internal/logger"
|
||||
)
|
||||
|
||||
// serveFrontendStatic registers a middleware that serves the frontend SPA
|
||||
// from the ./web directory if it exists. Must be called BEFORE auth middleware
|
||||
// so static files are served without authentication.
|
||||
func serveFrontendStatic(r *gin.Engine) {
|
||||
webDir := os.Getenv("WEKNORA_WEB_DIR")
|
||||
webDir := os.Getenv("ACADEMY_WEB_DIR")
|
||||
if webDir == "" {
|
||||
webDir = "./web"
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/service"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/middleware/asynqdl"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/application/service"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/middleware/asynqdl"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/google/uuid"
|
||||
"github.com/hibiken/asynq"
|
||||
"go.uber.org/dig"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/hibiken/asynq"
|
||||
)
|
||||
|
||||
|
||||
+10
-10
@@ -11,13 +11,13 @@ import (
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/service"
|
||||
"github.com/Tencent/WeKnora/internal/common"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/middleware/asynqdl"
|
||||
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/application/service"
|
||||
"academy/internal/common"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/middleware/asynqdl"
|
||||
"academy/internal/tracing/langfuse"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/hibiken/asynq"
|
||||
"go.uber.org/dig"
|
||||
)
|
||||
@@ -58,11 +58,11 @@ type AsynqTaskParams struct {
|
||||
// raise the default to 500ms while still allowing operators to tune via env.
|
||||
const defaultRedisOpTimeoutMs = 500
|
||||
|
||||
// readRedisOpTimeoutMs reads WEKNORA_REDIS_OP_TIMEOUT_MS, falling back to
|
||||
// readRedisOpTimeoutMs reads ACADEMY_REDIS_OP_TIMEOUT_MS, falling back to
|
||||
// defaultRedisOpTimeoutMs on missing/invalid input. Kept as a separate helper
|
||||
// so both ReadTimeout and WriteTimeout share the same source of truth.
|
||||
func readRedisOpTimeoutMs() int {
|
||||
if v := strings.TrimSpace(os.Getenv("WEKNORA_REDIS_OP_TIMEOUT_MS")); v != "" {
|
||||
if v := strings.TrimSpace(os.Getenv("ACADEMY_REDIS_OP_TIMEOUT_MS")); v != "" {
|
||||
if parsed, err := strconv.Atoi(v); err == nil && parsed > 0 {
|
||||
return parsed
|
||||
}
|
||||
@@ -218,7 +218,7 @@ func NewSharedAsynqServer(svc interfaces.SystemSettingService) *asynq.Server {
|
||||
|
||||
// NewWikiAsynqServer builds the dedicated wiki pool: QueueWiki only. It runs
|
||||
// the shared handler mux but only ever pulls wiki tasks, so its concurrency
|
||||
// budget (WEKNORA_WIKI_ASYNQ_CONCURRENCY, default 8) is spent exclusively on
|
||||
// budget (ACADEMY_WIKI_ASYNQ_CONCURRENCY, default 8) is spent exclusively on
|
||||
// wiki generation. This is the hard capacity isolation that prevents the parse
|
||||
// pipeline from starving wiki (and vice-versa) during concurrent uploads.
|
||||
func NewWikiAsynqServer(svc interfaces.SystemSettingService) *asynq.Server {
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/application/service"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/application/repository"
|
||||
"academy/internal/application/service"
|
||||
"academy/internal/types"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/driver/sqlite"
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"testing"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/application/repository"
|
||||
"academy/internal/types"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/driver/sqlite"
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/application/repository"
|
||||
"academy/internal/types"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/driver/sqlite"
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/alicebob/miniredis/v2"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/alicebob/miniredis/v2"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types"
|
||||
"github.com/alicebob/miniredis/v2"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/application/repository"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/driver/sqlite"
|
||||
|
||||
Reference in new issue
Block a user