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

- 全量替换代码/配置/文档中的项目名(保留上游 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:
runny committed 2026-11-13 20:52:51 +08:00
1 parent 9097ee699d
commit 9058149576
3136 files changed
+18018 -18004

No files matched your search

+23 -23
View File
@@ -27,14 +27,14 @@ import (
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/container"
"github.com/Tencent/WeKnora/internal/handler"
"github.com/Tencent/WeKnora/internal/handler/session"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/runtime"
"github.com/Tencent/WeKnora/internal/stream"
"github.com/Tencent/WeKnora/internal/types/interfaces"
"academy/internal/config"
"academy/internal/container"
"academy/internal/handler"
"academy/internal/handler/session"
"academy/internal/logger"
"academy/internal/runtime"
"academy/internal/stream"
"academy/internal/types/interfaces"
"github.com/joho/godotenv"
wailsruntime "github.com/wailsapp/wails/v2/pkg/runtime"
)
@@ -176,9 +176,9 @@ window.open=function(url){
})();`
// wailsThemeSyncJS:与 index.html 首屏一致,在 DomReady 再跑一遍,覆盖 Ctrl+R 后 runtime 就绪时机
const wailsThemeSyncJS = `(function(){try{var t=localStorage.getItem('WeKnora_theme')||'light';if(t==='system')t=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';var bg=t==='dark'?'#181818':'#eee';document.documentElement.setAttribute('theme-mode',t);document.documentElement.style.background=bg;document.documentElement.style.minHeight='100%';document.documentElement.style.colorScheme=t==='dark'?'dark':'light';if(document.body){document.body.style.background=bg;document.body.style.minHeight='100%';}var w=window.runtime;if(!w)return;if(t==='dark'){if(w.WindowSetDarkTheme)w.WindowSetDarkTheme();if(w.WindowSetBackgroundColour)w.WindowSetBackgroundColour(24,24,24,255);}else{if(w.WindowSetLightTheme)w.WindowSetLightTheme();if(w.WindowSetBackgroundColour)w.WindowSetBackgroundColour(238,238,238,255);}}catch(e){}})()`
const wailsThemeSyncJS = `(function(){try{var t=localStorage.getItem('Academy_theme')||'light';if(t==='system')t=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';var bg=t==='dark'?'#181818':'#eee';document.documentElement.setAttribute('theme-mode',t);document.documentElement.style.background=bg;document.documentElement.style.minHeight='100%';document.documentElement.style.colorScheme=t==='dark'?'dark':'light';if(document.body){document.body.style.background=bg;document.body.style.minHeight='100%';}var w=window.runtime;if(!w)return;if(t==='dark'){if(w.WindowSetDarkTheme)w.WindowSetDarkTheme();if(w.WindowSetBackgroundColour)w.WindowSetBackgroundColour(24,24,24,255);}else{if(w.WindowSetLightTheme)w.WindowSetLightTheme();if(w.WindowSetBackgroundColour)w.WindowSetBackgroundColour(238,238,238,255);}}catch(e){}})()`
const weknoraGitHubRepoURL = "https://github.com/Tencent/WeKnora"
const academyGitHubRepoURL = "https://academy"
// ensureDesktopLiteEdition marks this process as Lite. cmd/desktop is the
// Lite app; packaged builds also inject this via ldflags. wails dev often
@@ -253,7 +253,7 @@ func main() {
panic(fmt.Sprintf("wire desktop project dirs: %v", err))
}
// Initialize the WeKnora App struct
// Initialize the Academy App struct
app := NewApp()
setupBytes := make([]byte, 32)
if _, err := rand.Read(setupBytes); err != nil {
@@ -352,15 +352,15 @@ func main() {
// Create application with options
// macOS app menu
AppMenu := menu.NewMenu()
FileMenu := AppMenu.AddSubmenu("WeKnora Lite")
FileMenu.AddText("About WeKnora", keys.CmdOrCtrl("i"), func(_ *menu.CallbackData) {
FileMenu := AppMenu.AddSubmenu("Academy Lite")
FileMenu.AddText("About Academy", keys.CmdOrCtrl("i"), func(_ *menu.CallbackData) {
if app.ctx == nil {
return
}
choice, err := wailsruntime.MessageDialog(app.ctx, wailsruntime.MessageDialogOptions{
Type: wailsruntime.InfoDialog,
Title: "WeKnora Lite",
Message: fmt.Sprintf("WeKnora Lite — Desktop Edition\n\nA RAG framework for document understanding and semantic Q&A over complex, heterogeneous content.\n\nVersion %s\n© 2026 Tencent\n\nGitHub:\n%s", desktopAboutVersion(), weknoraGitHubRepoURL),
Title: "Academy Lite",
Message: fmt.Sprintf("Academy Lite — Desktop Edition\n\nA RAG framework for document understanding and semantic Q&A over complex, heterogeneous content.\n\nVersion %s\n© 2026 Tencent\n\nGitHub:\n%s", desktopAboutVersion(), academyGitHubRepoURL),
Buttons: []string{"Open GitHub", "OK"},
DefaultButton: "OK",
})
@@ -369,7 +369,7 @@ func main() {
return
}
if choice == "Open GitHub" {
wailsruntime.BrowserOpenURL(app.ctx, weknoraGitHubRepoURL)
wailsruntime.BrowserOpenURL(app.ctx, academyGitHubRepoURL)
}
})
FileMenu.AddText("Check for Updates...", nil, func(_ *menu.CallbackData) {
@@ -400,7 +400,7 @@ func main() {
// Start Wails application
// We use a Reverse Proxy to seamlessly proxy Wails' frontend to our Go backend
err := wails.Run(&options.App{
Title: "WeKnora Lite",
Title: "Academy Lite",
Width: 1280,
Height: 800,
DisableResize: false,
@@ -416,11 +416,11 @@ func main() {
// 注入真实 API 根路径(与 window.location.origin 不同);无 Go 绑定时仍可显示。
if u := strings.TrimSpace(app.backendURL); u != "" {
apiRoot := strings.TrimRight(u, "/") + "/api/v1"
inject := fmt.Sprintf(`try{window.__WEKNORA_API_BASE__=%s}catch(e){}`, strconv.Quote(apiRoot))
inject := fmt.Sprintf(`try{window.__ACADEMY_API_BASE__=%s}catch(e){}`, strconv.Quote(apiRoot))
wailsruntime.WindowExecJS(ctx, inject)
}
if lan := strings.TrimSpace(app.apiLanBaseURL); lan != "" {
injectLan := fmt.Sprintf(`try{window.__WEKNORA_API_LAN_BASE__=%s}catch(e){}`, strconv.Quote(lan))
injectLan := fmt.Sprintf(`try{window.__ACADEMY_API_LAN_BASE__=%s}catch(e){}`, strconv.Quote(lan))
wailsruntime.WindowExecJS(ctx, injectLan)
}
},
@@ -455,7 +455,7 @@ func configureDesktopStorage(execPath string) {
targetDataDir := filepath.Join(appSupportDir, "data")
migrateLegacyDesktopData(legacyResourcesDir, targetDataDir)
dbPath := resolveDesktopDataPath(os.Getenv("DB_PATH"), filepath.Join("data", "weknora.db"), appSupportDir)
dbPath := resolveDesktopDataPath(os.Getenv("DB_PATH"), filepath.Join("data", "academy.db"), appSupportDir)
if err := os.MkdirAll(filepath.Dir(dbPath), 0o755); err != nil {
logger.Warnf(context.Background(), "Failed to create desktop DB directory %s: %v", filepath.Dir(dbPath), err)
@@ -464,7 +464,7 @@ func configureDesktopStorage(execPath string) {
_ = os.Setenv("DB_PATH", dbPath)
}
// configureDesktopFileStorage points Lite file uploads at ~/.weknora/data/files.
// configureDesktopFileStorage points Lite file uploads at ~/.academy/data/files.
// wails dev is not always inside a packaged .app, so this runs for every
// desktop process. An explicit absolute directory is kept; the Docker default
// /data/files is not writable on macOS and is replaced. Uploads move over from
@@ -491,7 +491,7 @@ func configureDesktopFileStorage(execPath string) {
}
func desktopLocalFilesDir(home string) string {
return filepath.Join(home, ".weknora", "data", "files")
return filepath.Join(home, ".academy", "data", "files")
}
func useDesktopFilesDir(raw string) bool {
@@ -546,7 +546,7 @@ func defaultMacAppSupportDir(execPath string) (string, error) {
return "", err
}
appName := "WeKnora Lite"
appName := "Academy Lite"
if idx := strings.Index(execPath, ".app/Contents/MacOS"); idx >= 0 {
bundleName := filepath.Base(execPath[:idx+4])
if trimmed := strings.TrimSuffix(bundleName, ".app"); trimmed != "" {
+1 -1
View File
@@ -11,7 +11,7 @@ import (
func main() {
app := NewApp()
_ = wails.Run(&options.App{
Title: "WeKnora Lite",
Title: "Academy Lite",
Bind: []interface{}{app},
})
}
+2 -2
View File
@@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"
"github.com/Tencent/WeKnora/internal/localsandbox"
"academy/internal/localsandbox"
)
const desktopPrefsFileName = "desktop-prefs.json"
@@ -39,7 +39,7 @@ func desktopPrefsDir() (string, error) {
if err != nil {
return "", err
}
dir := filepath.Join(cfg, "WeKnora Lite")
dir := filepath.Join(cfg, "Academy Lite")
if err := os.MkdirAll(dir, 0o755); err != nil {
return "", err
}
+10 -10
View File
@@ -6,8 +6,8 @@ import (
"reflect"
"testing"
"github.com/Tencent/WeKnora/internal/handler"
"github.com/Tencent/WeKnora/internal/utils"
"academy/internal/handler"
"academy/internal/utils"
"github.com/stretchr/testify/require"
)
@@ -15,7 +15,7 @@ func TestDesktopSigningKeyKeepsExistingAESHMAC(t *testing.T) {
dir := t.TempDir()
aes := "abcdefghijklmnopqrstuvwxyz123456"
t.Setenv("SYSTEM_SIGNING_KEY", "")
t.Setenv("JWT_SECRET", "weknora-jwt-secret")
t.Setenv("JWT_SECRET", "academy-jwt-secret")
t.Setenv("SYSTEM_AES_KEY", aes)
require.Equal(t, aes, string(utils.SystemHMACKey()))
require.NoError(t, ensureDesktopSigningKeyInDir(dir))
@@ -27,7 +27,7 @@ func TestDesktopSigningKeyKeepsExistingAESHMAC(t *testing.T) {
}
func TestDesktopLocalFilesDir(t *testing.T) {
require.Equal(t, filepath.Join("/Users/dev", ".weknora", "data", "files"), desktopLocalFilesDir("/Users/dev"))
require.Equal(t, filepath.Join("/Users/dev", ".academy", "data", "files"), desktopLocalFilesDir("/Users/dev"))
}
func TestUseDesktopFilesDirReplacesDockerDefault(t *testing.T) {
@@ -37,19 +37,19 @@ func TestUseDesktopFilesDirReplacesDockerDefault(t *testing.T) {
require.False(t, useDesktopFilesDir("/Users/dev/custom-files"))
}
func TestConfigureDesktopFileStorageUsesHomeWeKnora(t *testing.T) {
func TestConfigureDesktopFileStorageUsesHomeAcademy(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)
t.Setenv("LOCAL_STORAGE_BASE_DIR", "/data/files")
configureDesktopFileStorage("")
require.Equal(t, filepath.Join(home, ".weknora", "data", "files"), os.Getenv("LOCAL_STORAGE_BASE_DIR"))
require.Equal(t, filepath.Join(home, ".academy", "data", "files"), os.Getenv("LOCAL_STORAGE_BASE_DIR"))
info, err := os.Stat(os.Getenv("LOCAL_STORAGE_BASE_DIR"))
require.NoError(t, err)
require.True(t, info.IsDir())
}
func TestLegacyDesktopFilesDirFollowsTheOldResolution(t *testing.T) {
appSupport := "/Users/dev/Library/Application Support/WeKnora"
appSupport := "/Users/dev/Library/Application Support/Academy"
require.Equal(t, filepath.Join(appSupport, "data", "files"), legacyDesktopFilesDir("", appSupport))
require.Equal(t, filepath.Join(appSupport, "data", "files"), legacyDesktopFilesDir("/data/files", appSupport))
require.Equal(t, filepath.Join(appSupport, "custom", "files"), legacyDesktopFilesDir("custom/files", appSupport))
@@ -59,13 +59,13 @@ func TestConfigureDesktopFileStorageMigratesFromTheBundleDir(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)
t.Setenv("LOCAL_STORAGE_BASE_DIR", "custom/files")
old := filepath.Join(home, "Library", "Application Support", "WeKnora", "custom", "files")
old := filepath.Join(home, "Library", "Application Support", "Academy", "custom", "files")
require.NoError(t, os.MkdirAll(filepath.Join(old, "1"), 0o755))
require.NoError(t, os.WriteFile(filepath.Join(old, "1", "a.txt"), []byte("a"), 0o600))
configureDesktopFileStorage("/Applications/WeKnora.app/Contents/MacOS/WeKnora")
configureDesktopFileStorage("/Applications/Academy.app/Contents/MacOS/Academy")
require.FileExists(t, filepath.Join(home, ".weknora", "data", "files", "1", "a.txt"))
require.FileExists(t, filepath.Join(home, ".academy", "data", "files", "1", "a.txt"))
}
func TestEnsureDesktopLiteEditionOverridesDefaultStandard(t *testing.T) {
+3 -3
View File
@@ -8,7 +8,7 @@ import (
"path/filepath"
"strings"
"github.com/Tencent/WeKnora/internal/utils"
"academy/internal/utils"
)
// ensureDesktopSigningKey persists the desktop signing key and, when no
@@ -21,7 +21,7 @@ func ensureDesktopSigningKey() error {
if err != nil {
return err
}
return ensureDesktopSigningKeyInDir(filepath.Join(dir, "WeKnora Lite"))
return ensureDesktopSigningKeyInDir(filepath.Join(dir, "Academy Lite"))
}
func ensureDesktopSigningKeyInDir(dir string) error {
@@ -74,7 +74,7 @@ func ensureDesktopSigningKeyInDir(dir string) error {
// AES key), so sessions get their own persisted secret.
func ensureDesktopJWTSecret(dir string, signingKey []byte) error {
jwtSecret := strings.TrimSpace(os.Getenv("JWT_SECRET"))
if jwtSecret != "" && jwtSecret != "weknora-jwt-secret" && jwtSecret != "CHANGE-ME-jwt-secret" {
if jwtSecret != "" && jwtSecret != "academy-jwt-secret" && jwtSecret != "CHANGE-ME-jwt-secret" {
return nil
}
secret := string(signingKey)
+4 -4
View File
@@ -6,7 +6,7 @@ import (
"runtime"
"testing"
"github.com/Tencent/WeKnora/internal/utils"
"academy/internal/utils"
"github.com/stretchr/testify/require"
)
@@ -14,7 +14,7 @@ func TestDesktopSigningKeyPersistsWithoutChangingAES(t *testing.T) {
dir := t.TempDir()
t.Setenv("SYSTEM_SIGNING_KEY", "")
t.Setenv("JWT_SECRET", "")
t.Setenv("SYSTEM_AES_KEY", "weknora-system-aes-key-32bytes!!")
t.Setenv("SYSTEM_AES_KEY", "academy-system-aes-key-32bytes!!")
require.NoError(t, ensureDesktopSigningKeyInDir(dir))
first := string(utils.SystemHMACKey())
firstJWT := os.Getenv("JWT_SECRET")
@@ -25,7 +25,7 @@ func TestDesktopSigningKeyPersistsWithoutChangingAES(t *testing.T) {
require.NoError(t, ensureDesktopSigningKeyInDir(dir))
require.Equal(t, first, string(utils.SystemHMACKey()))
require.Equal(t, firstJWT, os.Getenv("JWT_SECRET"))
require.Equal(t, "weknora-system-aes-key-32bytes!!", os.Getenv("SYSTEM_AES_KEY"))
require.Equal(t, "academy-system-aes-key-32bytes!!", os.Getenv("SYSTEM_AES_KEY"))
info, err := os.Stat(filepath.Join(dir, "signing.key"))
require.NoError(t, err)
if runtime.GOOS != "windows" {
@@ -37,7 +37,7 @@ func TestDesktopJWTSecretIsNotTheAESKey(t *testing.T) {
dir := t.TempDir()
const aes = "0123456789abcdef0123456789abcdef"
t.Setenv("SYSTEM_SIGNING_KEY", "")
t.Setenv("JWT_SECRET", "weknora-jwt-secret")
t.Setenv("JWT_SECRET", "academy-jwt-secret")
t.Setenv("SYSTEM_AES_KEY", aes)
require.NoError(t, ensureDesktopSigningKeyInDir(dir))
+9 -9
View File
@@ -13,8 +13,8 @@ import (
"strings"
"time"
"github.com/Tencent/WeKnora/internal/handler"
"github.com/Tencent/WeKnora/internal/logger"
"academy/internal/handler"
"academy/internal/logger"
wailsruntime "github.com/wailsapp/wails/v2/pkg/runtime"
"golang.org/x/mod/semver"
)
@@ -57,7 +57,7 @@ func checkUpdate(ctx context.Context, currentVersion string, showUpToDate bool,
}
// Add User-Agent header which is required/recommended by GitHub API
req.Header.Set("User-Agent", "WeKnora-Lite-Desktop-App")
req.Header.Set("User-Agent", "Academy-Lite-Desktop-App")
// Add Authorization header if GITHUB_TOKEN is present to increase rate limit
if token := os.Getenv("GITHUB_TOKEN"); token != "" {
@@ -119,7 +119,7 @@ func checkUpdate(ctx context.Context, currentVersion string, showUpToDate bool,
return
}
msg := fmt.Sprintf("A new version of WeKnora Lite is available!\n\nCurrent version: %s\nLatest version: %s\n\nWould you like to download it now?", currentVersion, latestVersion)
msg := fmt.Sprintf("A new version of Academy Lite is available!\n\nCurrent version: %s\nLatest version: %s\n\nWould you like to download it now?", currentVersion, latestVersion)
choice, _ := wailsruntime.MessageDialog(ctx, wailsruntime.MessageDialogOptions{
Type: wailsruntime.InfoDialog,
Title: "Update Available",
@@ -143,7 +143,7 @@ func checkUpdate(ctx context.Context, currentVersion string, showUpToDate bool,
wailsruntime.MessageDialog(ctx, wailsruntime.MessageDialogOptions{
Type: wailsruntime.InfoDialog,
Title: "Up to Date",
Message: fmt.Sprintf("You are using the latest version of WeKnora Lite.\n\nCurrent version: %s", currentVersion),
Message: fmt.Sprintf("You are using the latest version of Academy Lite.\n\nCurrent version: %s", currentVersion),
Buttons: []string{"OK"},
DefaultButton: "OK",
})
@@ -280,7 +280,7 @@ func downloadAndInstall(ctx context.Context, url string, filename string, curren
choice, _ := wailsruntime.MessageDialog(ctx, wailsruntime.MessageDialogOptions{
Type: wailsruntime.InfoDialog,
Title: "Update Ready",
Message: fmt.Sprintf("WeKnora Lite %s has been downloaded successfully.\n\nWould you like to restart and install the new version now?", latestVersion),
Message: fmt.Sprintf("Academy Lite %s has been downloaded successfully.\n\nWould you like to restart and install the new version now?", latestVersion),
Buttons: []string{"Restart Now", "Later"},
DefaultButton: "Restart Now",
})
@@ -315,7 +315,7 @@ func desktopAboutVersion() string {
// applyUpdateAndRestart applies the downloaded update and restarts the application
func applyUpdateAndRestart(ctx context.Context, savePath string) {
if runtime.GOOS == "windows" {
scriptPath := filepath.Join(os.TempDir(), "weknora_update.bat")
scriptPath := filepath.Join(os.TempDir(), "academy_update.bat")
execPath, err := os.Executable()
if err != nil {
logger.Warnf(context.Background(), "Failed to get executable path: %v", err)
@@ -351,7 +351,7 @@ del "%%~f0"
return
}
mountPoint := filepath.Join(os.TempDir(), "WeKnoraUpdateMount")
mountPoint := filepath.Join(os.TempDir(), "AcademyUpdateMount")
os.MkdirAll(mountPoint, 0755)
cmdMount := exec.Command("hdiutil", "attach", savePath, "-mountpoint", mountPoint, "-nobrowse", "-quiet")
@@ -386,7 +386,7 @@ del "%%~f0"
}
appDir := filepath.Dir(appBundlePath)
scriptPath := filepath.Join(os.TempDir(), "weknora_update.sh")
scriptPath := filepath.Join(os.TempDir(), "academy_update.sh")
scriptContent := fmt.Sprintf(`#!/bin/bash
sleep 2
if ! (rm -rf "%s" && cp -a "%s" "%s"); then
+5 -5
View File
@@ -1,20 +1,20 @@
{
"$schema": "https://wails.io/schemas/config.v2.json",
"name": "WeKnora Lite",
"outputfilename": "WeKnora Lite",
"name": "Academy Lite",
"outputfilename": "Academy Lite",
"frontend:dir": "../../frontend",
"wailsjsdir": "../../frontend/src",
"build:tags": "desktop",
"author": {
"name": "WeKnora Team",
"name": "Academy Team",
"email": ""
},
"info": {
"companyName": "Tencent",
"productName": "WeKnora Lite",
"productName": "Academy Lite",
"productVersion": "1.0.0",
"copyright": "Copyright 2026 Tencent",
"comments": "WeKnora Desktop Edition"
"comments": "Academy Desktop Edition"
},
"mac": {
"category": "public.app-category.productivity",
+1 -1
View File
@@ -8,7 +8,7 @@ import (
_ "github.com/duckdb/duckdb-go/v2"
)
// duckdbExtensions is the list of DuckDB extensions required by WeKnora's
// duckdbExtensions is the list of DuckDB extensions required by Academy's
// data analysis tool. `spatial` is used for layer metadata (st_read_meta)
// so we can enumerate sheet names from Excel files, while `excel` provides
// the dedicated read_xlsx reader with proper type inference.
+10 -10
View File
@@ -1,6 +1,6 @@
# Milvus 多语言 BM25 迁移
旧版 WeKnora 的 Milvus Collection 只有一个默认文本分析器,中文内容可能没有有效 BM25 关键词。`milvus-migrate` 会保留旧 Collection,并复制已有稠密向量到新的多语言 Collection;Milvus 会依据每行的 `language` 字段重新生成 BM25 稀疏向量。
旧版 Academy 的 Milvus Collection 只有一个默认文本分析器,中文内容可能没有有效 BM25 关键词。`milvus-migrate` 会保留旧 Collection,并复制已有稠密向量到新的多语言 Collection;Milvus 会依据每行的 `language` 字段重新生成 BM25 稀疏向量。
稠密向量的 metric(IP / COSINE / L2)默认从源 Collection 的 embedding 索引读取。不要改成与源 Collection 不同的值,否则同一批向量会按错误距离排序。
@@ -9,7 +9,7 @@
先确保 Milvus 已启动,再在项目根目录执行:
```bash
go run ./cmd/milvus-migrate --source weknora_embeddings --target weknora_embeddings_multilingual
go run ./cmd/milvus-migrate --source academy_embeddings --target academy_embeddings_multilingual
```
如果当前 shell 已经导入了 `MILVUS_ADDRESS` 和 `MILVUS_COLLECTION`,可以省略对应参数。仅仅把变量写在 `.env.local` 中不会自动注入 `go run` 进程;不确定时建议显式传参:
@@ -17,19 +17,19 @@ go run ./cmd/milvus-migrate --source weknora_embeddings --target weknora_embeddi
```bash
go run ./cmd/milvus-migrate \
--address 127.0.0.1:19530 \
--source weknora_embeddings \
--target weknora_embeddings_multilingual
--source academy_embeddings \
--target academy_embeddings_multilingual
```
若要核对 metric,可传入与源 Collection 相同的 `--metric-type`(以及环境变量 `MILVUS_METRIC_TYPE`)。传入的值必须与源索引一致,否则迁移会失败。
迁移完成后,把 WeKnora 的 `MILVUS_COLLECTION` 改为目标前缀并重启服务,**保持原来的 `MILVUS_METRIC_TYPE` 不变**:
迁移完成后,把 Academy 的 `MILVUS_COLLECTION` 改为目标前缀并重启服务,**保持原来的 `MILVUS_METRIC_TYPE` 不变**:
```dotenv
MILVUS_COLLECTION=weknora_embeddings_multilingual
MILVUS_COLLECTION=academy_embeddings_multilingual
```
检索列表按 `{前缀}_{维度}` 精确匹配,因此 `weknora_embeddings` 不会误搜到 `weknora_embeddings_multilingual_*`。切换前缀后,新写入和向量/关键词检索才会都走新 Collection。
检索列表按 `{前缀}_{维度}` 精确匹配,因此 `academy_embeddings` 不会误搜到 `academy_embeddings_multilingual_*`。切换前缀后,新写入和向量/关键词检索才会都走新 Collection。
迁移程序不会删除旧 Collection。确认中文和英文 BM25 都能召回后,再通过 Milvus 管理工具删除旧 Collection;删除前请先备份。
@@ -37,13 +37,13 @@ MILVUS_COLLECTION=weknora_embeddings_multilingual
## Windows PowerShell 注意事项
WeKnora 的 `internal/utils` 使用 `pg_query_go` 解析 SQL,该依赖需要 CGO。直接执行 `go run` 时,如果当前会话的 `CGO_ENABLED=0`,会出现 `undefined: pg_query.Parse` 或 `undefined: pg_query.Deparse`。
Academy 的 `internal/utils` 使用 `pg_query_go` 解析 SQL,该依赖需要 CGO。直接执行 `go run` 时,如果当前会话的 `CGO_ENABLED=0`,会出现 `undefined: pg_query.Parse` 或 `undefined: pg_query.Deparse`。
项目附带了 MSYS2 GCC,可以在当前 PowerShell 会话中临时启用 CGO 后再运行迁移。下面的设置只影响当前窗口,不会修改系统级 Go 配置:
```powershell
# 确认当前目录是包含 go.mod 的项目根目录
if (!(Test-Path -LiteralPath '.\go.mod')) { throw '请先切换到 WeKnora 项目根目录' }
if (!(Test-Path -LiteralPath '.\go.mod')) { throw '请先切换到 Academy 项目根目录' }
# 使用项目自带的 GCC,避免 Go 找不到 C 编译器
$compilerBin = Join-Path (Get-Location) '.local-tools\msys64\ucrt64\bin'
@@ -53,7 +53,7 @@ $env:CXX = Join-Path $compilerBin 'g++.exe'
$env:PATH = "$compilerBin;$env:PATH"
# 运行迁移;metric 沿用源 Collection,不删除旧 Collection
go run ./cmd/milvus-migrate --address 127.0.0.1:19530 --source weknora_embeddings --target weknora_embeddings_multilingual
go run ./cmd/milvus-migrate --address 127.0.0.1:19530 --source academy_embeddings --target academy_embeddings_multilingual
```
如果项目目录中没有 `.local-tools\msys64\ucrt64\bin`,请先安装可用的 GCC,并将 `$env:CC`、`$env:CXX` 改为对应的 `gcc.exe`、`g++.exe` 绝对路径。
+4 -4
View File
@@ -11,19 +11,19 @@ import (
"strings"
"time"
milvusRepo "github.com/Tencent/WeKnora/internal/application/repository/retriever/milvus"
milvusRepo "academy/internal/application/repository/retriever/milvus"
client "github.com/milvus-io/milvus/client/v2/milvusclient"
)
func main() {
sourceDefault := strings.TrimSpace(os.Getenv("MILVUS_COLLECTION"))
if sourceDefault == "" {
sourceDefault = "weknora_embeddings"
sourceDefault = "academy_embeddings"
}
targetDefault := sourceDefault + "_multilingual"
source := flag.String("source", sourceDefault, "旧 Collection 前缀,例如 weknora_embeddings")
target := flag.String("target", targetDefault, "新 Collection 前缀,例如 weknora_embeddings_multilingual")
source := flag.String("source", sourceDefault, "旧 Collection 前缀,例如 academy_embeddings")
target := flag.String("target", targetDefault, "新 Collection 前缀,例如 academy_embeddings_multilingual")
address := flag.String("address", envOr("MILVUS_ADDRESS", "localhost:19530"), "Milvus 地址")
username := flag.String("username", os.Getenv("MILVUS_USERNAME"), "Milvus 用户名")
password := flag.String("password", os.Getenv("MILVUS_PASSWORD"), "Milvus 密码")
+3 -3
View File
@@ -13,8 +13,8 @@ import (
"go.uber.org/dig"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types/interfaces"
"academy/internal/logger"
"academy/internal/types/interfaces"
)
// bootstrapEnvVar is the env var that names the email of the user who
@@ -30,7 +30,7 @@ import (
// - Safe to leave set: once at least one system admin exists, the env
// var stops granting privileges. That prevents a UI revoke from being
// silently undone on the next restart.
const bootstrapEnvVar = "WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL"
const bootstrapEnvVar = "ACADEMY_BOOTSTRAP_SYSTEM_ADMIN_EMAIL"
// runStartupBootstrap consults the env and applies any one-shot
// bootstrap actions. Currently it only handles system-admin promotion;
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"net"
"time"
"github.com/Tencent/WeKnora/internal/logger"
"academy/internal/logger"
)
func listenWithRetry(addr string, maxRetries int, baseDelay time.Duration) (net.Listener, error) {
+11 -11
View File
@@ -1,13 +1,13 @@
// Package main is the main package for the WeKnora server
// Package main is the main package for the Academy server
// It contains the main function and the entry point for the server
//
// @title WeKnora API
// @title Academy API
// @version 1.0
// @description WeKnora 知识库管理系统 API 文档
// @description Academy 知识库管理系统 API 文档
// @termsOfService http://swagger.io/terms/
//
// @contact.name WeKnora Github
// @contact.url https://github.com/Tencent/WeKnora
// @contact.name Academy Github
// @contact.url https://academy
//
// @BasePath /api/v1
//
@@ -32,12 +32,12 @@ import (
"github.com/gin-gonic/gin"
"github.com/Tencent/WeKnora/internal/application/service"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/container"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/runtime"
"github.com/Tencent/WeKnora/internal/types/interfaces"
"academy/internal/application/service"
"academy/internal/config"
"academy/internal/container"
"academy/internal/logger"
"academy/internal/runtime"
"academy/internal/types/interfaces"
)
func main() {