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
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// defaultAnthropicVersion is the anthropic-version value used when the
|
||||
@@ -34,7 +34,7 @@ func New(cfg Config) *Client {
|
||||
// GetModelName returns the wire model name.
|
||||
func (c *Client) GetModelName() string { return c.cfg.Endpoint.Model }
|
||||
|
||||
// GetModelID returns WeKnora's model identifier.
|
||||
// GetModelID returns Academy's model identifier.
|
||||
func (c *Client) GetModelID() string { return c.cfg.Endpoint.ModelID }
|
||||
|
||||
// Settings exposes the resolved configuration.
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// A bare array of the same result objects is accepted too: self-hosted
|
||||
// runtimes such as SGLang return that shape instead of the envelope.
|
||||
//
|
||||
// Jina, Zhipu, SiliconFlow, Qianfan, GPUStack, WeKnora Cloud and any
|
||||
// Jina, Zhipu, SiliconFlow, Qianfan, GPUStack, Academy Cloud and any
|
||||
// OpenAI-compatible gateway that serves rerank all speak it. Their
|
||||
// differences — which optional fields are accepted, where the endpoint sits,
|
||||
// what the documented ceilings are — arrive as api.RerankSettings; this
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -219,7 +219,7 @@ func TestDoesNotDoubleTheRerankPath(t *testing.T) {
|
||||
assert.Equal(t, "/api/paas/v4/rerank", *path)
|
||||
}
|
||||
|
||||
// WeKnora Cloud serves the same shape on its own path.
|
||||
// Academy Cloud serves the same shape on its own path.
|
||||
func TestHonoursAVendorDeclaredPath(t *testing.T) {
|
||||
server, path, _ := serve(t, `{"results":[]}`)
|
||||
defer server.Close()
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
// pass validation.
|
||||
type EmbeddingAPI string
|
||||
|
||||
// The embedding protocols WeKnora speaks.
|
||||
// The embedding protocols Academy speaks.
|
||||
const (
|
||||
// EmbeddingOpenAI is POST {base}/embeddings with {model, input[]} answering
|
||||
// {data: [{embedding, index}]} — the shape OpenAI defined and every
|
||||
// compatible gateway copied. Jina, NVIDIA, Azure and WeKnora Cloud speak
|
||||
// compatible gateway copied. Jina, NVIDIA, Azure and Academy Cloud speak
|
||||
// it too, with their own optional fields, URL or credential.
|
||||
EmbeddingOpenAI EmbeddingAPI = "openai-embeddings"
|
||||
// EmbeddingDashScope is Alibaba Model Studio's native multimodal shape:
|
||||
@@ -57,7 +57,7 @@ type Embedder interface {
|
||||
}
|
||||
|
||||
// EmbedImage is one image to embed. It travels inline rather than as a URL:
|
||||
// the object store WeKnora reads images from is usually not reachable from
|
||||
// the object store Academy reads images from is usually not reachable from
|
||||
// the vendor, and every multimodal vendor in the catalog accepts base64.
|
||||
type EmbedImage struct {
|
||||
Data []byte
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types"
|
||||
secutils "academy/internal/utils"
|
||||
)
|
||||
|
||||
// AuthFunc stamps credentials onto an outbound request. body is the exact
|
||||
@@ -49,11 +49,11 @@ type Endpoint struct {
|
||||
BaseURL string
|
||||
// URL, when set, is the complete request URL and overrides the protocol
|
||||
// default of BaseURL + protocol path. Vendors with non-standard paths
|
||||
// (Azure deployments, WeKnora Cloud) set it.
|
||||
// (Azure deployments, Academy Cloud) set it.
|
||||
URL string
|
||||
// Query is appended to the final URL (Azure api-version).
|
||||
Query map[string]string
|
||||
// Model is the name sent on the wire; ModelID is WeKnora's own identifier.
|
||||
// Model is the name sent on the wire; ModelID is Academy's own identifier.
|
||||
Model string
|
||||
ModelID string
|
||||
// Auth stamps credentials; Headers are static extra headers (vendor
|
||||
@@ -132,7 +132,7 @@ func (e Endpoint) newPost(ctx context.Context, url string, data []byte, contentT
|
||||
secutils.ApplyCustomHeaders(req, e.Headers)
|
||||
// Identity belongs to this call, not the shared model configuration or
|
||||
// a per-request UUID. Derived contexts retain it across turns and retries.
|
||||
req.Header.Set("User-Agent", "WeKnora")
|
||||
req.Header.Set("User-Agent", "Academy")
|
||||
req.Header.Del("X-Conversation-ID")
|
||||
if sessionID, ok := types.SessionIDFromContext(ctx); ok {
|
||||
req.Header.Set("X-Conversation-ID", sessionID)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ func TestEndpointRequestIdentity(t *testing.T) {
|
||||
req, _, err := ep.NewRequest(ctx, "http://127.0.0.1/v1/chat/completions", map[string]any{}, stream)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, sessionID, req.Header.Get("X-Conversation-ID"))
|
||||
require.Equal(t, "WeKnora", req.UserAgent())
|
||||
require.Equal(t, "Academy", req.UserAgent())
|
||||
require.Equal(t, "preserved", req.Header.Get("X-Custom"))
|
||||
require.Equal(t, "Bearer test-key", req.Header.Get("Authorization"))
|
||||
if sessionID == "" {
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -37,7 +37,7 @@ func New(cfg Config) *Client {
|
||||
// GetModelName returns the wire model name.
|
||||
func (c *Client) GetModelName() string { return c.cfg.Endpoint.Model }
|
||||
|
||||
// GetModelID returns WeKnora's model identifier.
|
||||
// GetModelID returns Academy's model identifier.
|
||||
func (c *Client) GetModelID() string { return c.cfg.Endpoint.ModelID }
|
||||
|
||||
// requestURL builds {base}/models/{model}:generateContent or
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
func newTestClient(t *testing.T, baseURL string, mutate func(*Config)) *Client {
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// ResolveImageURLForLLM converts stored image paths to a format that LLM APIs can consume.
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
const defaultPath = "/chat/completions"
|
||||
@@ -31,7 +31,7 @@ func New(cfg Config) *Client {
|
||||
// GetModelName returns the wire model name.
|
||||
func (c *Client) GetModelName() string { return c.cfg.Endpoint.Model }
|
||||
|
||||
// GetModelID returns WeKnora's model identifier.
|
||||
// GetModelID returns Academy's model identifier.
|
||||
func (c *Client) GetModelID() string { return c.cfg.Endpoint.ModelID }
|
||||
|
||||
// Settings exposes the resolved settings (diagnostics, tests).
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
@@ -177,7 +177,7 @@ func (c *Client) convertMessages(messages []api.Message) []wireMessage {
|
||||
}
|
||||
|
||||
// contentParts flattens rich content to plain text for vendors that only
|
||||
// accept strings (WeKnora Cloud), otherwise returns the parts as-is.
|
||||
// accept strings (Academy Cloud), otherwise returns the parts as-is.
|
||||
func (c *Client) contentParts(parts []wirePart) any {
|
||||
if c.cfg.Settings.SupportsMultiContent {
|
||||
return parts
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -78,7 +78,7 @@ func TestConversationHeadersAcrossTurnsAndToolResults(t *testing.T) {
|
||||
require.Len(t, headers, 3)
|
||||
for i, h := range headers {
|
||||
assert.Equal(t, "business-session", h.Get("X-Conversation-ID"))
|
||||
assert.Equal(t, "WeKnora", h.Get("User-Agent"))
|
||||
assert.Equal(t, "Academy", h.Get("User-Agent"))
|
||||
if cacheKeyEnabled {
|
||||
assert.Equal(t, "business-session", h.Get("x-session-affinity"))
|
||||
assert.Equal(t, "shared-cache-prefix", requests[i]["prompt_cache_key"])
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
const defaultPath = "/responses"
|
||||
@@ -31,7 +31,7 @@ func New(cfg Config) *Client {
|
||||
// GetModelName returns the wire model name.
|
||||
func (c *Client) GetModelName() string { return c.cfg.Endpoint.Model }
|
||||
|
||||
// GetModelID returns WeKnora's model identifier.
|
||||
// GetModelID returns Academy's model identifier.
|
||||
func (c *Client) GetModelID() string { return c.cfg.Endpoint.ModelID }
|
||||
|
||||
// Settings exposes the resolved settings (diagnostics, tests).
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
func newTestClient(t *testing.T, server *httptest.Server, reasoning bool) *Client {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config is everything the client needs, already resolved by the api.
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"academy/internal/logger"
|
||||
)
|
||||
|
||||
// SanitizeReasoningEffort validates a stored or configured level on its way
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config holds the Pinecone endpoint and rerank request settings.
|
||||
@@ -52,7 +52,7 @@ type request struct {
|
||||
}
|
||||
|
||||
// BuildRequestBody constructs the native Pinecone body. Asking for every
|
||||
// candidate and suppressing echoed documents preserves WeKnora's index mapping
|
||||
// candidate and suppressing echoed documents preserves Academy's index mapping
|
||||
// while avoiding unnecessary response bytes.
|
||||
func (c *Client) BuildRequestBody(query string, documents []string) (map[string]any, error) {
|
||||
docs := make([]document, len(documents))
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// FingerprintPromptPrefix returns a short, non-reversible identifier suitable
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -11,19 +11,19 @@ import (
|
||||
)
|
||||
|
||||
// streamRawDumpDir returns the directory for per-stream raw packet dumps.
|
||||
// Enabled when WEKNORA_LLM_STREAM_RAW_DUMP_DIR is set, or when
|
||||
// WEKNORA_LLM_STREAM_RAW_DUMP=1 (defaults to ~/.weknora/investigate/llm-stream).
|
||||
// Enabled when ACADEMY_LLM_STREAM_RAW_DUMP_DIR is set, or when
|
||||
// ACADEMY_LLM_STREAM_RAW_DUMP=1 (defaults to ~/.academy/investigate/llm-stream).
|
||||
func streamRawDumpDir() string {
|
||||
if dir := strings.TrimSpace(os.Getenv("WEKNORA_LLM_STREAM_RAW_DUMP_DIR")); dir != "" {
|
||||
if dir := strings.TrimSpace(os.Getenv("ACADEMY_LLM_STREAM_RAW_DUMP_DIR")); dir != "" {
|
||||
return dir
|
||||
}
|
||||
v := strings.TrimSpace(os.Getenv("WEKNORA_LLM_STREAM_RAW_DUMP"))
|
||||
v := strings.TrimSpace(os.Getenv("ACADEMY_LLM_STREAM_RAW_DUMP"))
|
||||
if v == "1" || strings.EqualFold(v, "true") || strings.EqualFold(v, "yes") {
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return filepath.Join(home, ".weknora", "investigate", "llm-stream")
|
||||
return filepath.Join(home, ".academy", "investigate", "llm-stream")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import "context"
|
||||
// validation and fail at call time.
|
||||
type RerankAPI string
|
||||
|
||||
// The rerank protocols WeKnora speaks.
|
||||
// The rerank protocols Academy speaks.
|
||||
const (
|
||||
// RerankCohere is the de-facto standard shape — POST {base}/rerank with
|
||||
// {model, query, documents} and a results array of {index,
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
secutils "academy/internal/utils"
|
||||
)
|
||||
|
||||
// fillerReader streams size bytes without allocating them, so a test can offer
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"academy/internal/logger"
|
||||
)
|
||||
|
||||
// RetryPolicy describes how often to retry a failed request and how long to
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -62,7 +62,7 @@ func TestPostJSONWithRetrySucceedsAfterATransportFailure(t *testing.T) {
|
||||
assert.Equal(t, 2, attempts)
|
||||
for _, h := range headers {
|
||||
assert.Equal(t, "retry-session", h.Get("X-Conversation-ID"))
|
||||
assert.Equal(t, "WeKnora", h.Get("User-Agent"))
|
||||
assert.Equal(t, "Academy", h.Get("User-Agent"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"github.com/Tencent/WeKnora/internal/models/api/anthropicmessages"
|
||||
"github.com/Tencent/WeKnora/internal/models/api/googlegenai"
|
||||
"github.com/Tencent/WeKnora/internal/models/api/openaicompletions"
|
||||
"github.com/Tencent/WeKnora/internal/models/api/openairesponses"
|
||||
"academy/internal/models/api"
|
||||
"academy/internal/models/api/anthropicmessages"
|
||||
"academy/internal/models/api/googlegenai"
|
||||
"academy/internal/models/api/openaicompletions"
|
||||
"academy/internal/models/api/openairesponses"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// ToolCallDelta is one streamed fragment of a tool call, already lifted out
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// A consumer that walks away must not pin the producing goroutine forever.
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
)
|
||||
|
||||
// Config supplies the endpoint and wire-level settings for a TEI reranker.
|
||||
@@ -45,7 +45,7 @@ type rank struct {
|
||||
}
|
||||
|
||||
// BuildRequestBody returns the native TEI request. raw_scores is explicit:
|
||||
// false makes a single-class reranker's logits comparable with WeKnora's
|
||||
// false makes a single-class reranker's logits comparable with Academy's
|
||||
// 0..1 relevance threshold. The model name is configured when TEI starts.
|
||||
//
|
||||
// Settings.ExtraBody is merged in but cannot replace query, texts or
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
|
||||
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
|
||||
lkeap "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lkeap/v20240522"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package api
|
||||
|
||||
import "github.com/Tencent/WeKnora/internal/types"
|
||||
import "academy/internal/types"
|
||||
|
||||
// ThinkingEmitter owns the "reasoning then answer" hand-off that every
|
||||
// streaming Chat implementation shares: thinking chunks are forwarded as they
|
||||
|
||||
@@ -6,7 +6,7 @@ import "context"
|
||||
// EmbeddingAPI it is its own type, so no other modality's value validates.
|
||||
type TranscriptionAPI string
|
||||
|
||||
// The transcription protocols WeKnora speaks.
|
||||
// The transcription protocols Academy speaks.
|
||||
const (
|
||||
// TranscriptionOpenAI is POST {base}/audio/transcriptions as a multipart
|
||||
// form carrying file and model, answering {text} — or {text, segments}
|
||||
|
||||
@@ -8,17 +8,17 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
secutils "github.com/Tencent/WeKnora/internal/utils"
|
||||
secutils "academy/internal/utils"
|
||||
)
|
||||
|
||||
// LLM 调用超时配置。仅作为"上层未设置 deadline 时"的兜底,避免 hung 请求
|
||||
// 永久阻塞 worker。如果上层 ctx 已经设置了 deadline(无论比默认更短还是更长),
|
||||
// 都会原样尊重,不再叠加默认超时。可通过环境变量覆盖:
|
||||
// - WEKNORA_LLM_CHAT_TIMEOUT_SECONDS 非流式调用兜底超时(默认 600s)
|
||||
// - WEKNORA_LLM_STREAM_TIMEOUT_SECONDS 流式调用兜底超时(默认 1800s)
|
||||
// - ACADEMY_LLM_CHAT_TIMEOUT_SECONDS 非流式调用兜底超时(默认 600s)
|
||||
// - ACADEMY_LLM_STREAM_TIMEOUT_SECONDS 流式调用兜底超时(默认 1800s)
|
||||
var (
|
||||
DefaultChatTimeout = envDurationSeconds("WEKNORA_LLM_CHAT_TIMEOUT_SECONDS", 300*time.Second)
|
||||
DefaultStreamTimeout = envDurationSeconds("WEKNORA_LLM_STREAM_TIMEOUT_SECONDS", 600*time.Second)
|
||||
DefaultChatTimeout = envDurationSeconds("ACADEMY_LLM_CHAT_TIMEOUT_SECONDS", 300*time.Second)
|
||||
DefaultStreamTimeout = envDurationSeconds("ACADEMY_LLM_STREAM_TIMEOUT_SECONDS", 600*time.Second)
|
||||
)
|
||||
|
||||
// envDurationSeconds 读取以"秒"为单位的环境变量,解析失败或非正值时回退到 fallback。
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestWithLLMTimeout_LongerParentDeadline_NotTruncated(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEnvDurationSeconds(t *testing.T) {
|
||||
const key = "WEKNORA_TEST_TIMEOUT_SECONDS"
|
||||
const key = "ACADEMY_TEST_TIMEOUT_SECONDS"
|
||||
|
||||
t.Run("unset returns fallback", func(t *testing.T) {
|
||||
os.Unsetenv(key)
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// API identifies a wire protocol. It is the value of the "api" field in a
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package api
|
||||
|
||||
import "github.com/Tencent/WeKnora/internal/types"
|
||||
import "academy/internal/types"
|
||||
|
||||
// OpenAIUsage is the superset of the usage shapes OpenAI-compatible
|
||||
// endpoints return. Vendors disagree on where cache counters live:
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
// LogUsage emits the standard "[LLM Usage]" line shared by every Chat
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
"academy/internal/types"
|
||||
)
|
||||
|
||||
func TestUsageAttributionEmptyOutsideSessions(t *testing.T) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/models/api"
|
||||
"academy/internal/models/api"
|
||||
"github.com/volcengine/vikingdb-go-sdk/knowledge"
|
||||
knowledgemodel "github.com/volcengine/vikingdb-go-sdk/knowledge/model"
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user