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
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/models/chat"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -148,7 +148,7 @@ func TestAReviewThatChangesNothingSaysWhy(t *testing.T) {
|
||||
_, err := svc.repo.EnsureSubject(ctx, scope)
|
||||
require.NoError(t, err)
|
||||
seedItem(t, svc, ctx, scope, types.MemoryKindInterest, "小微SDK设备接入", "小微SDK设备接入", "i-a")
|
||||
seedItem(t, svc, ctx, scope, types.MemoryKindInterest, "WeKnora混合检索", "WeKnora混合检索", "i-b")
|
||||
seedItem(t, svc, ctx, scope, types.MemoryKindInterest, "Academy混合检索", "Academy混合检索", "i-b")
|
||||
|
||||
result, err := svc.ConsolidateNow(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package memory
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/chat"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// newEvalChatModel builds a bare OpenAI-compatible client from the
|
||||
@@ -16,15 +16,15 @@ import (
|
||||
// model row — just an endpoint.
|
||||
func newEvalChatModel(modelID string) (chat.Chat, error) {
|
||||
baseURL := strings.TrimSpace(firstNonEmpty(
|
||||
os.Getenv("WEKNORA_MEMORY_EVAL_BASE_URL"),
|
||||
os.Getenv("ACADEMY_MEMORY_EVAL_BASE_URL"),
|
||||
os.Getenv("OPENAI_BASE_URL"),
|
||||
))
|
||||
apiKey := strings.TrimSpace(firstNonEmpty(
|
||||
os.Getenv("WEKNORA_MEMORY_EVAL_API_KEY"),
|
||||
os.Getenv("ACADEMY_MEMORY_EVAL_API_KEY"),
|
||||
os.Getenv("OPENAI_API_KEY"),
|
||||
))
|
||||
if baseURL == "" {
|
||||
return nil, errors.New("set WEKNORA_MEMORY_EVAL_BASE_URL (or OPENAI_BASE_URL)")
|
||||
return nil, errors.New("set ACADEMY_MEMORY_EVAL_BASE_URL (or OPENAI_BASE_URL)")
|
||||
}
|
||||
return chat.NewChat(&chat.ChatConfig{
|
||||
Source: types.ModelSourceRemote,
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -22,8 +22,8 @@ import (
|
||||
// which is cheap and keeps the file honest. Given a real model it scores the
|
||||
// prompt against the set:
|
||||
//
|
||||
// WEKNORA_MEMORY_EVAL_MODEL=<model id> \
|
||||
// WEKNORA_MEMORY_EVAL_BASE_URL=... WEKNORA_MEMORY_EVAL_API_KEY=... \
|
||||
// ACADEMY_MEMORY_EVAL_MODEL=<model id> \
|
||||
// ACADEMY_MEMORY_EVAL_BASE_URL=... ACADEMY_MEMORY_EVAL_API_KEY=... \
|
||||
// go test ./internal/application/service/memory/ -run TestPromptEval -v
|
||||
//
|
||||
// Scores are printed per case and in total. There is no pass threshold on
|
||||
@@ -213,11 +213,11 @@ func hasField(decisions []extractionDecision, match func(extractionDecision) boo
|
||||
}
|
||||
|
||||
// TestPromptEval scores the prompt against the golden set using a real model.
|
||||
// Skipped unless WEKNORA_MEMORY_EVAL_MODEL is set.
|
||||
// Skipped unless ACADEMY_MEMORY_EVAL_MODEL is set.
|
||||
func TestPromptEval(t *testing.T) {
|
||||
modelID := strings.TrimSpace(os.Getenv("WEKNORA_MEMORY_EVAL_MODEL"))
|
||||
modelID := strings.TrimSpace(os.Getenv("ACADEMY_MEMORY_EVAL_MODEL"))
|
||||
if modelID == "" {
|
||||
t.Skip("set WEKNORA_MEMORY_EVAL_MODEL (plus base URL / API key) to score the prompt")
|
||||
t.Skip("set ACADEMY_MEMORY_EVAL_MODEL (plus base URL / API key) to score the prompt")
|
||||
}
|
||||
chatModel, err := newEvalChatModel(modelID)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"thing was noticed is. reject_substrings are the recurring failure modes:",
|
||||
"storing a one-off question, storing the assistant's job, storing a secret.",
|
||||
"",
|
||||
"Run with: WEKNORA_MEMORY_EVAL_MODEL=<model id> go test ./internal/... -run Eval"
|
||||
"Run with: ACADEMY_MEMORY_EVAL_MODEL=<model id> go test ./internal/... -run Eval"
|
||||
],
|
||||
"cases": [
|
||||
{
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/models/chat"
|
||||
"academy/internal/tracing/langfuse"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/google/uuid"
|
||||
"github.com/hibiken/asynq"
|
||||
)
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/chat"
|
||||
"academy/internal/types"
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// Situational recall is lexical rather than vector-based. One subject holds a
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/application/repository"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"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/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/driver/postgres"
|
||||
@@ -19,9 +19,9 @@ import (
|
||||
|
||||
// Opt in with a disposable test database. Each run uses an isolated schema.
|
||||
func TestMemoryConsistencyPostgres(t *testing.T) {
|
||||
dsn := os.Getenv("WEKNORA_MEMORY_TEST_POSTGRES_DSN")
|
||||
dsn := os.Getenv("ACADEMY_MEMORY_TEST_POSTGRES_DSN")
|
||||
if dsn == "" {
|
||||
t.Skip("set WEKNORA_MEMORY_TEST_POSTGRES_DSN to run PostgreSQL integration tests")
|
||||
t.Skip("set ACADEMY_MEMORY_TEST_POSTGRES_DSN to run PostgreSQL integration tests")
|
||||
}
|
||||
admin, err := gorm.Open(postgres.Open(dsn), &gorm.Config{Logger: logger.Discard})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package memory
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/tracing/langfuse"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
const recallQueryPreviewRunes = 500
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
// ErrNoMemoryScope means the request carries no principal we can attribute
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/tracing/langfuse"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
// lexicalPoolSize is how many stored items the lexical ranking scans.
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/config"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/config"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/tracing/langfuse"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/application/repository"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/application/repository"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/models/embedding"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/models/chat"
|
||||
"academy/internal/models/embedding"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/hibiken/asynq"
|
||||
)
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/chat"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
// checks the deterministic tiers and that the prompt still carries the rules
|
||||
// the boundary cases depend on. Given a real model it scores the model tier:
|
||||
//
|
||||
// WEKNORA_MEMORY_EVAL_MODEL=<model id> \
|
||||
// WEKNORA_MEMORY_EVAL_BASE_URL=... WEKNORA_MEMORY_EVAL_API_KEY=... \
|
||||
// ACADEMY_MEMORY_EVAL_MODEL=<model id> \
|
||||
// ACADEMY_MEMORY_EVAL_BASE_URL=... ACADEMY_MEMORY_EVAL_API_KEY=... \
|
||||
// go test ./internal/application/service/memory/ -run TestTopicMergeEval -v
|
||||
|
||||
type topicEvalCase struct {
|
||||
@@ -138,11 +138,11 @@ func TestExtractionPromptDoesNotDumpEveryTrackedTopic(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestTopicMergeEval scores the model tier against the golden set.
|
||||
// Skipped unless WEKNORA_MEMORY_EVAL_MODEL is set.
|
||||
// Skipped unless ACADEMY_MEMORY_EVAL_MODEL is set.
|
||||
func TestTopicMergeEval(t *testing.T) {
|
||||
modelID := strings.TrimSpace(os.Getenv("WEKNORA_MEMORY_EVAL_MODEL"))
|
||||
modelID := strings.TrimSpace(os.Getenv("ACADEMY_MEMORY_EVAL_MODEL"))
|
||||
if modelID == "" {
|
||||
t.Skip("set WEKNORA_MEMORY_EVAL_MODEL (plus base URL / API key) to score topic merging")
|
||||
t.Skip("set ACADEMY_MEMORY_EVAL_MODEL (plus base URL / API key) to score topic merging")
|
||||
}
|
||||
set := loadTopicEvalSet(t)
|
||||
chatModel, err := newEvalChatModel(modelID)
|
||||
|
||||
@@ -3,7 +3,7 @@ package memory
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/models/chat"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/models/chat"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"sort"
|
||||
"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"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"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/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/driver/postgres"
|
||||
@@ -23,9 +23,9 @@ import (
|
||||
//
|
||||
// Opt in with a disposable database that has pgvector installed.
|
||||
func TestVectorSearchRanksInPostgres(t *testing.T) {
|
||||
dsn := os.Getenv("WEKNORA_MEMORY_TEST_POSTGRES_DSN")
|
||||
dsn := os.Getenv("ACADEMY_MEMORY_TEST_POSTGRES_DSN")
|
||||
if dsn == "" {
|
||||
t.Skip("set WEKNORA_MEMORY_TEST_POSTGRES_DSN to run PostgreSQL integration tests")
|
||||
t.Skip("set ACADEMY_MEMORY_TEST_POSTGRES_DSN to run PostgreSQL integration tests")
|
||||
}
|
||||
admin, err := gorm.Open(postgres.Open(dsn), &gorm.Config{Logger: logger.Discard})
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"github.com/Tencent/WeKnora/internal/types/interfaces"
|
||||
"academy/internal/types"
|
||||
"academy/internal/types/interfaces"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -63,11 +63,11 @@ func TestARewordedMemoryIsStillFound(t *testing.T) {
|
||||
}
|
||||
|
||||
// An interest is promoted from a subject label, so its topic and content hold
|
||||
// the same string. Joining them sent "WeKnora混合检索:WeKnora混合检索" to the
|
||||
// the same string. Joining them sent "Academy混合检索:Academy混合检索" to the
|
||||
// embedder, which is not a sentence any question resembles.
|
||||
func TestEmbeddedTextDoesNotRepeatTheSubject(t *testing.T) {
|
||||
require.Equal(t, "WeKnora混合检索", embeddableText(&types.MemoryItem{
|
||||
Kind: types.MemoryKindInterest, Topic: "WeKnora混合检索", Content: "WeKnora混合检索",
|
||||
require.Equal(t, "Academy混合检索", embeddableText(&types.MemoryItem{
|
||||
Kind: types.MemoryKindInterest, Topic: "Academy混合检索", Content: "Academy混合检索",
|
||||
}, nil))
|
||||
require.Equal(t, "数据库:生产库用 PostgreSQL 17", embeddableText(&types.MemoryItem{
|
||||
Kind: types.MemoryKindFact, Topic: "数据库", Content: "生产库用 PostgreSQL 17",
|
||||
@@ -79,10 +79,10 @@ func TestEmbeddedTextDoesNotRepeatTheSubject(t *testing.T) {
|
||||
// in the prompt because they never leave the vector.
|
||||
func TestInterestEmbedsTheOtherWordingsOfItsSubject(t *testing.T) {
|
||||
text := embeddableText(&types.MemoryItem{
|
||||
Kind: types.MemoryKindInterest, Topic: "WeKnora混合检索", Content: "WeKnora混合检索",
|
||||
}, []string{"混合检索调优", "WeKnora混合检索", "", "召回率优化"})
|
||||
Kind: types.MemoryKindInterest, Topic: "Academy混合检索", Content: "Academy混合检索",
|
||||
}, []string{"混合检索调优", "Academy混合检索", "", "召回率优化"})
|
||||
|
||||
require.Equal(t, "WeKnora混合检索;混合检索调优;召回率优化", text,
|
||||
require.Equal(t, "Academy混合检索;混合检索调优;召回率优化", text,
|
||||
"aliases are appended once each, and the subject is not repeated")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user