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

@@ -10,15 +10,15 @@ import (
"net/http"
"strings"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/utils"
"academy/internal/logger"
"academy/internal/models/utils"
"github.com/google/uuid"
)
const weKnoraCloudVLMPath = "/api/v1/chat/completions"
const academyCloudVLMPath = "/api/v1/chat/completions"
// WeKnoraCloudVLM implements VLM via the WeKnoraCloud API.
type WeKnoraCloudVLM struct {
// AcademyCloudVLM implements VLM via the AcademyCloud API.
type AcademyCloudVLM struct {
modelName string
remoteModelName string
modelID string
@@ -28,13 +28,13 @@ type WeKnoraCloudVLM struct {
client *http.Client
}
// NewWeKnoraCloudVLM creates a WeKnoraCloud-backed VLM instance.
func NewWeKnoraCloudVLM(config *Config) (*WeKnoraCloudVLM, error) {
// NewAcademyCloudVLM creates a AcademyCloud-backed VLM instance.
func NewAcademyCloudVLM(config *Config) (*AcademyCloudVLM, error) {
if config.AppID == "" {
return nil, fmt.Errorf("WeKnoraCloud VLM: AppID is required")
return nil, fmt.Errorf("AcademyCloud VLM: AppID is required")
}
if config.AppSecret == "" {
return nil, fmt.Errorf("WeKnoraCloud VLM: AppSecret is required")
return nil, fmt.Errorf("AcademyCloud VLM: AppSecret is required")
}
baseURL := strings.TrimRight(config.BaseURL, "/")
if err := validateVLMBaseURL(baseURL); err != nil {
@@ -48,7 +48,7 @@ func NewWeKnoraCloudVLM(config *Config) (*WeKnoraCloudVLM, error) {
}
}
}
return &WeKnoraCloudVLM{
return &AcademyCloudVLM{
modelName: config.ModelName,
remoteModelName: remoteModelName,
modelID: config.ModelID,
@@ -59,30 +59,30 @@ func NewWeKnoraCloudVLM(config *Config) (*WeKnoraCloudVLM, error) {
}, nil
}
type weKnoraCloudVLMContentPart struct {
type academyCloudVLMContentPart struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
ImageURL *weKnoraCloudVLMImageURL `json:"image_url,omitempty"`
ImageURL *academyCloudVLMImageURL `json:"image_url,omitempty"`
}
type weKnoraCloudVLMImageURL struct {
type academyCloudVLMImageURL struct {
URL string `json:"url"`
}
type weKnoraCloudVLMMessage struct {
type academyCloudVLMMessage struct {
Role string `json:"role"`
Content interface{} `json:"content"`
}
type weKnoraCloudVLMRequest struct {
type academyCloudVLMRequest struct {
Model string `json:"model"`
Messages []weKnoraCloudVLMMessage `json:"messages"`
Messages []academyCloudVLMMessage `json:"messages"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
Stream bool `json:"stream"`
}
type weKnoraCloudVLMResponse struct {
type academyCloudVLMResponse struct {
Choices []struct {
Message struct {
Content string `json:"content"`
@@ -90,20 +90,20 @@ type weKnoraCloudVLMResponse struct {
} `json:"choices"`
}
// Predict sends images with a text prompt to the WeKnoraCloud API.
func (v *WeKnoraCloudVLM) Predict(ctx context.Context, imgBytesList [][]byte, prompt string) (string, error) {
// Predict sends images with a text prompt to the AcademyCloud API.
func (v *AcademyCloudVLM) Predict(ctx context.Context, imgBytesList [][]byte, prompt string) (string, error) {
return v.PredictWithOptions(ctx, imgBytesList, prompt, nil)
}
// PredictWithOptions satisfies the interface. The hosted endpoint exposes no
// thinking switch, so the options are accepted and used for nothing — the same
// call goes out as Predict sends.
func (v *WeKnoraCloudVLM) PredictWithOptions(
func (v *AcademyCloudVLM) PredictWithOptions(
ctx context.Context, imgBytesList [][]byte, prompt string, _ *PredictOptions,
) (string, error) {
var parts []weKnoraCloudVLMContentPart
var parts []academyCloudVLMContentPart
parts = append(parts, weKnoraCloudVLMContentPart{
parts = append(parts, academyCloudVLMContentPart{
Type: "text",
Text: prompt,
})
@@ -113,18 +113,18 @@ func (v *WeKnoraCloudVLM) PredictWithOptions(
mimeType := detectImageMIME(imgBytes)
b64 := base64.StdEncoding.EncodeToString(imgBytes)
dataURI := fmt.Sprintf("data:%s;base64,%s", mimeType, b64)
parts = append(parts, weKnoraCloudVLMContentPart{
parts = append(parts, academyCloudVLMContentPart{
Type: "image_url",
ImageURL: &weKnoraCloudVLMImageURL{
ImageURL: &academyCloudVLMImageURL{
URL: dataURI,
},
})
}
}
reqBody := weKnoraCloudVLMRequest{
reqBody := academyCloudVLMRequest{
Model: v.effectiveModelName(),
Messages: []weKnoraCloudVLMMessage{
Messages: []academyCloudVLMMessage{
{
Role: "user",
Content: parts,
@@ -137,15 +137,15 @@ func (v *WeKnoraCloudVLM) PredictWithOptions(
bodyBytes, err := json.Marshal(reqBody)
if err != nil {
return "", fmt.Errorf("weknoracloud VLM: marshal: %w", err)
return "", fmt.Errorf("academycloud VLM: marshal: %w", err)
}
requestID := uuid.New().String()
headers := utils.Sign(v.appID, v.apiKey, requestID, string(bodyBytes))
req, err := http.NewRequestWithContext(ctx, http.MethodPost, v.baseURL+weKnoraCloudVLMPath, bytes.NewReader(bodyBytes))
req, err := http.NewRequestWithContext(ctx, http.MethodPost, v.baseURL+academyCloudVLMPath, bytes.NewReader(bodyBytes))
if err != nil {
return "", fmt.Errorf("weknoracloud VLM: create request: %w", err)
return "", fmt.Errorf("academycloud VLM: create request: %w", err)
}
req.Header.Set("Content-Type", "application/json")
for k, hv := range headers {
@@ -156,42 +156,42 @@ func (v *WeKnoraCloudVLM) PredictWithOptions(
for _, img := range imgBytesList {
totalImageSize += len(img)
}
logger.Infof(ctx, "[VLM] Calling WeKnoraCloud API, model=%s, baseURL=%s, numImages=%d, totalImageSize=%d",
logger.Infof(ctx, "[VLM] Calling AcademyCloud API, model=%s, baseURL=%s, numImages=%d, totalImageSize=%d",
v.effectiveModelName(), v.baseURL, len(imgBytesList), totalImageSize)
resp, err := v.client.Do(req)
if err != nil {
return "", fmt.Errorf("weknoracloud VLM: do request: %w", err)
return "", fmt.Errorf("academycloud VLM: do request: %w", err)
}
defer resp.Body.Close()
respBytes, err := io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("weknoracloud VLM: read response: %w", err)
return "", fmt.Errorf("academycloud VLM: read response: %w", err)
}
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("weknoracloud VLM: status %d: %s", resp.StatusCode, string(respBytes))
return "", fmt.Errorf("academycloud VLM: status %d: %s", resp.StatusCode, string(respBytes))
}
var vlmResp weKnoraCloudVLMResponse
var vlmResp academyCloudVLMResponse
if err := json.Unmarshal(respBytes, &vlmResp); err != nil {
return "", fmt.Errorf("weknoracloud VLM: unmarshal: %w", err)
return "", fmt.Errorf("academycloud VLM: unmarshal: %w", err)
}
if len(vlmResp.Choices) == 0 {
return "", fmt.Errorf("weknoracloud VLM: no choices in response")
return "", fmt.Errorf("academycloud VLM: no choices in response")
}
content := vlmResp.Choices[0].Message.Content
logger.Infof(ctx, "[VLM] WeKnoraCloud response received, len=%d", len(content))
logger.Infof(ctx, "[VLM] AcademyCloud response received, len=%d", len(content))
return content, nil
}
func (v *WeKnoraCloudVLM) effectiveModelName() string {
func (v *AcademyCloudVLM) effectiveModelName() string {
if v.remoteModelName != "" {
return v.remoteModelName
}
return v.modelName
}
func (v *WeKnoraCloudVLM) GetModelName() string { return v.modelName }
func (v *WeKnoraCloudVLM) GetModelID() string { return v.modelID }
func (v *AcademyCloudVLM) GetModelName() string { return v.modelName }
func (v *AcademyCloudVLM) GetModelID() string { return v.modelID }
+1 -1
View File
@@ -3,7 +3,7 @@ package vlm
import (
"context"
"github.com/Tencent/WeKnora/internal/models/limiter"
"academy/internal/models/limiter"
)
// Multimodal enrichment (image OCR / caption) is a high-volume, slow background
@@ -3,7 +3,7 @@ package vlm
import (
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
func TestConfigFromModel_RemoteDefaultsToOpenAI(t *testing.T) {
+1 -1
View File
@@ -3,7 +3,7 @@ package vlm
import (
"context"
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
"academy/internal/tracing/langfuse"
)
// langfuseVLM wraps a VLM and reports each Predict call as a Langfuse
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"testing"
"time"
"github.com/Tencent/WeKnora/internal/tracing/langfuse"
"academy/internal/tracing/langfuse"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/codes"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"strings"
"time"
"github.com/Tencent/WeKnora/internal/logger"
"academy/internal/logger"
)
// debugVLM wraps a VLM with LLM debug logging.
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"context"
"fmt"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
"academy/internal/logger"
"academy/internal/models/utils/ollama"
ollamaapi "github.com/ollama/ollama/api"
)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
"academy/internal/models/utils/ollama"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -10,9 +10,9 @@ import (
"strings"
"time"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/chat"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/logger"
"academy/internal/models/chat"
"academy/internal/types"
)
const (
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/types"
)
// TestConfigFromModelCarriesSpecOverride pins the per-row catalog override on
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"net/http"
"time"
secutils "github.com/Tencent/WeKnora/internal/utils"
secutils "academy/internal/utils"
)
func validateVLMBaseURL(baseURL string) error {
@@ -3,7 +3,7 @@ package vlm
import (
"testing"
secutils "github.com/Tencent/WeKnora/internal/utils"
secutils "academy/internal/utils"
)
func withVLMSSRFWhitelist(t *testing.T, raw string) {
+8 -8
View File
@@ -6,11 +6,11 @@ import (
"fmt"
"strings"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/models/providers"
modelruntime "github.com/Tencent/WeKnora/internal/models/runtime"
"github.com/Tencent/WeKnora/internal/models/utils/ollama"
"github.com/Tencent/WeKnora/internal/types"
"academy/internal/logger"
"academy/internal/models/providers"
modelruntime "academy/internal/models/runtime"
"academy/internal/models/utils/ollama"
"academy/internal/types"
)
// ErrTruncatedCompletion means the model exhausted its output budget
@@ -71,7 +71,7 @@ type Config struct {
// ConfigFromModel 根据 types.Model 构造 vlm.Config。
// 生产路径(从 DB 拉起)和测试连接路径(临时表单)共享这份映射。
// appID / appSecret 是已解密的 WeKnoraCloud 凭证,调用方负责传入。
// appID / appSecret 是已解密的 AcademyCloud 凭证,调用方负责传入。
// InterfaceType 会根据 source / 模型参数自动回退到合理默认值。
func ConfigFromModel(m *types.Model, appID, appSecret string) *Config {
if m == nil {
@@ -139,8 +139,8 @@ func newVLM(config *Config, ollamaService *ollama.OllamaService) (VLM, error) {
if providerID == "" {
providerID = modelruntime.DetectByURL(config.BaseURL)
}
if providerID == providers.WeKnoraCloudID {
return NewWeKnoraCloudVLM(config)
if providerID == providers.AcademyCloudID {
return NewAcademyCloudVLM(config)
}
return NewRemoteAPIVLM(config)