diff --git a/.env.example b/.env.example index c3134221..0f108e9b 100644 --- a/.env.example +++ b/.env.example @@ -147,7 +147,7 @@ DISABLE_REGISTRATION=false # WEKNORA_AUTH_DEFAULT_TENANT_MODE=create_personal # 是否允许普通用户登录后主动创建空间。设为 false 时只能通过邀请加入已有空间, -# 跨租户超管不受影响。默认 true。 +# 跨空间超管不受影响。默认 true。 # WEKNORA_TENANT_SELF_SERVICE_CREATION_ENABLED=true # Ollama 服务的基准 URL,用于连接本地/其他服务器上运行的 Ollama 服务 @@ -513,7 +513,7 @@ WEKNORA_SANDBOX_TIMEOUT=60 # WEKNORA_AGENT_TOOL_APPROVAL_TIMEOUT=600 # ========== Tenant / RBAC 配置 ========== -# 启用租户级 RBAC(基于 tenant_members 表的角色强制鉴权)。 +# 启用空间级 RBAC(基于 tenant_members 表的角色强制鉴权)。 # - true(默认):开启后,无 active membership 或角色不足的请求会被 403 拒绝 # - false:观察模式,记录但不拦截,仅用于上线初期审计角色分配的灰度窗口 # 详细灰度方案见 docs/RBAC说明.md。 @@ -527,7 +527,7 @@ WEKNORA_SANDBOX_TIMEOUT=60 # - 适用于 docker-compose / k8s 部署的初次自举;后续的提权/撤销请走 SystemAdmin 管理页 # WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL= -# 单个非超管用户可自助创建(成为 Owner)的租户数上限。 +# 单个非超管用户可自助创建(成为 Owner)的空间数上限。 # 仅统计 Owner 角色——被邀请为 Admin/Editor/Viewer 的不计入。 # 拥有 CanAccessAllTenants 的超管不受此限制。 # > 0 :启用该值作为硬上限;超出返回 429 @@ -535,10 +535,10 @@ WEKNORA_SANDBOX_TIMEOUT=60 # < 0 :彻底关闭限额(不建议在共享部署中使用) # WEKNORA_TENANT_MAX_OWNED_PER_USER= -# 创建租户时是否自动生成一个全量权限(full_access)的 API Key, -# 并在「创建租户」接口的响应中返回其明文 token(字段 api_key)。 -# 用于兼容旧版本「创建租户即下发默认 API Key」的行为(破坏性变更的回退开关)。 -# - true :创建租户时自动创建 full_access API Key 并返回 token +# 创建空间时是否自动生成一个全量权限(full_access)的 API Key, +# 并在「创建空间」接口的响应中返回其明文 token(字段 api_key)。 +# 用于兼容旧版本「创建空间即下发默认 API Key」的行为(破坏性变更的回退开关)。 +# - true :创建空间时自动创建 full_access API Key 并返回 token # - false(默认):不自动创建,需通过 API Key 管理页/接口显式创建 # 也可在系统设置中以 tenant.auto_create_api_key 实时调整,无需重启。 # WEKNORA_TENANT_AUTO_CREATE_API_KEY=false diff --git a/README.md b/README.md index 90eb0178..9d4873ec 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ [**WeKnora**](https://weknora.weixin.qq.com) is an open-source, LLM-powered knowledge framework built for enterprise-grade document understanding, semantic retrieval, and autonomous reasoning. -It is organized around three core capabilities: **RAG-based Quick Q&A** for everyday lookups, a **ReAct Agent** that autonomously orchestrates retrieval, MCP tools and web search to handle complex multi-step tasks, and a brand-new **Wiki Mode** in which agents distill raw documents into a self-maintaining, interlinked markdown knowledge base with an interactive knowledge graph. Combined with multi-source ingestion (Feishu / Notion / Yuque / RSS, and growing), **website embed widgets** for publishing agents to external sites, 20+ LLM provider integrations, full Langfuse observability, **enterprise-ready multi-tenant RBAC** (4-tier role matrix + per-resource ownership + per-tenant audit log), and a fully self-hostable modular architecture, WeKnora turns scattered documents into a queryable, reasoning-capable, continuously evolving knowledge asset. +It is organized around three core capabilities: **RAG-based Quick Q&A** for everyday lookups, a **ReAct Agent** that autonomously orchestrates retrieval, MCP tools and web search to handle complex multi-step tasks, and a brand-new **Wiki Mode** in which agents distill raw documents into a self-maintaining, interlinked markdown knowledge base with an interactive knowledge graph. Combined with multi-source ingestion (Feishu / Notion / Yuque / RSS, and growing), **website embed widgets** for publishing agents to external sites, 20+ LLM provider integrations, full Langfuse observability, **enterprise-ready multi-workspace RBAC** (4-tier role matrix + per-resource ownership + per-workspace audit log), and a fully self-hostable modular architecture, WeKnora turns scattered documents into a queryable, reasoning-capable, continuously evolving knowledge asset. The framework supports auto-syncing knowledge from Feishu, Notion, and Yuque (more data sources coming soon), handles 10+ document formats including PDF, Word, images, and Excel, and can serve Q&A directly through IM channels like WeCom, Feishu, Slack, and Telegram. It is compatible with major LLM providers including OpenAI, DeepSeek, Qwen (Alibaba Cloud), Zhipu, Hunyuan, Gemini, MiniMax, NVIDIA, and Ollama. Its fully modular design allows swapping LLMs, vector databases, and storage backends, with support for local and private cloud deployment ensuring complete data sovereignty. WeKnora also integrates with **Langfuse** for comprehensive observability into agent reasoning, token usage, and pipeline tracing. @@ -60,9 +60,9 @@ The framework supports auto-syncing knowledge from Feishu, Notion, and Yuque (mo - **v0.6.3** — Website embed widget & Integrations Center (secure-mode token exchange + rate limits); chat experience overhaul (citation popovers, RAG pipeline progress, streaming markdown); document multi-tag & batch reparse; Wiki folders & hierarchy navigation; RSS data source; MCP OAuth2; EPUB / MHTML parsing; agent model-readiness checks; model test debugger; session source filter; workspace deletion UI. See [`CHANGELOG.md`](./CHANGELOG.md). - **v0.6.2** — Per-upload process configuration with upload-confirm dialog; document reparse with `process_config`; `weknora` CLI v0.9 (bundled Agent Skills, `session stop`, auth/profile harmonization); KB marquee multi-select; HNSW index for 1024-dim pgvector embeddings; chat resources store refactor; Langfuse-only tracing (Jaeger removed). See [`CHANGELOG.md`](./CHANGELOG.md). - **v0.6.1** — Document parsing trace timeline (Langfuse-style span tree with stage-by-stage progress + stop-parse); OpenSearch vector store driver; declarative built-in models via YAML; system admin & consolidated platform settings + audit log; new-user onboarding guide; settings UI redesign; `weknora` CLI v0.7 / v0.8 (agent-first wire contract, NDJSON, `--dry-run`); OpenDataLoader + PaddleOCR-VL parsers; MCP server multi-transport (stdio / SSE / HTTP); per-model thinking-mode config; Tencent LKEAP rerank + native Gemini embeddings + MiniMax-M3. See [`CHANGELOG.md`](./CHANGELOG.md). -- **v0.6.0** — Tenant RBAC (4-tier role matrix `Owner` / `Admin` / `Contributor` / `Viewer` + per-KB ownership + per-tenant audit log), tenant member management & multi-workspace UX, self-service workspaces; `weknora` CLI v0.4 GA with `mcp serve`; KB retrieval fan-out across vector stores; AES-256-GCM credential encryption + docreader gRPC TLS + Token; Zhipu embedder + Huawei OBS; server-side user preferences; Go 1.26.0. See [`docs/RBAC说明.md`](./docs/RBAC说明.md) and [`CHANGELOG.md`](./CHANGELOG.md). +- **v0.6.0** — Workspace RBAC (4-tier role matrix `Owner` / `Admin` / `Contributor` / `Viewer` + per-KB ownership + per-workspace audit log), workspace member management & multi-workspace UX, self-service workspaces; `weknora` CLI v0.4 GA with `mcp serve`; KB retrieval fan-out across vector stores; AES-256-GCM credential encryption + docreader gRPC TLS + Token; Zhipu embedder + Huawei OBS; server-side user preferences; Go 1.26.0. See [`docs/RBAC说明.md`](./docs/RBAC说明.md) and [`CHANGELOG.md`](./CHANGELOG.md). - **v0.5.2** — Wiki ingest scales to 40k-document KBs (task queue + DLQ); MCP human-in-the-loop tool approval; Anthropic / Apache Doris / Tencent VectorDB / KS3 / SearXNG backends; adaptive 3-tier chunking with live preview; global ⌘K command palette; Yuque connector + WeChat Mini Program; `weknora` CLI preview. -- **v0.5.1** — Knowledge-base batch management; tenant-wide IM channels overview; session search + user-scoped pinning; unified Model / Web Search / MCP settings cards; per-agent LLM timeout; desktop tenant switching. +- **v0.5.1** — Knowledge-base batch management; workspace-wide IM channels overview; session search + user-scoped pinning; unified Model / Web Search / MCP settings cards; per-agent LLM timeout; desktop workspace switching. - **v0.5.0** — Wiki Mode GA — agents auto-generate structured, interlinked Markdown wiki pages with a knowledge graph; wiki browser + visual graph in the UI. - **v0.4.0** — WeKnora Cloud (hosted LLM + parsing); Chrome Extension; ClawHub Skill; WeChat IM; attachment processing; Azure OpenAI / Alibaba OSS; Notion connector; Baidu + Ollama web search; VectorStore management. - **v0.3.6** — ASR (audio); Feishu data-source auto-sync; OIDC; IM quote-reply context + thread-based sessions; document summarization; Tavily search; parallel tool calling; agent @mention scope restriction. @@ -145,11 +145,11 @@ Fully modular pipeline from document parsing, vectorization, and retrieval to LL |------------|---------| | Deployment | Local / Docker / Kubernetes (Helm) with private and offline support | | UI | Web UI / RESTful API / CLI (`weknora`) / Chrome Extension / Website Embed Widget / WeChat Mini Program | -| Access Control | Tenant RBAC with 4-tier role matrix (Owner / Admin / Contributor / Viewer), per-KB resource ownership, per-tenant audit log, invite-only workspaces, self-service tenant creation, cross-tenant superuser | +| Access Control | Workspace RBAC with 4-tier role matrix (Owner / Admin / Contributor / Viewer), per-KB resource ownership, per-workspace audit log, invite-only workspaces, self-service workspace creation, cross-workspace superuser | | Security | AES-256-GCM at-rest encryption for API keys and MCP / data-source credentials with graceful key rotation; gRPC TLS + Token between app and docreader; SSRF-safe HTTP client; sandbox isolation for agent skills | | Observability | Integrated Langfuse (sole tracing backend) for ReAct loops, token tracking, tool calls, and pipeline tracing; built-in Langfuse-style document parsing trace timeline with stage-by-stage progress | | Task Management | MQ async tasks, automatic database migration on version upgrade | -| Model Management | Centralized config, declarative built-in models via YAML, per-knowledge-base model selection, per-model thinking-mode and embedding-dimension overrides, interactive model test debugger, multi-tenant built-in model sharing, WeKnora Cloud hosted models and parsing | +| Model Management | Centralized config, declarative built-in models via YAML, per-knowledge-base model selection, per-model thinking-mode and embedding-dimension overrides, interactive model test debugger, multi-workspace built-in model sharing, WeKnora Cloud hosted models and parsing | ## 🧩 Chrome Extension diff --git a/README_CN.md b/README_CN.md index 76c42d3b..c49fc2b3 100644 --- a/README_CN.md +++ b/README_CN.md @@ -50,7 +50,7 @@ **[WeKnora(维娜拉)](https://weknora.weixin.qq.com)** 是一款开源的、基于大语言模型(LLM)的知识管理框架,专为企业级文档理解、语义检索与智能推理场景打造。 -框架围绕三大核心能力构建:**RAG 快速问答**适合日常知识查询,**ReAct Agent 智能推理**自主编排知识检索、MCP 工具与网络搜索完成复杂多步任务,全新的 **Wiki 模式**则让 Agent 从原始文档中自治生成相互链接的 Markdown 知识库与可视化知识图谱。结合多源数据接入(飞书 / Notion / 语雀 / RSS,更多持续接入中)、**网站嵌入 Widget** 将智能体发布到外部站点、二十余家主流模型厂商集成、Langfuse 全链路可观测性、**企业级多租户 RBAC(四级角色矩阵 + 资源归属 + 租户审计日志)**,以及完全可私有化部署的模块化架构,WeKnora 帮助团队把分散文档沉淀为可查询、可推理、可持续演进的专属知识资产。 +框架围绕三大核心能力构建:**RAG 快速问答**适合日常知识查询,**ReAct Agent 智能推理**自主编排知识检索、MCP 工具与网络搜索完成复杂多步任务,全新的 **Wiki 模式**则让 Agent 从原始文档中自治生成相互链接的 Markdown 知识库与可视化知识图谱。结合多源数据接入(飞书 / Notion / 语雀 / RSS,更多持续接入中)、**网站嵌入 Widget** 将智能体发布到外部站点、二十余家主流模型厂商集成、Langfuse 全链路可观测性、**企业级多空间 RBAC(四级角色矩阵 + 资源归属 + 空间审计日志)**,以及完全可私有化部署的模块化架构,WeKnora 帮助团队把分散文档沉淀为可查询、可推理、可持续演进的专属知识资产。 框架支持从飞书、Notion 及语雀等外部平台自动同步知识(更多数据源持续接入中),覆盖 PDF、Word、图片、Excel 等十余种文档格式,并可通过企业微信、飞书、Slack、Telegram 等 IM 频道直接提供问答服务。模型层面兼容 OpenAI、DeepSeek、Qwen(阿里云)、智谱、混元、Gemini、MiniMax、NVIDIA、Ollama 等主流厂商。全流程模块化设计,大模型、向量数据库、存储等组件均可灵活替换,支持本地与私有云部署,数据完全自主可控。WeKnora 还无缝集成了 **Langfuse**,为 Agent 运行、Token 使用及任务流水线提供了全面的可观测性追踪。 @@ -59,9 +59,9 @@ - **v0.6.3** —— 网站嵌入 Widget 与发布集成中心(安全模式 Token 交换 + 限流);对话体验全面革新(引用浮层、RAG 流水线进度、流式 Markdown);文档多标签与批量重新解析;Wiki 文件夹与层级导航;RSS 数据源;MCP OAuth2;EPUB / MHTML 解析;Agent 模型就绪校验;模型调试器;会话来源筛选;工作区删除 UI。详见 [`CHANGELOG.md`](./CHANGELOG.md)。 - **v0.6.2** —— 按批次解析配置(`process_config`)+ 上传确认对话框;文档重新解析(reparse)支持覆盖配置;`weknora` CLI v0.9(内置 Agent Skills、`session stop`、auth/profile 统一);知识库框选多选;pgvector 1024 维 HNSW 索引;对话资源 Store 重构;仅保留 Langfuse 追踪(移除 Jaeger)。详见 [`CHANGELOG.md`](./CHANGELOG.md)。 - **v0.6.1** —— 文档解析追踪时间线(Langfuse 风格 Span 树,逐阶段进度展示 + 解析中止);OpenSearch 向量库驱动;YAML 声明式内置模型配置;系统管理员与统一平台设置 + 审计日志;新用户引导;设置页 UI 重构;`weknora` CLI v0.7 / v0.8(Agent 优先线协议、NDJSON、`--dry-run`);OpenDataLoader 与 PaddleOCR-VL 解析引擎;MCP Server 多传输(stdio / SSE / HTTP);按模型的思考模式配置;腾讯云 LKEAP 重排 + 原生 Gemini Embedding + MiniMax-M3。详见 [`CHANGELOG.md`](./CHANGELOG.md)。 -- **v0.6.0** —— 租户 RBAC(四级角色矩阵 `Owner` / `Admin` / `Contributor` / `Viewer` + 按 KB 归属 + 每租户审计日志)、租户成员管理与多工作区 UX、自助创建工作区;`weknora` CLI v0.4 正式版 + `mcp serve`;KB 检索跨向量库扇出;MCP / 数据源凭据 AES-256-GCM 加密 + docreader gRPC TLS + Token;新增智谱 Embedding 与华为云 OBS;服务端用户偏好;Go 1.26.0。详见 [`docs/RBAC说明.md`](./docs/RBAC说明.md) 与 [`CHANGELOG.md`](./CHANGELOG.md)。 +- **v0.6.0** —— 空间 RBAC(四级角色矩阵 `Owner` / `Admin` / `Contributor` / `Viewer` + 按 KB 归属 + 每空间审计日志)、空间成员管理与多工作区 UX、自助创建工作区;`weknora` CLI v0.4 正式版 + `mcp serve`;KB 检索跨向量库扇出;MCP / 数据源凭据 AES-256-GCM 加密 + docreader gRPC TLS + Token;新增智谱 Embedding 与华为云 OBS;服务端用户偏好;Go 1.26.0。详见 [`docs/RBAC说明.md`](./docs/RBAC说明.md) 与 [`CHANGELOG.md`](./CHANGELOG.md)。 - **v0.5.2** —— Wiki 入库支撑万级文档知识库(任务队列 + 死信队列);MCP 工具人机审批;Anthropic / Apache Doris / 腾讯云 VectorDB / 金山云 KS3 / SearXNG 后端;自适应三层分块 + 实时调试面板;全局 ⌘K 命令面板;语雀连接器 + 微信小程序;`weknora` CLI 早期版本。 -- **v0.5.1** —— 知识库批量管理;租户级 IM 频道总览;会话搜索 + 用户级置顶;模型 / 网页搜索 / MCP 统一卡片化设置;按 Agent LLM 调用超时;桌面端租户切换。 +- **v0.5.1** —— 知识库批量管理;空间级 IM 频道总览;会话搜索 + 用户级置顶;模型 / 网页搜索 / MCP 统一卡片化设置;按 Agent LLM 调用超时;桌面端空间切换。 - **v0.5.0** —— Wiki 模式正式版 —— Agent 从原始文档自治生成结构化、相互链接的 Markdown Wiki 页面及知识图谱;Wiki 浏览器 + 可视化图谱。 - **v0.4.0** —— WeKnora Cloud(托管模型 + 解析);Chrome 插件;ClawHub Skill;微信 IM;附件处理;Azure OpenAI / 阿里云 OSS;Notion 连接器;百度 + Ollama 网页搜索;VectorStore 管理。 - **v0.3.6** —— ASR 语音;飞书数据源自动同步;OIDC;IM 引用回复 + 线程会话;文档自动摘要;Tavily 搜索;并行工具调用;Agent @提及范围限制。 @@ -145,11 +145,11 @@ |------|------| | 部署 | 本地 / Docker / Kubernetes (Helm),支持私有化离线部署 | | 界面 | Web UI / RESTful API / 命令行(`weknora`)/ Chrome Extension / 网站嵌入 Widget / 微信小程序 | -| 权限控制 | 租户 RBAC 四级角色矩阵(Owner / Admin / Contributor / Viewer),按知识库的资源归属,每租户审计日志,invite-only 准入,自助创建工作区,跨租户超级管理员 | +| 权限控制 | 空间 RBAC 四级角色矩阵(Owner / Admin / Contributor / Viewer),按知识库的资源归属,每空间审计日志,invite-only 准入,自助创建工作区,跨空间超级管理员 | | 安全 | API Key 与 MCP / 数据源凭据 AES-256-GCM 静态加密、支持平滑密钥轮换;app ↔ docreader gRPC TLS + Token;防 SSRF HTTP 客户端;Agent 技能沙箱隔离 | | 可观测性 | 集成 Langfuse(唯一追踪后端)以追踪 ReAct 循环、Token 消耗、工具调用和任务流水线;内置 Langfuse 风格的文档解析追踪时间线,逐阶段展示解析进度 | | 任务管理 | MQ 异步任务,版本升级自动数据库迁移 | -| 模型管理 | 集中配置,YAML 声明式内置模型配置,知识库级别模型选择,按模型思考模式与 Embedding 维度覆盖,交互式模型调试器,多租户共享内置模型,WeKnora Cloud 托管模型与文档解析 | +| 模型管理 | 集中配置,YAML 声明式内置模型配置,知识库级别模型选择,按模型思考模式与 Embedding 维度覆盖,交互式模型调试器,多空间共享内置模型,WeKnora Cloud 托管模型与文档解析 | ## 🧩 Chrome 插件 diff --git a/client/README.md b/client/README.md index 75cfb263..230ab29d 100644 --- a/client/README.md +++ b/client/README.md @@ -9,7 +9,7 @@ 1. **会话管理**:创建、获取、更新和删除会话 2. **知识库管理**:创建、获取、更新和删除知识库 3. **知识管理**:添加、获取和删除知识内容 -4. **租户管理**:租户的CRUD操作 +4. **空间管理**:空间的CRUD操作 5. **知识问答**:支持普通问答和流式问答 6. **Agent问答**:支持基于Agent的智能问答,包含思考过程、工具调用和反思 7. **分块管理**:查询、更新和删除知识分块 @@ -35,9 +35,9 @@ apiClient := client.NewClient( ) ``` -### 租户配置 +### 空间配置 -客户端支持通过 `WithTenantID` 设置默认租户,请求时会自动携带 `X-Tenant-ID` 请求头: +客户端支持通过 `WithTenantID` 设置默认空间,请求时会自动携带 `X-Tenant-ID` 请求头: ```go tenantID := uint64(10000) @@ -48,11 +48,11 @@ apiClient := client.NewClient( ) ``` -如果某个请求需要临时切换租户,可以在 `context` 中设置 `TenantID`,值可以是 `uint64`、`*uint64` 或字符串形式的数字,客户端会优先使用该值: +如果某个请求需要临时切换空间,可以在 `context` 中设置 `TenantID`,值可以是 `uint64`、`*uint64` 或字符串形式的数字,客户端会优先使用该值: ```go ctx := context.WithValue(context.Background(), "TenantID", uint64(10000)) -// 调用任意客户端方法时传入 ctx,即可切换到租户 10000 +// 调用任意客户端方法时传入 ctx,即可切换到空间 10000 ``` ### 示例:创建知识库并上传文件 diff --git a/client/README_EN.md b/client/README_EN.md index a7422d71..cd7ae962 100644 --- a/client/README_EN.md +++ b/client/README_EN.md @@ -9,7 +9,7 @@ The client includes the following main functional modules: 1. **Session Management**: Create, retrieve, update, and delete sessions 2. **Knowledge Base Management**: Create, retrieve, update, and delete knowledge bases 3. **Knowledge Management**: Add, retrieve, and delete knowledge content -4. **Tenant Management**: CRUD operations for tenants +4. **Workspace Management**: CRUD operations for workspaces 5. **Knowledge Q&A**: Supports regular Q&A and streaming Q&A 6. **Chunk Management**: Query, update, and delete knowledge chunks 7. **Message Management**: Retrieve and delete session messages @@ -35,9 +35,9 @@ apiClient := client.NewClient( ) ``` -### Tenant Configuration +### Workspace Configuration -You can set a default tenant with `WithTenantID`; the client will automatically send the `X-Tenant-ID` header: +You can set a default workspace with `WithTenantID`; the client will automatically send the `X-Tenant-ID` header: ```go tenantID := uint64(10000) @@ -48,11 +48,11 @@ apiClient := client.NewClient( ) ``` -If a single request needs a different tenant, set `TenantID` in the request context. The value can be a `uint64`, `*uint64`, or a numeric string, and it will take precedence over the client default: +If a single request needs a different workspace, set `TenantID` in the request context. The value can be a `uint64`, `*uint64`, or a numeric string, and it will take precedence over the client default: ```go ctx := context.WithValue(context.Background(), "TenantID", uint64(10000)) -// Pass ctx into any client method to switch to tenant 10000 for that request +// Pass ctx into any client method to switch to workspace 10000 for that request ``` ### Example: Create Knowledge Base and Upload File diff --git a/cmd/server/main.go b/cmd/server/main.go index 069fcde1..3f027c06 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -19,7 +19,7 @@ // @securityDefinitions.apikey ApiKeyAuth // @in header // @name X-API-Key -// @description 租户身份认证:输入 sk- 开头的 API Key +// @description 空间身份认证:输入 sk- 开头的 API Key package main import ( diff --git a/docker-compose.yml b/docker-compose.yml index bea602d1..9e560f40 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -189,10 +189,10 @@ services: - WEKNORA_AGENT_LLM_TIMEOUT=${WEKNORA_AGENT_LLM_TIMEOUT:-} - WEKNORA_AGENT_TOOL_APPROVAL_TIMEOUT=${WEKNORA_AGENT_TOOL_APPROVAL_TIMEOUT:-} # Tenant / RBAC(详见 docs/RBAC说明.md 与 .env.example 注释) - # - WEKNORA_TENANT_ENABLE_RBAC: 是否启用租户角色强制鉴权(true / false),默认 true - # - WEKNORA_TENANT_MAX_OWNED_PER_USER: 单个非超管自助创建租户的上限 + # - WEKNORA_TENANT_ENABLE_RBAC: 是否启用空间角色强制鉴权(true / false),默认 true + # - WEKNORA_TENANT_MAX_OWNED_PER_USER: 单个非超管自助创建空间的上限 # >0 强制限额;=0 走 handler 默认;<0 关闭限额(不建议共享部署使用) - # - WEKNORA_TENANT_AUTO_CREATE_API_KEY: 创建租户时自动生成 full_access API Key 并在响应中返回 token + # - WEKNORA_TENANT_AUTO_CREATE_API_KEY: 创建空间时自动生成 full_access API Key 并在响应中返回 token # (兼容旧版默认下发 API Key 行为,破坏性变更回退开关;true / false,默认 false) - WEKNORA_TENANT_ENABLE_RBAC=${WEKNORA_TENANT_ENABLE_RBAC:-} - WEKNORA_TENANT_MAX_OWNED_PER_USER=${WEKNORA_TENANT_MAX_OWNED_PER_USER:-} diff --git a/docs/BUILTIN_MCP_SERVICES.md b/docs/BUILTIN_MCP_SERVICES.md index 5f79823e..ecef2d6f 100644 --- a/docs/BUILTIN_MCP_SERVICES.md +++ b/docs/BUILTIN_MCP_SERVICES.md @@ -2,11 +2,11 @@ ## 概述 -内置 MCP 服务是系统级别的 MCP(Model Context Protocol)服务配置,对所有租户可见,但敏感信息会被隐藏,且不可编辑或删除。内置 MCP 服务通常用于提供系统默认的外部工具和资源接入,确保所有租户都能使用统一的 MCP 服务。 +内置 MCP 服务是系统级别的 MCP(Model Context Protocol)服务配置,对所有空间可见,但敏感信息会被隐藏,且不可编辑或删除。内置 MCP 服务通常用于提供系统默认的外部工具和资源接入,确保所有空间都能使用统一的 MCP 服务。 ## 内置 MCP 服务特性 -- **所有租户可见**:内置 MCP 服务对所有租户都可见,无需单独配置 +- **所有空间可见**:内置 MCP 服务对所有空间都可见,无需单独配置 - **安全保护**:内置 MCP 服务的敏感信息(URL、认证配置、Headers、环境变量)会被隐藏,无法查看详情 - **只读保护**:内置 MCP 服务不能被编辑或删除,仅支持测试连接 - **统一管理**:由系统管理员统一维护,确保配置一致性和安全性 @@ -16,7 +16,7 @@ | 特性 | 内置模型 | 内置 MCP 服务 | |------|---------|--------------| | 标识字段 | `is_builtin` | `is_builtin` | -| 可见范围 | 所有租户 | 所有租户 | +| 可见范围 | 所有空间 | 所有空间 | | 隐藏信息 | API Key、Base URL | URL、认证配置、Headers、环境变量 | | 编辑保护 | 不可编辑/删除 | 不可编辑/删除 | | 前端标签 | 显示"内置"标签 | 显示"内置"标签 | @@ -35,7 +35,7 @@ - 服务地址(url):SSE / HTTP Streamable 必填 - 认证配置(auth_config):可选,包括 api_key、token 等 - 高级配置(advanced_config):可选,包括超时、重试策略等 -- 租户ID(tenant_id):建议使用小于 10000 的租户ID,避免冲突 +- 空间ID(tenant_id):建议使用小于 10000 的空间ID,避免冲突 **支持的传输方式**: - `sse`:Server-Sent Events,推荐用于流式体验 @@ -62,7 +62,7 @@ INSERT INTO mcp_services ( is_builtin ) VALUES ( 'builtin-mcp-001', -- 使用固定ID,建议使用 builtin-mcp- 前缀 - 10000, -- 租户ID(使用第一个租户) + 10000, -- 空间ID(使用第一个空间) 'Web Search', -- 服务名称 '内置 Web 搜索 MCP 服务', -- 描述 true, -- 启用状态 @@ -115,7 +115,7 @@ ORDER BY created_at; ## 注意事项 1. **ID 命名规范**:建议使用 `builtin-mcp-{序号}` 的格式,例如 `builtin-mcp-001`、`builtin-mcp-002` -2. **租户ID**:内置 MCP 服务可以属于任意租户,但建议使用第一个租户ID(通常是 10000) +2. **空间ID**:内置 MCP 服务可以属于任意空间,但建议使用第一个空间ID(通常是 10000) 3. **JSON 格式**:`auth_config`、`advanced_config`、`headers` 等字段必须是有效的 JSON 格式 4. **幂等性**:使用 `ON CONFLICT (id) DO NOTHING` 确保重复执行不会报错 5. **安全性**:内置 MCP 服务的 URL、认证信息在前端会被自动隐藏,但数据库中的原始数据仍然存在,请妥善保管数据库访问权限 diff --git a/docs/BUILTIN_MODELS.md b/docs/BUILTIN_MODELS.md index 883c375a..6816cd8b 100644 --- a/docs/BUILTIN_MODELS.md +++ b/docs/BUILTIN_MODELS.md @@ -2,18 +2,18 @@ ## 概述 -内置模型是系统级别的模型配置,对所有租户可见。普通租户用户(包括租户管理员)看到的敏感信息会被隐藏,且不能修改;系统管理员可以在「模型管理」界面编辑配置和凭据。内置模型通常用于提供系统默认的模型配置,确保所有租户都能使用统一的模型服务。 +内置模型是系统级别的模型配置,对所有空间可见。普通空间用户(包括空间管理员)看到的敏感信息会被隐藏,且不能修改;系统管理员可以在「模型管理」界面编辑配置和凭据。内置模型通常用于提供系统默认的模型配置,确保所有空间都能使用统一的模型服务。 ## 内置模型特性 -- **所有租户可见**:内置模型对所有租户都可见,无需单独配置 +- **所有空间可见**:内置模型对所有空间都可见,无需单独配置 - **安全保护**:API Key 等凭据永远不会明文返回;只有系统管理员能看到 Base URL 等管理信息和凭据是否已配置 -- **权限保护**:普通租户用户只能查看;系统管理员可以编辑配置和凭据 -- **统一管理**:内置模型对所有租户生效;删除仍通过 YAML 或 SQL 管理,避免部署配置与运行时状态冲突 +- **权限保护**:普通空间用户只能查看;系统管理员可以编辑配置和凭据 +- **统一管理**:内置模型对所有空间生效;删除仍通过 YAML 或 SQL 管理,避免部署配置与运行时状态冲突 ## 在管理界面编辑 -系统管理员可直接在「设置 → 模型管理」中点击内置模型,修改模型参数或更新凭据。普通租户管理员仍然只能查看。 +系统管理员可直接在「设置 → 模型管理」中点击内置模型,修改模型参数或更新凭据。普通空间管理员仍然只能查看。 首次通过管理界面保存 YAML 托管的内置模型后,该行会转为运行时托管(`managed_by` 清空),后续应用启动不会再用同 ID 的 YAML 条目覆盖它。这样可以保证界面保存的结果在重启后仍然有效。若希望重新交给 YAML 管理,需要由部署管理员在数据库中把该行的 `managed_by` 恢复为 `yaml`,或移除运行时覆盖后重新启动。 @@ -271,7 +271,7 @@ DELETE FROM models WHERE id = '模型ID'; ## 注意事项 1. **ID 命名规范**:建议使用 `builtin-{type}-{slug}` 的格式,例如 `builtin-openai-chat`、`builtin-rerank` -2. **租户ID**:内置模型可以属于任意租户,默认 `10000`(与 `tenants_id_seq` 起点一致) +2. **空间ID**:内置模型可以属于任意空间,默认 `10000`(与 `tenants_id_seq` 起点一致) 3. **YAML 与 SQL 并存**:两种方式可以同时使用,loader 只动 `managed_by='yaml'` 的行;通过 SQL 插入的 builtin 行对 loader 完全不可见 4. **`is_default` 单一保证**:YAML 中将某条 entry 标记 `is_default: true` 时,loader 会先把同 `(tenant_id, type)` 下的其它默认模型置为 `false`,避免 API 路径维护的"每类型一个默认模型"语义被破坏 5. **重启即生效**:修改 YAML 后 `docker compose restart app` 即可让新配置生效 diff --git a/docs/LITE.md b/docs/LITE.md index d40b53bd..e3cadc29 100644 --- a/docs/LITE.md +++ b/docs/LITE.md @@ -1,16 +1,16 @@ # WeKnora Lite 与标准版区别 -Lite 面向希望快速在本地使用、部署尽量简单的场景;标准版面向多租户协作与完整企业能力。主要差异如下。 +Lite 面向希望快速在本地使用、部署尽量简单的场景;标准版面向多空间协作与完整企业能力。主要差异如下。 | 维度 | Lite | 标准版 | | --------- | ----------------------------------------------- | --------------------------------- | -| **共享空间** | 不提供共享空间(成员邀请、跨成员共享知识库与智能体等) | 提供共享空间及租户隔离检索等协作能力 | -| **租户与账号** | 单租户;开箱即用,**无需注册** | 多租户;通常需要注册、登录与组织管理 | +| **共享空间** | 不提供共享空间(成员邀请、跨成员共享知识库与智能体等) | 提供共享空间及空间隔离检索等协作能力 | +| **空间与账号** | 单空间;开箱即用,**无需注册** | 多空间;通常需要注册、登录与组织管理 | | **文档解析** | 内置仅 **Simple** 类型解析引擎;可通过 **Cloud** 等方式接入其他解析能力 | 可配置多种解析引擎(含高精度等),与完整文档处理链路集成 | | **部署形态** | **单应用、零依赖**(不依赖独立的数据库、消息队列等外部服务栈) | 典型为 Docker Compose 等多服务部署,依赖与组件更多 | | **数据归属** | 数据**完全在本地**存储与处理 | 私有化部署时数据也可在本地;具体取决于你的部署方式 | | **网络暴露** | **默认仅本机访问**;可按需配置,**选择是否放行到公网** | 按部署与安全策略自行绑定地址与网关 | -若你不需要多团队协作、复杂解析流水线与多服务架构,Lite 更适合个人或小团队在本机零依赖试用;需要共享空间、多租户与完整解析引擎矩阵时,请使用标准版。 \ No newline at end of file +若你不需要多团队协作、复杂解析流水线与多服务架构,Lite 更适合个人或小团队在本机零依赖试用;需要共享空间、多空间与完整解析引擎矩阵时,请使用标准版。 \ No newline at end of file diff --git a/docs/Langfuse集成.md b/docs/Langfuse集成.md index 74049210..6bd13431 100644 --- a/docs/Langfuse集成.md +++ b/docs/Langfuse集成.md @@ -233,7 +233,7 @@ Dev 相关容器都带 `-dev` 后缀、用独立网络 `WeKnora-network-dev`, | Input Tokens | `TokenUsage.PromptTokens` | 来自模型返回的 usage 字段。 | | Output Tokens | `TokenUsage.CompletionTokens` | 来自模型返回的 usage 字段。 | | Total Tokens | `TokenUsage.TotalTokens` | 大多数厂商返回;未返回时自动求和。 | -| `userId` | `X-User-ID` / 租户 ID | 未登录时退化为 `tenant:`,方便按租户汇总消耗;enqueue 时会写入 payload,worker 在无上游 trace 的场景也能保留归属。 | +| `userId` | `X-User-ID` / 空间 ID | 未登录时退化为 `tenant:`,方便按空间汇总消耗;enqueue 时会写入 payload,worker 在无上游 trace 的场景也能保留归属。 | | `sessionId` | URL 中的 `:session_id`(或 `RequestID` 兜底) | 可以在 Langfuse 的 Sessions 视图聚合一整场对话,或按单次异步批次聚合。 | | Time-To-First-Token | 流式调用首条有效 chunk 的时间 | 通过 `generation-update.completionStartTime` 上报。 | diff --git a/docs/MCP功能使用说明.md b/docs/MCP功能使用说明.md index a4360486..82155f72 100644 --- a/docs/MCP功能使用说明.md +++ b/docs/MCP功能使用说明.md @@ -6,7 +6,7 @@ - 每个服务都包含名称、传输方式(SSE / HTTP Streamable / Stdio)、连接地址或命令、认证信息以及高级超时与重试策略。 ### 入口与界面 -- 打开控制台左侧菜单 `设置 -> MCP 服务`,即可看到当前租户下的所有 MCP 服务列表。 +- 打开控制台左侧菜单 `设置 -> MCP 服务`,即可看到当前空间下的所有 MCP 服务列表。 - 列表中可快速启停服务、查看描述,并通过右侧菜单执行“测试 / 编辑 / 删除”。 - “添加服务”按钮会弹出 `McpServiceDialog`,用于创建或修改服务。 diff --git a/docs/OIDC认证调用流程.md b/docs/OIDC认证调用流程.md index 4b7203ce..415a49fc 100644 --- a/docs/OIDC认证调用流程.md +++ b/docs/OIDC认证调用流程.md @@ -31,12 +31,12 @@ 2. **后端负责用授权码 `code` 向 OIDC Provider 换取 token**。 3. 后端拿到 OIDC 用户信息后,会: - 查找本地用户; - - 若用户不存在,则自动创建本地账号和默认租户; + - 若用户不存在,则自动创建本地账号和默认空间; - 最终签发 WeKnora 自己的本地 JWT(`token` / `refresh_token`)。 4. 后端不会直接把登录结果放在 query string 中,而是: - 将登录结果 JSON( `success`、`token`、`refresh_token` 等字段)序列化后再做 base64url 编码; - 以 `#oidc_result=...` 的形式重定向回前端; - - 前端在 `App.vue` 中统一解析 hash,再调用 `/api/v1/auth/me` 补全用户和租户信息。 + - 前端在 `App.vue` 中统一解析 hash,再调用 `/api/v1/auth/me` 补全用户和空间信息。 因此,**OIDC Provider 的 token 只用于后端换取用户身份,本项目真正的业务访问凭证仍然是 WeKnora 自己签发的 JWT**。 @@ -118,7 +118,7 @@ flowchart TD J --> K[向 OIDC token endpoint 换 token] K --> L[解析 id_token / 调用 userinfo] L --> M{本地用户是否存在} - M -- 否 --> N[自动注册新用户并创建默认租户] + M -- 否 --> N[自动注册新用户并创建默认空间] M -- 是 --> O[使用现有用户] N --> P[签发 WeKnora JWT] O --> P @@ -319,7 +319,7 @@ LoginWithOIDC(ctx, code, decodedState.RedirectURI, h.resolveDefaultTenantMode(ct 注意这里传入的是 **state 中保存的 redirect_uri**,而不是重新拼接的地址,这样保证了 code 交换时使用的 `redirect_uri` 和授权时完全一致。 -第四个参数是首次自动开户时的默认租户策略,由 `resolveDefaultTenantMode` 从 `auth.default_tenant_mode`(SystemSetting,DB > `WEKNORA_AUTH_DEFAULT_TENANT_MODE` > 配置文件)解析,与本地密码注册共用同一开关;OIDC 不再有独立的 `OIDC_AUTH_DEFAULT_TENANT_MODE`。 +第四个参数是首次自动开户时的默认空间策略,由 `resolveDefaultTenantMode` 从 `auth.default_tenant_mode`(SystemSetting,DB > `WEKNORA_AUTH_DEFAULT_TENANT_MODE` > 配置文件)解析,与本地密码注册共用同一开关;OIDC 不再有独立的 `OIDC_AUTH_DEFAULT_TENANT_MODE`。 --- @@ -397,7 +397,7 @@ userRepo.GetUserByEmail(ctx, userInfo.Email) 2. 若用户名冲突,则自动追加 `-1`、`-2` 等后缀; 3. 生成随机密码; 4. 调用现有 `Register()` 流程创建用户; -5. `Register()` 内部还会自动创建默认租户。 +5. `Register()` 内部还会自动创建默认空间。 因此,**首次使用 OIDC 登录的用户,不需要提前在 WeKnora 中手工建号**。 @@ -619,7 +619,7 @@ Provider 回调后端 `/auth/oidc/callback`,后端用 `code` 换 token、拉 - 后端再固定重定向到前端首页 `/` 3. **邮箱是本地账号关联主键**。 - 若 Provider 没返回 email,将无法完成登录。 -4. **首次 OIDC 登录会自动创建用户和默认租户**。 +4. **首次 OIDC 登录会自动创建用户和默认空间**。 5. **真正用于访问 WeKnora API 的仍是本地 JWT**,不是 OIDC access token。 6. 当前实现对 `state` 做了编码封装,但 **没有服务端持久化 state/nonce 校验**;它主要用于传递上下文和基本防错,而不是完整的防重放机制。 diff --git a/docs/QA.md b/docs/QA.md index da9a14a3..9d45faf2 100644 --- a/docs/QA.md +++ b/docs/QA.md @@ -205,12 +205,12 @@ Wiki 模式允许 Agent 根据原始文档自动生成并维护一套结构化 ## 11. 升级到 0.6.0 后,原本能做的操作变成了「权限不足」? -0.6.0 引入了租户内 RBAC(角色矩阵 + 资源归属),所有写入接口都会按角色 + `creator_id` 鉴权。常见现象: +0.6.0 引入了空间内 RBAC(角色矩阵 + 资源归属),所有写入接口都会按角色 + `creator_id` 鉴权。常见现象: - **看得到但点不动**:你大概率是该资源的 `Viewer` 或非创建者的 `Contributor`,UI 已经把写操作隐藏/置灰。检查 **用户菜单 → 当前工作区** 角色徽章。 -- **共享空间里的 KB / Agent**:他人共享给你的 KB 默认按 `Viewer` 看待;要写需要在源租户里被授予 `Admin+`。 -- **API Key 调用**:`X-API-Key` 合成虚拟用户固定为所属租户的 `Admin`(仅删除租户需 `Owner`),脚本一般无需迁移。 -- **跨租户超管**:要 `User.CanAccessAllTenants=true` 且 `enable_cross_tenant_access=true`,并通过 `X-Tenant-ID` 切租户。 +- **共享空间里的 KB / Agent**:他人共享给你的 KB 默认按 `Viewer` 看待;要写需要在源空间里被授予 `Admin+`。 +- **API Key 调用**:`X-API-Key` 合成虚拟用户固定为所属空间的 `Admin`(仅删除空间需 `Owner`),脚本一般无需迁移。 +- **跨空间超管**:要 `User.CanAccessAllTenants=true` 且 `enable_cross_tenant_access=true`,并通过 `X-Tenant-ID` 切空间。 如需临时回退到「仅审计、不拦截」灰度窗口,可在配置里设置 `tenant.enable_rbac=false`(或环境变量 `WEKNORA_TENANT_ENABLE_RBAC=false`)。完整的角色矩阵和归属链请见 [`docs/RBAC说明.md`](./RBAC说明.md)。 @@ -219,7 +219,7 @@ Wiki 模式允许 Agent 根据原始文档自动生成并维护一套结构化 升级到 0.6.0 后系统会记住「最后活跃工作区」并在登录后自动恢复。若仍未恢复,通常是: 1. 浏览器清理了 LocalStorage / 切换了浏览器; -2. 你最后访问的那个工作区已经把你移除(`/leave` 或被管理员剔除)— 系统会回退到默认租户; +2. 你最后访问的那个工作区已经把你移除(`/leave` 或被管理员剔除)— 系统会回退到默认空间; 3. JWT 中携带了 `tenant_id` 但已无效 — 退出重登录即可。 ## 13. 如何让多人协作时正确分配权限? @@ -229,9 +229,9 @@ Wiki 模式允许 Agent 根据原始文档自动生成并维护一套结构化 - 只读用户 → `Viewer` - 普通成员(上传文档、维护「自己」的 KB / Agent)→ `Contributor` - 运维人员(管理共享模型、向量库、解析器等基础设施)→ `Admin` -- 租户所有者(拥有删除租户权限,每租户唯一)→ `Owner` +- 空间所有者(拥有删除空间权限,每空间唯一)→ `Owner` -如果你希望开启「invite-only」(不允许自助注册到本租户),可在租户设置里打开邀请制,并通过「邀请」入口签发邀请码或链接。 +如果你希望开启「invite-only」(不允许自助注册到本空间),可在空间设置里打开邀请制,并通过「邀请」入口签发邀请码或链接。 ## 14. 文档解析卡在「处理中」/ 解析追踪时间线打不开怎么办? @@ -258,7 +258,7 @@ Wiki 模式允许 Agent 根据原始文档自动生成并维护一套结构化 ## 17. 系统管理员(System Admin)与平台设置怎么用? -0.6.1 引入了系统管理员与统一平台设置面板(含平台审计日志),与租户内 RBAC 区分:系统管理员管理的是「平台级」配置,而非单个租户内的资源。首次启用需通过系统管理员 bootstrap 流程晋升首个管理员;撤销管理员权限有安全防护(避免误撤导致无人可管)。相关迁移为 `000053_system_admin_and_settings`。 +0.6.1 引入了系统管理员与统一平台设置面板(含平台审计日志),与空间内 RBAC 区分:系统管理员管理的是「平台级」配置,而非单个空间内的资源。首次启用需通过系统管理员 bootstrap 流程晋升首个管理员;撤销管理员权限有安全防护(避免误撤导致无人可管)。相关迁移为 `000053_system_admin_and_settings`。 ## 18. 上传时如何自定义解析配置(process_config)? diff --git a/docs/RBAC说明.md b/docs/RBAC说明.md index 26b277a1..3aa24fd6 100644 --- a/docs/RBAC说明.md +++ b/docs/RBAC说明.md @@ -1,43 +1,43 @@ -# 租户 RBAC 说明 +# 空间 RBAC 说明 -本文档介绍 WeKnora **租户内权限控制(Tenant RBAC)** 的设计、角色矩阵、资源归属模型、配置方式,以及它与 [共享空间](./共享空间说明.md) 之间的关系。 +本文档介绍 WeKnora **空间内权限控制(Workspace RBAC)** 的设计、角色矩阵、资源归属模型、配置方式,以及它与 [共享空间](./共享空间说明.md) 之间的关系。 > 状态:已随 #1303 发布,由配置项 `tenant.enable_rbac` 控制,默认 `true`(强制鉴权)。可临时切到 `false` 进入「仅记录不拦截」的灰度窗口。 ## 一、为什么需要 RBAC -在 RBAC 引入之前,只要通过 `X-API-Key` 或 JWT 认证成功,调用方在租户内基本等同于管理员。这在单人自部署场景没问题,但只要一个租户里出现两个及以上的真人成员(团队共享一套知识库),就必须区分: +在 RBAC 引入之前,只要通过 `X-API-Key` 或 JWT 认证成功,调用方在空间内基本等同于管理员。这在单人自部署场景没问题,但只要一个空间里出现两个及以上的真人成员(团队共享一套知识库),就必须区分: - 谁可以删除知识库、撤销 API Key(管理员/Owner); - 谁可以上传文档、编辑「自己」的知识库(Contributor); - 谁只能读取与提问(Viewer)。 -RBAC 在原有 JWT / API Key 认证之上,叠加了一层**租户内角色矩阵**,使三种状态都成为一等公民。 +RBAC 在原有 JWT / API Key 认证之上,叠加了一层**空间内角色矩阵**,使三种状态都成为一等公民。 ## 二、角色矩阵 -每个租户成员(`tenant_members` 一行)拥有且仅拥有一个角色: +每个空间成员(`tenant_members` 一行)拥有且仅拥有一个角色: | 角色 | 标识 | 典型场景 | 关键能力 | |------|------|----------|----------| | 只读 | `viewer` | 只查阅、提问的成员 | 仅读,不可发起任何变更 | | 贡献者 | `contributor` | 上传文档、维护自己的 KB / Agent | 可变更 `creator_id == 自己` 的资源;他人资源等同 Viewer | -| 管理员 | `admin` | 租户内运维 | 可变更租户内任意资源;管理成员;配置共享基础设施(模型、解析器、存储、向量库等) | -| Owner | `owner` | 租户创建者 | Admin 的全部权限 + 可删除租户;不会被其他 Admin 降级;每个租户**有且只有一位** | +| 管理员 | `admin` | 空间内运维 | 可变更空间内任意资源;管理成员;配置共享基础设施(模型、解析器、存储、向量库等) | +| Owner | `owner` | 空间创建者 | Admin 的全部权限 + 可删除空间;不会被其他 Admin 降级;每个空间**有且只有一位** | 角色按 `viewer < contributor < admin < owner` 递增,高角色继承低角色权限。 ### 鉴权层的两个例外 -- **跨租户超管**:`User.CanAccessAllTenants=true` 且 `enable_cross_tenant_access=true` 时,通过 `X-Tenant-ID` 切换到目标租户后等同 Admin,不需要在目标租户里有 `tenant_members` 行。用于多租户运营方。 -- **API Key 调用**:`X-API-Key` 合成的虚拟用户在其所属租户内固定为 Admin(仅删除租户仍需 Owner)。脚本集成无需迁移。 -- **孤儿租户自愈**:若一个租户在 `tenant_members` 表里没有任何活跃成员(典型场景:仅 API Key 使用过该租户),首位通过认证的真人会被自动晋升为 Owner,避免锁死。 +- **跨空间超管**:`User.CanAccessAllTenants=true` 且 `enable_cross_tenant_access=true` 时,通过 `X-Tenant-ID` 切换到目标空间后等同 Admin,不需要在目标空间里有 `tenant_members` 行。用于多空间运营方。 +- **API Key 调用**:`X-API-Key` 合成的虚拟用户在其所属空间内固定为 Admin(仅删除空间仍需 Owner)。脚本集成无需迁移。 +- **孤儿空间自愈**:若一个空间在 `tenant_members` 表里没有任何活跃成员(典型场景:仅 API Key 使用过该空间),首位通过认证的真人会被自动晋升为 Owner,避免锁死。 ## 三、资源归属模型 光有角色矩阵不够,否则 Contributor 之间可以互相破坏。为此在迁移 `000043` 中给关键表加了 `creator_id`: -- `knowledge_bases.creator_id` —— 老数据回填为该租户的 Owner;空串/NULL 表示「租户共有,仅 Admin+ 可变更」。 +- `knowledge_bases.creator_id` —— 老数据回填为该空间的 Owner;空串/NULL 表示「空间共有,仅 Admin+ 可变更」。 - `custom_agents.creator_id` —— Agent 创建者。 - `custom_agents.runnable_by_viewer` —— 默认 `true`,允许 Viewer 在对话中调用该 Agent;置 `false` 则提升到 Contributor 起步。 @@ -51,34 +51,34 @@ FAQ 条目、生成的问题、KB 标签、Wiki 页面同理。 由此衍生出两类守卫: -- **角色守卫**:`Viewer()` / `Contributor()` / `Admin()` / `Owner()` —— 只看角色。用于租户级基础设施(模型、向量库、IM 通道等)。 +- **角色守卫**:`Viewer()` / `Contributor()` / `Admin()` / `Owner()` —— 只看角色。用于空间级基础设施(模型、向量库、IM 通道等)。 - **归属守卫**:`OwnedKBOrAdmin()` / `OwnedAgentOrAdmin()` / `OwnedChunkKBOrAdmin()` …… —— 「我是这条资源的 `creator_id`」**或**「我至少是 Admin」二者满足其一即可。用于具体资源的写操作。 这样可以让「Contributor 在自己的 KB 里像 Owner,在别人的 KB 里像 Viewer」自然成立。 ## 四、与共享空间的关系(重点) -[共享空间](./共享空间说明.md)(Organization)和租户 RBAC 解决的是**不同维度**的问题,必须同时满足才能完成一次跨租户操作: +[共享空间](./共享空间说明.md)(Organization)和空间 RBAC 解决的是**不同维度**的问题,必须同时满足才能完成一次跨空间操作: | 维度 | 解决什么 | 主键模型 | 角色集合 | |------|---------|---------|---------| -| **租户 RBAC** | 同一租户内「你能对自己 / 别人 / 共享基础设施做什么」 | `tenant_members(user_id, tenant_id, role)` | viewer / contributor / admin / owner | -| **共享空间** | 跨租户「把我的 KB / Agent 让别的租户的人也用」 | `organization_members(user_id, org_id, role)` + 共享关系表 | 管理员 / 编辑者 / 只读 | +| **空间 RBAC** | 同一空间内「你能对自己 / 别人 / 共享基础设施做什么」 | `tenant_members(user_id, tenant_id, role)` | viewer / contributor / admin / owner | +| **共享空间** | 跨空间「把我的 KB / Agent 让别的空间的人也用」 | `organization_members(user_id, org_id, role)` + 共享关系表 | 管理员 / 编辑者 / 只读 | 两者**正交**: - 共享空间不持有任何 KB 或 Agent,它只是「某 KB 以某权限被共享到某空间」的关系记录。 -- 资源始终归属一个租户,归属与 `creator_id` 都不会因为共享而改变。 +- 资源始终归属一个空间,归属与 `creator_id` 都不会因为共享而改变。 - 一次对**他人共享给你**的 KB 的写操作,需要同时满足: 1. **共享一侧**:该 KB 被以「可写」权限共享到了你和发起方都在的共享空间; 2. **空间角色一侧**:你在该共享空间内不是「只读」(即至少是编辑者); - 3. **租户 RBAC 一侧**:你的访问通过共享路径解析为对源租户的「以共享空间身份」访问,仍要经过源租户的 RBAC 检查。具体地,访问检查会在确认 `kb.tenant_id == 你的当前租户` 不成立后,回落到共享路径校验。 + 3. **空间 RBAC 一侧**:你的访问通过共享路径解析为对源空间的「以共享空间身份」访问,仍要经过源空间的 RBAC 检查。具体地,访问检查会在确认 `kb.tenant_id == 你的当前空间` 不成立后,回落到共享路径校验。 简化的判定顺序(见 `internal/middleware/kb_access.go`): ```text ┌────────────────────────┐ -│ KB 属于我当前租户? │ ──是──► 进入租户 RBAC: +│ KB 属于我当前空间? │ ──是──► 进入空间 RBAC: └──────┬─────────────────┘ 角色 + creator_id 决定能否写 否 ▼ @@ -96,11 +96,11 @@ FAQ 条目、生成的问题、KB 标签、Wiki 页面同理。 要点整理: -- **共享空间不会绕过租户 RBAC**:若一个 KB 在源租户里被标记为「仅 Admin+ 可写」(例如 `creator_id` 为空的租户共有 KB),即使共享时给了「可写」权限,外租户成员也只能读取——因为没人能跨租户成为源租户的 Admin。 -- **API Key 跨空间访问**:API Key 在所属租户内是 Admin,但**不会**因此自动获得对其他租户通过共享空间共享过来的 KB 的写权限——共享空间使用的是 `organization_members.role`,与 API Key 无关。 -- **审计也是分开的**:租户内角色变更写入 `audit_logs`(`rbac.member_*` 动作),共享空间内的成员、共享关系变更由共享空间自身的接口记录。 +- **共享空间不会绕过空间 RBAC**:若一个 KB 在源空间里被标记为「仅 Admin+ 可写」(例如 `creator_id` 为空的空间共有 KB),即使共享时给了「可写」权限,外空间成员也只能读取——因为没人能跨空间成为源空间的 Admin。 +- **API Key 跨空间访问**:API Key 在所属空间内是 Admin,但**不会**因此自动获得对其他空间通过共享空间共享过来的 KB 的写权限——共享空间使用的是 `organization_members.role`,与 API Key 无关。 +- **审计也是分开的**:空间内角色变更写入 `audit_logs`(`rbac.member_*` 动作),共享空间内的成员、共享关系变更由共享空间自身的接口记录。 -一句话总结:**租户 RBAC 是「纵向」的纵深防御,共享空间是「横向」的协作通道;任何跨租户的有写副作用的操作,都要同时穿过这两道闸口。** +一句话总结:**空间 RBAC 是「纵向」的纵深防御,共享空间是「横向」的协作通道;任何跨空间的有写副作用的操作,都要同时穿过这两道闸口。** ## 五、配置 @@ -110,11 +110,11 @@ FAQ 条目、生成的问题、KB 标签、Wiki 页面同理。 tenant: # 默认 true,强制鉴权。改为 false 进入「仅记录不拦截」灰度窗口 enable_rbac: true - # 跨租户超管开关,默认 false + # 跨空间超管开关,默认 false enable_cross_tenant_access: false auth: - # self_serve(默认):任何人都可注册,自动建租户 + Owner 成员 + # self_serve(默认):任何人都可注册,自动建空间 + Owner 成员 # invite_only :禁止公开注册,新用户必须通过 /tenants/:id/members 邀请进入 registration_mode: self_serve @@ -154,9 +154,9 @@ audit: 无论是自部署运维还是上游仓库本身,从「仅记录」切到「强制鉴权」都建议走以下流程: -1. **升级**:若想保留观察窗口,升级前先设置 `tenant.enable_rbac=false`(或环境变量)。否则默认就是强制鉴权——schema 落地、`tenant_members` 自动回填(每租户一个 Owner,其余 Contributor)、所有 KB 自动写入 `creator_id`。 +1. **升级**:若想保留观察窗口,升级前先设置 `tenant.enable_rbac=false`(或环境变量)。否则默认就是强制鉴权——schema 落地、`tenant_members` 自动回填(每空间一个 Owner,其余 Contributor)、所有 KB 自动写入 `creator_id`。 2. **核对成员**:调用 `GET /api/v1/tenants/:id/members` 确认: - - 每个租户都只有一位 Owner; + - 每个空间都只有一位 Owner; - Contributor / Viewer 划分符合预期; - 通过 `PUT /api/v1/tenants/:id/members/:user_id` / `DELETE` 调整。每次调整都会写入 `audit_logs`。 3. **观察日志**:抓取应用日志里的 `[rbac] role insufficient (logged but not enforced) ...`,这些就是切换到强制鉴权后会变成 403 的请求。逐条修正成员角色或客户端身份。 @@ -203,7 +203,7 @@ Pinia 中的 `authStore` 暴露: 自助创建工作区
创建新空间 -
任何用户都可以自助创建租户,创建后自动成为新空间的 Owner(受 WEKNORA_TENANT_MAX_PER_USER 上限保护)。 +
任何用户都可以自助创建空间,创建后自动成为新空间的 Owner(受 WEKNORA_TENANT_MAX_PER_USER 上限保护)。 @@ -219,21 +219,21 @@ Pinia 中的 `authStore` 暴露: ### 升级后所有人都变成了 Contributor,找不到 Admin? -回填逻辑选「每个租户里最早活跃的用户」作为 Owner,其余人统一变成 Contributor。如果创建租户的账号其实是一个机器人 / 共用账号,可能需要先用 `PUT /api/v1/tenants/:id/members/:user_id` 把机器人降级、把真人 Admin 提升。 +回填逻辑选「每个空间里最早活跃的用户」作为 Owner,其余人统一变成 Contributor。如果创建空间的账号其实是一个机器人 / 共用账号,可能需要先用 `PUT /api/v1/tenants/:id/members/:user_id` 把机器人降级、把真人 Admin 提升。 ### 切到强制鉴权后某个脚本开始 403? 大概率脚本的 JWT 对应的成员是 Viewer / Contributor 而非 Admin。两种解法: - 通过 `tenant_members` 把对应用户升级到 Admin; -- 或者把脚本切到 `X-API-Key` 调用 —— API Key 在所属租户内固定 Admin。 +- 或者把脚本切到 `X-API-Key` 调用 —— API Key 在所属空间内固定 Admin。 ### 共享空间里的成员为什么读不到我「以可写共享」过去的 KB? 请按第四节的判定顺序排查: -- KB 是否真的属于源租户、`tenant_id` 配置是否正确; +- KB 是否真的属于源空间、`tenant_id` 配置是否正确; - 该共享关系当前是否还存在(未被取消); - 调用方在共享空间里是不是 Viewer; -- 若 KB 的 `creator_id` 在源租户内为空且共享权限要求写,源租户的 RBAC 仍会要求 Admin+,导致跨租户写无法成立。 +- 若 KB 的 `creator_id` 在源空间内为空且共享权限要求写,源空间的 RBAC 仍会要求 Admin+,导致跨空间写无法成立。 ### 审计日志怎么有些 403 没记录? @@ -252,6 +252,6 @@ v1 不支持。这个矩阵刻意保持成一个小固定格(Viewer < Contribu ## 相关文档 -- 跨租户协作:[`共享空间说明.md`](./共享空间说明.md) -- 多租户认证背景:[`OIDC认证调用流程.md`](./OIDC认证调用流程.md) +- 跨空间协作:[`共享空间说明.md`](./共享空间说明.md) +- 多空间认证背景:[`OIDC认证调用流程.md`](./OIDC认证调用流程.md) - 配置项与环境变量:[`.env.example`](../.env.example) diff --git a/docs/api/README.md b/docs/api/README.md index ae3fb260..09e49911 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -69,7 +69,7 @@ WeKnora API 按功能分为以下几类: | 分类 | 描述 | 文档链接 | |------|------|----------| | 认证管理 | 用户注册、登录、令牌管理;OIDC 流程 | [auth.md](./auth.md) · [OIDC认证调用流程.md](../OIDC认证调用流程.md) | -| 租户管理 | 创建和管理租户账户 | [tenant.md](./tenant.md) | +| 空间管理 | 创建和管理空间账户 | [tenant.md](./tenant.md) | | 知识库管理 | 创建、查询和管理知识库 | [knowledge-base.md](./knowledge-base.md) | | 知识管理 | 上传、检索和管理知识内容 | [knowledge.md](./knowledge.md) | | 模型管理 | 配置和管理各种AI模型 | [model.md](./model.md) | diff --git a/docs/api/agent.md b/docs/api/agent.md index c0626e39..4463a427 100644 --- a/docs/api/agent.md +++ b/docs/api/agent.md @@ -111,7 +111,7 @@ curl --location 'http://localhost:8080/api/v1/agents' \ ## GET `/agents` - 获取智能体列表 -获取当前租户的所有智能体,包括内置智能体和自定义智能体。响应中额外返回 `disabled_own_agent_ids`,指示当前租户在前端对话下拉框中主动隐藏的本租户自有智能体 ID 列表(不影响其他租户)。 +获取当前空间的所有智能体,包括内置智能体和自定义智能体。响应中额外返回 `disabled_own_agent_ids`,指示当前空间在前端对话下拉框中主动隐藏的本空间自有智能体 ID 列表(不影响其他空间)。 **请求**: @@ -164,7 +164,7 @@ curl --location 'http://localhost:8080/api/v1/agents' \ | 状态码 | 错误码 | 错误 | 说明 | | ------ | ------ | --------------------- | ------------------ | -| 401 | 1001 | Unauthorized | 缺少租户上下文 | +| 401 | 1001 | Unauthorized | 缺少空间上下文 | | 500 | 1007 | Internal Server Error | 服务器内部错误 | --- @@ -470,7 +470,7 @@ curl --location 'http://localhost:8080/api/v1/agents/placeholders' \ |------|------|--------|------| | `web_search_enabled` | bool | true | 是否启用网络搜索 | | `web_search_max_results` | int | 5 | 网络搜索最大结果数 | -| `web_search_provider_id` | string | - | 网络搜索提供者 ID,为空使用租户默认提供者 | +| `web_search_provider_id` | string | - | 网络搜索提供者 ID,为空使用空间默认提供者 | | `web_fetch_enabled` | bool | false | 是否自动获取重排后的搜索结果页面全文 | | `web_fetch_top_n` | int | 3 | 重排后获取全文的最大页面数 | @@ -548,6 +548,6 @@ curl --location 'http://localhost:8080/api/v1/agent-chat/session-123' \ ## 相关文档 -- 智能体的组织共享、跨租户分发与禁用(`/agents/:id/shares`、`/shared-agents` 等):见 [组织管理 API](./organization.md) +- 智能体的组织共享、跨空间分发与禁用(`/agents/:id/shares`、`/shared-agents` 等):见 [组织管理 API](./organization.md) - 智能体绑定 IM 渠道(`/agents/:id/im-channels`):见组织/IM 渠道相关文档 - 网络搜索提供者配置(被 `web_search_provider_id` 引用):见 [Web Search API](./web-search.md) diff --git a/docs/api/chat.md b/docs/api/chat.md index bbb9dae0..8347483b 100644 --- a/docs/api/chat.md +++ b/docs/api/chat.md @@ -84,7 +84,7 @@ Agent 模式支持更智能的问答,包括工具调用、网络搜索、多 ## 回答后推荐问题 -回答主消息完成后,服务端会异步生成推荐问题,不阻塞 SSE 的 `complete`/`done` 事件。生成结果按“租户、助手消息、位置、配置快照、语言”持久化并去重。 +回答主消息完成后,服务端会异步生成推荐问题,不阻塞 SSE 的 `complete`/`done` 事件。生成结果按“空间、助手消息、位置、配置快照、语言”持久化并去重。 ```http POST /api/v1/sessions/{session_id}/messages/{message_id}/suggestions diff --git a/docs/api/knowledge-base.md b/docs/api/knowledge-base.md index fc79e088..302679f9 100644 --- a/docs/api/knowledge-base.md +++ b/docs/api/knowledge-base.md @@ -6,9 +6,9 @@ - 知识库类型 `type` 为 `document`(文档)或 `faq`(FAQ),默认 `document`。 - JSON 中对象存储相关字段:**`storage_config`** 为序列化字段名(对应数据库列 `cos_config`,兼容旧数据)。旧客户端若仍发送或接收 `cos_config`,服务端会兼容解析;新集成请使用 **`storage_config`**。 -- **`storage_provider_config`** 为新版存储提供者选择(如 `{"provider": "local"}`),与租户级存储引擎凭证配合使用;无配置时可为 `null`。 +- **`storage_provider_config`** 为新版存储提供者选择(如 `{"provider": "local"}`),与空间级存储引擎凭证配合使用;无配置时可为 `null`。 - 嵌套配置对象:`chunking_config`、`image_processing_config`、`vlm_config`、`asr_config`、`extract_config`、`faq_config`、`question_generation_config`。其中 `extract_config`、`faq_config`、`question_generation_config` 允许为 `null`。 -- **`vector_store_id`** 为知识库绑定的向量存储 ID(参见 [vector-store.md](./vector-store.md))。未指定(或 `null`/`""`)时使用租户级默认的环境变量存储;一旦创建即不可修改。详情接口返回时会附带 `vector_store_name` / `vector_store_source` / `vector_store_engine_type` / `vector_store_status` 四个只读元数据字段,用于前端展示。 +- **`vector_store_id`** 为知识库绑定的向量存储 ID(参见 [vector-store.md](./vector-store.md))。未指定(或 `null`/`""`)时使用空间级默认的环境变量存储;一旦创建即不可修改。详情接口返回时会附带 `vector_store_name` / `vector_store_source` / `vector_store_engine_type` / `vector_store_status` 四个只读元数据字段,用于前端展示。 | 方法 | 路径 | 描述 | | ------ | ----------------------------------------- | ------------------------ | @@ -46,7 +46,7 @@ | extract_config | object | 否 | 图谱抽取配置;`enabled=true` 时需提供 `text`/`tags`/`nodes`/`relations` | | faq_config | object | 否 | FAQ 配置(仅 FAQ 类型知识库需要) | | question_generation_config | object | 否 | 问题生成配置 | -| vector_store_id | string | 否 | 绑定的向量存储 ID。不传或为空字符串等同于 `null`(使用环境变量默认存储)。指定时必须是调用者所在租户拥有的向量存储 UUID;创建后不可修改。无效 UUID / 跨租户 / 未注册到引擎的 ID 会返回 `400` | +| vector_store_id | string | 否 | 绑定的向量存储 ID。不传或为空字符串等同于 `null`(使用环境变量默认存储)。指定时必须是调用者所在空间拥有的向量存储 UUID;创建后不可修改。无效 UUID / 跨空间 / 未注册到引擎的 ID 会返回 `400` | **请求**: @@ -193,8 +193,8 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases' \ | 字段 | 类型 | 说明 | | -------------------------- | ------ | ---------------------------------------------------------------------------------------------------------- | | `vector_store_id` | string | 绑定的向量存储 ID(创建时未指定时为 `null`,从响应中省略) | -| `vector_store_name` | string | 绑定存储的展示名。未绑定时返回 `"System default"`;跨租户共享 KB 视图中被隐藏 | -| `vector_store_source` | string | `"user"`(DB 中创建的存储)/ `"env"`(环境变量虚拟存储)/ `"shared"`(跨租户共享 KB)/ `"unavailable"`(绑定的存储已不可解析) | +| `vector_store_name` | string | 绑定存储的展示名。未绑定时返回 `"System default"`;跨空间共享 KB 视图中被隐藏 | +| `vector_store_source` | string | `"user"`(DB 中创建的存储)/ `"env"`(环境变量虚拟存储)/ `"shared"`(跨空间共享 KB)/ `"unavailable"`(绑定的存储已不可解析) | | `vector_store_engine_type` | string | 引擎类型(`elasticsearch` / `qdrant` / `milvus` 等)。`shared` / `unavailable` 时为空 | | `vector_store_status` | string | `"available"` / `"unavailable"`。`unavailable` 表示绑定的存储已被删除或不在内存注册表中,UI 可据此提示用户重新绑定 | @@ -202,12 +202,12 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases' \ | HTTP | code | 说明 | | ---- | ---- | ----------------------------------------------------------------- | -| 400 | 2200 | `vector_store_id` 无效:格式错误、不存在或属于其他租户(统一返回,避免枚举泄漏) | +| 400 | 2200 | `vector_store_id` 无效:格式错误、不存在或属于其他空间(统一返回,避免枚举泄漏) | | 400 | 2201 | 指定的向量存储当前不可用:存在于数据库但未注册到引擎注册表,请检查 connection_config | ## GET `/knowledge-bases` - 获取知识库列表 -返回当前租户拥有的全部知识库。当传入 `agent_id` 时,校验调用者对该共享智能体的访问权限后,返回该智能体配置可见的知识库范围(用于 `@` 提及)。 +返回当前空间拥有的全部知识库。当传入 `agent_id` 时,校验调用者对该共享智能体的访问权限后,返回该智能体配置可见的知识库范围(用于 `@` 提及)。 **Query 参数**: @@ -251,7 +251,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/kb-00000001' \ --header 'X-API-Key: sk-xxxxx' ``` -**响应**: 字段结构同 `POST /knowledge-bases` 响应(包含 Phase 2 的 `vector_store_*` 元数据字段),并附 `is_pinned` / `pinned_at` / `knowledge_count` / `chunk_count` / `processing_count` 状态字段。通过共享智能体访问时还会附加 `my_permission`;同时 `vector_store_name` / `vector_store_engine_type` 会被隐藏(`vector_store_source` 返回 `"shared"`),避免跨租户泄漏存储展示名。 +**响应**: 字段结构同 `POST /knowledge-bases` 响应(包含 Phase 2 的 `vector_store_*` 元数据字段),并附 `is_pinned` / `pinned_at` / `knowledge_count` / `chunk_count` / `processing_count` 状态字段。通过共享智能体访问时还会附加 `my_permission`;同时 `vector_store_name` / `vector_store_engine_type` 会被隐藏(`vector_store_source` 返回 `"shared"`),避免跨空间泄漏存储展示名。 ## PUT `/knowledge-bases/:id` - 更新知识库 @@ -315,7 +315,7 @@ curl --location --request PUT 'http://localhost:8080/api/v1/knowledge-bases/b582 ## DELETE `/knowledge-bases/:id` - 删除知识库 -仅知识库 owner(与 owning tenant 匹配的 admin)可调用,删除将级联清理知识库下所有知识与切片。 +仅知识库 owner(与所属空间匹配的 admin)可调用,删除将级联清理知识库下所有知识与切片。 **路径参数**: @@ -431,7 +431,7 @@ curl --location --request POST 'http://localhost:8080/api/v1/knowledge-bases/kb- 异步拷贝整个知识库(配置 + 全部知识内容)。请求会被入队到 Asynq 后台任务(队列 `default`,最多重试 3 次),并立即返回 `task_id` 供轮询进度。 -**约束**:源知识库 `source_id` 必须属于调用者所在租户;若指定 `target_id`,目标知识库同样必须属于调用者租户,否则返回 `403 Forbidden`。 +**约束**:源知识库 `source_id` 必须属于调用者所在空间;若指定 `target_id`,目标知识库同样必须属于调用者空间,否则返回 `403 Forbidden`。 **Phase 2 同步预检(当 `target_id` 非空时)**: @@ -446,9 +446,9 @@ curl --location --request POST 'http://localhost:8080/api/v1/knowledge-bases/kb- | 字段 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | ------------------------------------------------------------- | -| source_id | string | 是 | 源知识库 ID(必须属于当前租户) | -| target_id | string | 否 | 目标知识库 ID(若复用已存在知识库;同样必须属于当前租户) | -| task_id | string | 否 | 自定义任务 ID;不传则由服务端生成(基于租户、源 ID、时间戳) | +| source_id | string | 是 | 源知识库 ID(必须属于当前空间) | +| target_id | string | 否 | 目标知识库 ID(若复用已存在知识库;同样必须属于当前空间) | +| task_id | string | 否 | 自定义任务 ID;不传则由服务端生成(基于空间、源 ID、时间戳) | **请求**: @@ -542,7 +542,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/copy/progress/kb_c | 复制内容 | 仅设置 | 设置 + 全部知识内容 | | 新 KB ID | 服务端自动生成 UUID | 可指定已有目标库或新建 | -**权限**:需要 `Contributor+`,且对源知识库至少有 `Viewer` 读权限(路由层 `KBAccessRead`)。源知识库必须属于调用者所在租户,否则返回 `403 Forbidden`。 +**权限**:需要 `Contributor+`,且对源知识库至少有 `Viewer` 读权限(路由层 `KBAccessRead`)。源知识库必须属于调用者所在空间,否则返回 `403 Forbidden`。 **命名规则**:新 KB 名称在源名称后追加本地化后缀(依据 `Accept-Language` 或 `WEKNORA_LANGUAGE`),例如中文 `原名 副本`、英文 `Original Name Copy`;若同名已存在则递增为 `原名 副本 2`、`Original Name Copy 2` 等。 @@ -598,7 +598,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/kb-00000001/duplic | 场景 | HTTP | 说明 | | -------------------- | ---- | ---- | | 源知识库不存在 | 404 | `Source knowledge base not found` | -| 源库属于其他租户 | 403 | `No permission to duplicate this knowledge base` | +| 源库属于其他空间 | 403 | `No permission to duplicate this knowledge base` | | 向量存储绑定无效 | 400 | 源库绑定的 vector store 不可用 | ## GET `/knowledge-bases/:id/move-targets` - 获取可迁移目标知识库列表 @@ -609,7 +609,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/kb-00000001/duplic - 与源知识库 `embedding_model_id` 相同 - 非临时知识库(`is_temporary = false`) - 不包含源知识库自身 -- 仅同租户的知识库 +- 仅同空间的知识库 **路径参数**: diff --git a/docs/api/knowledge.md b/docs/api/knowledge.md index 44d1251c..065a9164 100644 --- a/docs/api/knowledge.md +++ b/docs/api/knowledge.md @@ -29,7 +29,7 @@ > **公共说明**: > - 路径中的 `:id`(知识库路径下)为**知识库 ID**,`/knowledge/:id` 中的 `:id` 为**知识 ID**。 -> - 所有写操作(创建、更新、删除、迁移、重新解析、取消解析)需要当前用户在知识库所属组织内具有 `editor` 或 `admin` 权限;清空知识库内容仅 KB **所有者**(admin 且租户匹配)可操作。 +> - 所有写操作(创建、更新、删除、迁移、重新解析、取消解析)需要当前用户在知识库所属组织内具有 `editor` 或 `admin` 权限;清空知识库内容仅 KB **所有者**(admin 且空间匹配)可操作。 > - 关键状态字段:`parse_status` 取值 `pending` / `processing` / `finalizing` / `completed` / `failed` / `cancelled`;`enable_status` 取值 `enabled` / `disabled`。 > - `processing` 指 DocReader / 分块 / 向量化阶段;`finalizing` 指主解析已完成、仍在执行摘要 / 问题生成 / 图谱抽取等索引优化任务;只有当全部子任务到达终态后才进入 `completed`。 > - `cancelled` 表示解析被用户主动取消,可通过 `reparse` 重新触发。`pending` / `processing` / `finalizing` 这三种状态都可通过 `cancel-parse` 终止。 @@ -325,7 +325,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge-bases/kb-00000001/knowle ## DELETE `/knowledge-bases/:id/knowledge` - 清空知识库下的所有知识 -异步提交"清空任务",删除该知识库下的全部知识条目;知识库本身保留。**仅 KB 所有者(admin 且租户匹配)可操作**。 +异步提交"清空任务",删除该知识库下的全部知识条目;知识库本身保留。**仅 KB 所有者(admin 且空间匹配)可操作**。 **请求**: @@ -363,8 +363,8 @@ curl --location --request DELETE 'http://localhost:8080/api/v1/knowledge-bases/k | 字段 | 类型 | 必填 | 说明 | | ----------- | -------- | ---- | --------------------------------------------------------------------- | | `ids` | string[] | 是 | 知识 ID,重复 `ids=...` 传多个 | -| `kb_id` | string | 否 | 限定知识库范围;共享知识库场景下用于按 KB 校验权限并解析有效租户 | -| `agent_id` | string | 否 | 共享 Agent ID;按 Agent 所属租户拉取,常用于共享场景刷新后的文件回填 | +| `kb_id` | string | 否 | 限定知识库范围;共享知识库场景下用于按 KB 校验权限并解析有效空间 | +| `agent_id` | string | 否 | 共享 Agent ID;按 Agent 所属空间拉取,常用于共享场景刷新后的文件回填 | **请求**: @@ -729,7 +729,7 @@ curl --location --request PUT 'http://localhost:8080/api/v1/knowledge/tags' \ ## GET `/knowledge/search` - 跨知识库搜索/过滤知识 -按关键词在当前租户(含已共享给当前租户)的知识中检索;可按文件类型过滤;指定 `agent_id` 时按共享 Agent 所配置的知识库范围检索。 +按关键词在当前空间(含已共享给当前空间)的知识中检索;可按文件类型过滤;指定 `agent_id` 时按共享 Agent 所配置的知识库范围检索。 **查询参数**: @@ -827,7 +827,7 @@ curl --location 'http://localhost:8080/api/v1/knowledge/batch-delete' \ 将一条或多条**处于 `completed` 状态**的知识从源 KB 迁到目标 KB(异步)。约束: -- 源/目标 KB 必须属于当前租户; +- 源/目标 KB 必须属于当前空间; - 源/目标必须为同一 KB 类型且**使用相同的 Embedding 模型**; - 源 KB ≠ 目标 KB; - 仅 `parse_status=completed` 的知识可迁移。 diff --git a/docs/api/mcp-service.md b/docs/api/mcp-service.md index 6102ab88..27f56f18 100644 --- a/docs/api/mcp-service.md +++ b/docs/api/mcp-service.md @@ -7,7 +7,7 @@ MCP(Model Context Protocol)服务管理接口,提供 MCP 服务的 CRUD、 | 方法 | 路径 | 描述 | | ------ | ------------------------------------------------- | --------------------------------------------- | | POST | `/mcp-services` | 创建 MCP 服务 | -| GET | `/mcp-services` | 获取当前租户的 MCP 服务列表 | +| GET | `/mcp-services` | 获取当前空间的 MCP 服务列表 | | GET | `/mcp-services/:id` | 获取 MCP 服务详情 | | PUT | `/mcp-services/:id` | 更新 MCP 服务(部分字段更新) | | DELETE | `/mcp-services/:id` | 删除 MCP 服务 | @@ -113,7 +113,7 @@ curl --location 'http://localhost:8080/api/v1/mcp-services' \ ## GET `/mcp-services` - 获取 MCP 服务列表 -返回当前租户已配置的所有 MCP 服务。 +返回当前空间已配置的所有 MCP 服务。 **请求**: @@ -497,7 +497,7 @@ curl --location --request PUT 'http://localhost:8080/api/v1/mcp-services/mcp-000 用于 Agent 在执行过程中阻塞等待人工审批的场景:当 Agent 命中一个 `require_approval = true` 的工具时会生成一条 `pending_id`,前端拿到这个 ID 后调用此接口将审批结果回传给 Agent,Agent 才会继续执行(或终止)。 -**鉴权要求**:请求上下文中必须有已认证用户(`user_id`),且该用户必须是当前 pending 会话的所有者;租户与用户两层都会做 fail-close 校验。 +**鉴权要求**:请求上下文中必须有已认证用户(`user_id`),且该用户必须是当前 pending 会话的所有者;空间与用户两层都会做 fail-close 校验。 **路径参数**: @@ -552,6 +552,6 @@ curl --location --request POST 'http://localhost:8080/api/v1/agent/tool-approval | HTTP | 触发条件 | | ---- | --------------------------------------------------------------------------------------- | -| 400 | `decision` 不是 `approve`/`reject`;或 `modified_args` 是 `null`/非对象;或租户/用户错配 | +| 400 | `decision` 不是 `approve`/`reject`;或 `modified_args` 是 `null`/非对象;或空间/用户错配 | | 401 | 上下文缺失认证用户(中间件未注入 `user_id`) | | 404 | `pending_id` 不存在或已完成(超时/取消已先一步消费) | diff --git a/docs/api/message.md b/docs/api/message.md index 5d897186..3e317134 100644 --- a/docs/api/message.md +++ b/docs/api/message.md @@ -239,7 +239,7 @@ curl --location 'http://localhost:8080/api/v1/messages/search' \ ## GET `/messages/chat-history-stats` - 获取聊天历史知识库统计 -获取当前租户的聊天历史知识库索引统计信息。 +获取当前空间的聊天历史知识库索引统计信息。 **请求**: diff --git a/docs/api/model.md b/docs/api/model.md index 7ab7a760..c7b2486b 100644 --- a/docs/api/model.md +++ b/docs/api/model.md @@ -2,7 +2,7 @@ [返回目录](./README.md) -模型管理接口用于维护当前租户下可用的 LLM / Embedding / Rerank / VLLM / ASR 模型配置。 +模型管理接口用于维护当前空间下可用的 LLM / Embedding / Rerank / VLLM / ASR 模型配置。 | 方法 | 路径 | 描述 | | ------ | ------------------- | --------------------- | @@ -46,7 +46,7 @@ WeKnora 支持多种主流 AI 模型服务商,在创建模型时可通过 `par ## GET `/models/providers` - 获取模型服务商列表 -根据模型类型获取支持的服务商列表及配置信息(系统级元数据,与租户无关)。 +根据模型类型获取支持的服务商列表及配置信息(系统级元数据,与空间无关)。 **查询参数**: @@ -100,7 +100,7 @@ curl --location 'http://localhost:8080/api/v1/models/providers?model_type=embedd ## POST `/models` - 创建模型 -为当前租户创建一个新的模型配置。 +为当前空间创建一个新的模型配置。 **参数说明(请求体)**: @@ -314,7 +314,7 @@ curl --location 'http://localhost:8080/api/v1/models' \ ## GET `/models` - 获取模型列表 -返回当前租户下的所有模型。内置模型(`is_builtin = true`)的 `base_url` 与 `api_key` 会被清空以隐藏敏感信息。 +返回当前空间下的所有模型。内置模型(`is_builtin = true`)的 `base_url` 与 `api_key` 会被清空以隐藏敏感信息。 **请求**: diff --git a/docs/api/organization.md b/docs/api/organization.md index e4263584..d654a9fb 100644 --- a/docs/api/organization.md +++ b/docs/api/organization.md @@ -2,7 +2,7 @@ [返回目录](./README.md) -组织(Organization,又称"空间")是 WeKnora 的多租户协作单元。一个用户可以创建/加入多个组织,并以 owner / admin / editor / viewer 的角色参与;知识库与智能体可以共享到组织内,组织成员根据角色获得相应的访问权限。 +组织(Organization,又称"空间")是 WeKnora 的多空间协作单元。一个用户可以创建/加入多个组织,并以 owner / admin / editor / viewer 的角色参与;知识库与智能体可以共享到组织内,组织成员根据角色获得相应的访问权限。 本页文档覆盖以下六类接口: @@ -1183,7 +1183,7 @@ curl --location 'http://localhost:8080/api/v1/shared-knowledge-bases' \ ### GET `/shared-agents` - 获取共享给我的智能体(跨组织) -返回当前用户通过所有组织共享获得的智能体列表,供"全部智能体"视图使用。`disabled_by_me: true` 表示当前租户已在对话下拉中隐藏该智能体。 +返回当前用户通过所有组织共享获得的智能体列表,供"全部智能体"视图使用。`disabled_by_me: true` 表示当前空间已在对话下拉中隐藏该智能体。 **请求**: diff --git a/docs/api/session.md b/docs/api/session.md index 86f871d2..e95a6ff2 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -9,7 +9,7 @@ | POST | `/sessions` | 创建会话 | | DELETE | `/sessions/batch` | 批量删除会话 | | GET | `/sessions/:id` | 获取会话详情 | -| GET | `/sessions` | 获取当前租户的会话列表 | +| GET | `/sessions` | 获取当前空间的会话列表 | | PUT | `/sessions/:id` | 更新会话 | | DELETE | `/sessions/:id` | 删除会话 | | DELETE | `/sessions/:id/messages` | 清空会话消息 | @@ -61,11 +61,11 @@ curl --location 'http://localhost:8080/api/v1/sessions' \ } ``` -> 通过 API-Key 调用时 `user_id` 可能为空,此时会话以租户级可见。 +> 通过 API-Key 调用时 `user_id` 可能为空,此时会话以空间级可见。 ## DELETE `/sessions/batch` - 批量删除会话 -支持两种模式:按 ID 列表批量删除,或删除当前租户的所有会话。 +支持两种模式:按 ID 列表批量删除,或删除当前空间的所有会话。 **请求 - 按 ID 列表删除**: @@ -97,7 +97,7 @@ curl --location --request DELETE 'http://localhost:8080/api/v1/sessions/batch' \ | 字段 | 类型 | 必填 | 描述 | | ------------ | -------- | ---- | ---------------------------------------------------------- | | `ids` | string[] | 否 | 要删除的会话 ID 列表(`delete_all` 为 `false` 时必填) | -| `delete_all` | bool | 否 | 设为 `true` 时删除当前租户的所有会话,忽略 `ids` 字段 | +| `delete_all` | bool | 否 | 设为 `true` 时删除当前空间的所有会话,忽略 `ids` 字段 | **响应**: @@ -148,9 +148,9 @@ curl --location 'http://localhost:8080/api/v1/sessions/ceb9babb-1e30-41d7-817d-f 会话不存在时返回 `404`。 -## GET `/sessions` - 获取当前租户的会话列表 +## GET `/sessions` - 获取当前空间的会话列表 -获取当前租户的会话列表,支持分页、关键字搜索、按来源 / Agent 过滤。 +获取当前空间的会话列表,支持分页、关键字搜索、按来源 / Agent 过滤。 **请求**: diff --git a/docs/api/tenant.md b/docs/api/tenant.md index 30f15bb0..d0145045 100644 --- a/docs/api/tenant.md +++ b/docs/api/tenant.md @@ -1,32 +1,32 @@ -# 租户管理 API +# 空间管理 API [返回目录](./README.md) 包含两组接口: -- 租户 CRUD(`/tenants`、`/tenants/:id`):当前认证用户对自己所属租户进行管理;跨租户访问需要管理员权限。 -- 跨租户接口(`/tenants/all`、`/tenants/search`):**需要服务端启用 `EnableCrossTenantAccess` 且当前用户具备 `CanAccessAllTenants` 权限**,否则返回 403。 -- 租户 KV 配置(`/tenants/kv/:key`):当前租户级别的通用配置项,**`tenant_id` 从认证上下文中获取,不在 URL 中传入**。 +- 空间 CRUD(`/tenants`、`/tenants/:id`):当前认证用户对自己所属空间进行管理;跨空间访问需要管理员权限。 +- 跨空间接口(`/tenants/all`、`/tenants/search`):**需要服务端启用 `EnableCrossTenantAccess` 且当前用户具备 `CanAccessAllTenants` 权限**,否则返回 403。 +- 空间 KV 配置(`/tenants/kv/:key`):当前空间级别的通用配置项,**`tenant_id` 从认证上下文中获取,不在 URL 中传入**。 | 方法 | 路径 | 描述 | | ------ | -------------------------- | ------------------------------------------------- | -| GET | `/tenants/all` | 获取所有租户列表(需跨租户权限) | -| GET | `/tenants/search` | 分页搜索租户(需跨租户权限) | -| POST | `/tenants` | 创建新租户 | -| GET | `/tenants/:id` | 获取指定租户信息 | -| PUT | `/tenants/:id` | 更新租户信息 | -| DELETE | `/tenants/:id` | 删除租户 | -| GET | `/tenants/:id/api-keys` | 列出租户 API Key(Owner) | +| GET | `/tenants/all` | 获取所有空间列表(需跨空间权限) | +| GET | `/tenants/search` | 分页搜索空间(需跨空间权限) | +| POST | `/tenants` | 创建新空间 | +| GET | `/tenants/:id` | 获取指定空间信息 | +| PUT | `/tenants/:id` | 更新空间信息 | +| DELETE | `/tenants/:id` | 删除空间 | +| GET | `/tenants/:id/api-keys` | 列出空间 API Key(Owner) | | POST | `/tenants/:id/api-keys` | 创建带角色的 API Key(Owner) | | DELETE | `/tenants/:id/api-keys/:key_id` | 吊销指定 API Key(Owner) | | GET | `/tenants/:id/api-principal-config` | 获取 API Key 用户身份配置(Owner) | | PUT | `/tenants/:id/api-principal-config` | 更新 API Key 用户身份配置(Owner) | -| GET | `/tenants` | 获取当前用户可见的租户列表 | -| GET | `/tenants/kv/:key` | 获取当前租户的 KV 配置(tenant 由认证上下文确定) | -| PUT | `/tenants/kv/:key` | 更新当前租户的 KV 配置(tenant 由认证上下文确定) | +| GET | `/tenants` | 获取当前用户可见的空间列表 | +| GET | `/tenants/kv/:key` | 获取当前空间的 KV 配置(空间由认证上下文确定) | +| PUT | `/tenants/kv/:key` | 更新当前空间的 KV 配置(空间由认证上下文确定) | -## GET `/tenants/all` - 获取所有租户列表 +## GET `/tenants/all` - 获取所有空间列表 -获取系统中所有租户列表,需要跨租户权限。 +获取系统中所有空间列表,需要跨空间权限。 **请求**: @@ -45,7 +45,7 @@ curl --location 'http://localhost:8080/api/v1/tenants/all' \ { "id": 10001, "name": "weknora-1", - "description": "weknora tenants 1", + "description": "weknora workspaces 1", "status": "active", "business": "wechat", "created_at": "2025-08-11T20:37:28.39698+08:00", @@ -54,7 +54,7 @@ curl --location 'http://localhost:8080/api/v1/tenants/all' \ { "id": 10002, "name": "weknora-2", - "description": "weknora tenants 2", + "description": "weknora workspaces 2", "status": "active", "business": "wechat", "created_at": "2025-08-11T20:52:58.05679+08:00", @@ -66,13 +66,13 @@ curl --location 'http://localhost:8080/api/v1/tenants/all' \ } ``` -## GET `/tenants/search` - 搜索租户 +## GET `/tenants/search` - 搜索空间 -按关键词搜索租户,需要跨租户权限。 +按关键词搜索空间,需要跨空间权限。 **查询参数**: - `keyword`: 搜索关键词(可选) -- `tenant_id`: 按租户ID筛选(可选) +- `tenant_id`: 按空间ID筛选(可选) - `page`: 页码(默认 1) - `page_size`: 每页条数(默认 20) @@ -93,7 +93,7 @@ curl --location 'http://localhost:8080/api/v1/tenants/search?keyword=weknora&pag { "id": 10002, "name": "weknora", - "description": "weknora tenants", + "description": "weknora workspaces", "status": "active", "business": "wechat", "created_at": "2025-08-11T20:52:58.05679+08:00", @@ -108,18 +108,18 @@ curl --location 'http://localhost:8080/api/v1/tenants/search?keyword=weknora&pag } ``` -## POST `/tenants` - 创建新租户 +## POST `/tenants` - 创建新空间 -创建一个新的租户。**默认不会**自动发放 API Key;请在创建后通过 `POST /tenants/:id/api-keys` 创建密钥。从旧版本升级时,原有 `tenants.api_key` 会迁移到 `tenant_api_keys` 表并继续可用,直至被吊销。 +创建一个新的空间。**默认不会**自动发放 API Key;请在创建后通过 `POST /tenants/:id/api-keys` 创建密钥。从旧版本升级时,原有 `tenants.api_key` 会迁移到 `tenant_api_keys` 表并继续可用,直至被吊销。 -> **兼容旧行为(可选)**:如需恢复旧版「创建租户即下发默认 API Key」的行为,可将系统设置 `tenant.auto_create_api_key` 置为 `true`(或设置环境变量 `WEKNORA_TENANT_AUTO_CREATE_API_KEY=true`)。开启后,创建租户会自动生成一个 `full_access` 权限的 API Key,并在响应体 `data.api_key` 中返回其明文 token(仅本次创建响应返回,请妥善保存)。默认 `false`。 +> **兼容旧行为(可选)**:如需恢复旧版「创建空间即下发默认 API Key」的行为,可将系统设置 `tenant.auto_create_api_key` 置为 `true`(或设置环境变量 `WEKNORA_TENANT_AUTO_CREATE_API_KEY=true`)。开启后,创建空间会自动生成一个 `full_access` 权限的 API Key,并在响应体 `data.api_key` 中返回其明文 token(仅本次创建响应返回,请妥善保存)。默认 `false`。 **参数说明(请求体)**: | 字段 | 类型 | 必填 | 说明 | | ----------------- | ------ | ---- | ------------------------------------------------------ | -| name | string | 是 | 租户名称 | -| description | string | 否 | 租户描述 | +| name | string | 是 | 空间名称 | +| description | string | 否 | 空间描述 | | business | string | 否 | 业务标识(如 `wechat`) | | retriever_engines | object | 否 | 检索引擎组合配置(`engines` 数组:每项含 `retriever_type` 与 `retriever_engine_type`) | | storage_quota | int | 否 | 存储配额(字节) | @@ -131,7 +131,7 @@ curl --location 'http://localhost:8080/api/v1/tenants' \ --header 'Content-Type: application/json' \ --data '{ "name": "weknora", - "description": "weknora tenants", + "description": "weknora workspaces", "business": "wechat", "retriever_engines": { "engines": [ @@ -155,7 +155,7 @@ curl --location 'http://localhost:8080/api/v1/tenants' \ "data": { "id": 10000, "name": "weknora", - "description": "weknora tenants", + "description": "weknora workspaces", "status": "active", "retriever_engines": { "engines": [ @@ -187,7 +187,7 @@ curl --location 'http://localhost:8080/api/v1/tenants' \ "data": { "id": 10000, "name": "weknora", - "description": "weknora tenants", + "description": "weknora workspaces", "api_key": "sk-aaLRAgvCRJcmtiL2vLMeB1FB5UV0Q-qB7DlTE1pJ9KA93XZG", "status": "active", "business": "wechat", @@ -201,15 +201,15 @@ curl --location 'http://localhost:8080/api/v1/tenants' \ } ``` -## GET `/tenants/:id` - 获取指定租户信息 +## GET `/tenants/:id` - 获取指定空间信息 -获取指定 ID 的租户详情。只能访问自己所属租户;访问其他租户需要跨租户权限,否则返回 403。 +获取指定 ID 的空间详情。只能访问自己所属空间;访问其他空间需要跨空间权限,否则返回 403。 **路径参数**: | 字段 | 类型 | 说明 | | ---- | ---- | ------- | -| id | int | 租户 ID | +| id | int | 空间 ID | **请求**: @@ -226,7 +226,7 @@ curl --location 'http://localhost:8080/api/v1/tenants/10000' \ "data": { "id": 10000, "name": "weknora", - "description": "weknora tenants", + "description": "weknora workspaces", "api_key": "sk-aaLRAgvCRJcmtiL2vLMeB1FB5UV0Q-qB7DlTE1pJ9KA93XZG", "status": "active", "retriever_engines": { @@ -252,15 +252,15 @@ curl --location 'http://localhost:8080/api/v1/tenants/10000' \ } ``` -## PUT `/tenants/:id` - 更新租户信息 +## PUT `/tenants/:id` - 更新空间信息 -更新指定租户的基础信息。访问规则同 `GET /tenants/:id`。 +更新指定空间的基础信息。访问规则同 `GET /tenants/:id`。 **路径参数**: | 字段 | 类型 | 说明 | | ---- | ---- | ------- | -| id | int | 租户 ID | +| id | int | 空间 ID | **参数说明(请求体)**: 与 `POST /tenants` 相同字段;未传字段保持原值。 @@ -272,7 +272,7 @@ curl --location --request PUT 'http://localhost:8080/api/v1/tenants/10000' \ --header 'Content-Type: application/json' \ --data '{ "name": "weknora new", - "description": "weknora tenants new", + "description": "weknora workspaces new", "status": "active", "retriever_engines": { "engines": [ @@ -298,7 +298,7 @@ curl --location --request PUT 'http://localhost:8080/api/v1/tenants/10000' \ "data": { "id": 10000, "name": "weknora new", - "description": "weknora tenants new", + "description": "weknora workspaces new", "api_key": "sk-aaLRAgvCRJcmtiL2vLMeB1FB5UV0Q-qB7DlTE1pJ9KA93XZG", "status": "active", "retriever_engines": { @@ -324,15 +324,15 @@ curl --location --request PUT 'http://localhost:8080/api/v1/tenants/10000' \ } ``` -## DELETE `/tenants/:id` - 删除租户 +## DELETE `/tenants/:id` - 删除空间 -删除指定租户。访问规则同 `GET /tenants/:id`。 +删除指定空间。访问规则同 `GET /tenants/:id`。 **路径参数**: | 字段 | 类型 | 说明 | | ---- | ---- | ------- | -| id | int | 租户 ID | +| id | int | 空间 ID | **请求**: @@ -346,21 +346,21 @@ curl --location --request DELETE 'http://localhost:8080/api/v1/tenants/10000' \ ```json { - "message": "Tenant deleted successfully", + "message": "Workspace deleted successfully", "success": true } ``` -## 租户 API Key 管理(`tenant_api_keys`) +## 空间 API Key 管理(`tenant_api_keys`) 自 scoped API Key 改造后,密钥以独立记录存储,支持: -- **role**:`viewer`(只读 + 语义检索 POST)、`contributor`(知识库写入)、`admin`(租户级管理,不含 `/api-keys` 管理面) +- **role**:`viewer`(只读 + 语义检索 POST)、`contributor`(知识库写入)、`admin`(空间级管理,不含 `/api-keys` 管理面) - **knowledge_base_ids**:可选,将 Key 限制在指定知识库 - **吊销**:`DELETE /tenants/:id/api-keys/:key_id` - **过期**:创建时可选 `expires_at_unix` -认证上下文中的租户角色与 Key 的 `role` 一致(`viewer` / `contributor` / `admin`)。路由级 API Key 鉴权与 KB 访问守卫在 `X-API-Key` 认证后强制执行。 +认证上下文中的空间角色与 Key 的 `role` 一致(`viewer` / `contributor` / `admin`)。路由级 API Key 鉴权与 KB 访问守卫在 `X-API-Key` 认证后强制执行。 ## API Key Principal:隔离边界与安全说明 @@ -370,25 +370,25 @@ curl --location --request DELETE 'http://localhost:8080/api/v1/tenants/10000' \ Principal **仅**用于按终端用户隔离以下能力: -- **对话 Session**(创建、列表、读取按外部用户分开;`仅租户` 模式仍共用租户级 Session) -- **MCP OAuth** 访问令牌(同一租户下不同外部用户各自授权,token 互不共用) +- **对话 Session**(创建、列表、读取按外部用户分开;`仅空间` 模式仍共用空间级 Session) +- **MCP OAuth** 访问令牌(同一空间下不同外部用户各自授权,token 互不共用) - 对话内 MCP OAuth 提示、MCP 工具审批等与终端用户绑定的流程 -Principal **不会**缩小 API Key 的 HTTP 路由权限:路由访问由 Key 的 `role` 控制;租户内 RBAC 角色与 `role` 一致。知识库、Agent 等资源的细粒度访问另受 KB 守卫约束。 +Principal **不会**缩小 API Key 的 HTTP 路由权限:路由访问由 Key 的 `role` 控制;空间内 RBAC 角色与 `role` 一致。知识库、Agent 等资源的细粒度访问另受 KB 守卫约束。 ### 模式与安全假设 | mode | 适用场景 | 安全假设 | | ---- | -------- | -------- | -| `tenant` | 无 per-user MCP 需求 | 全租户共用一个 MCP OAuth 身份 | +| `tenant` | 无 per-user MCP 需求 | 全空间共用一个 MCP OAuth 身份 | | `direct_header` | 仅可信服务端到服务端 | 用户 ID 来自调用方请求头,**可被持有 API Key 的任意调用方伪造**(冒充其他外部用户并共用/劫持其 MCP OAuth 授权)。面向终端用户或不可信客户端时**禁止**使用;若必须使用,请开启 `require_direct_header` 并确保 API Key 仅保存在可信后端 | -| `signed_token` | 面向终端用户的集成(**推荐**) | 由业务后端使用 `hmac_secret` 为外部用户签发短期 HS256 JWT;无效或缺失 token 返回 401,**不回退**为租户级 Principal | +| `signed_token` | 面向终端用户的集成(**推荐**) | 由业务后端使用 `hmac_secret` 为外部用户签发短期 HS256 JWT;无效或缺失 token 返回 401,**不回退**为空间级 Principal | -`direct_header` 模式下,若未携带用户 ID 请求头:`require_direct_header=false` 时回退为租户级 Principal;`require_direct_header=true` 时返回 401。 +`direct_header` 模式下,若未携带用户 ID 请求头:`require_direct_header=false` 时回退为空间级 Principal;`require_direct_header=true` 时返回 401。 ## GET `/tenants/:id/api-principal-config` - 获取 API Key 用户身份配置 -返回租户级 API Key 请求如何映射为终端 Principal 的配置。**需要 Owner 权限**。 +返回空间级 API Key 请求如何映射为终端 Principal 的配置。**需要 Owner 权限**。 **响应字段**: @@ -453,9 +453,9 @@ curl --location --request PUT 'http://localhost:8080/api/v1/tenants/10000/api-pr }' ``` -## GET `/tenants` - 获取租户列表 +## GET `/tenants` - 获取空间列表 -返回当前认证上下文对应的租户(普通用户为单条;管理员仍只返回自身租户)。 +返回当前认证上下文对应的空间(普通用户为单条;管理员仍只返回自身空间)。 **请求**: @@ -474,7 +474,7 @@ curl --location 'http://localhost:8080/api/v1/tenants' \ { "id": 10002, "name": "weknora", - "description": "weknora tenants", + "description": "weknora workspaces", "api_key": "sk-An7_t_izCKFIJ4iht9Xjcjnj_MC48ILvwezEDki9ScfIa7KA", "status": "active", "retriever_engines": { @@ -502,9 +502,9 @@ curl --location 'http://localhost:8080/api/v1/tenants' \ } ``` -## GET `/tenants/kv/:key` - 获取租户 KV 配置 +## GET `/tenants/kv/:key` - 获取空间 KV 配置 -获取当前租户的 KV 配置项。**租户 ID 从认证上下文中获取**(即由 `X-API-Key` / Bearer Token 对应的租户决定),URL 中不需要也不接受 tenant_id。 +获取当前空间的 KV 配置项。**空间 ID 从认证上下文中获取**(即由 `X-API-Key` / Bearer Token 对应的空间决定),URL 中不需要也不接受 tenant_id。 **路径参数**: @@ -560,9 +560,9 @@ curl --location 'http://localhost:8080/api/v1/tenants/kv/agent-config' \ { "success": false, "error": "unsupported key" } ``` -## PUT `/tenants/kv/:key` - 更新租户 KV 配置 +## PUT `/tenants/kv/:key` - 更新空间 KV 配置 -更新当前租户的 KV 配置项。**租户 ID 从认证上下文中获取**,请求体结构按 `key` 不同而异。`prompt-templates` 为只读,不支持 PUT。 +更新当前空间的 KV 配置项。**空间 ID 从认证上下文中获取**,请求体结构按 `key` 不同而异。`prompt-templates` 为只读,不支持 PUT。 **路径参数**: diff --git a/docs/api/vector-store.md b/docs/api/vector-store.md index 02b32cab..c15f980f 100644 --- a/docs/api/vector-store.md +++ b/docs/api/vector-store.md @@ -2,7 +2,7 @@ [返回目录](./README.md) -向量存储(VectorStore)API 用于管理租户的向量数据库连接配置,支持 Elasticsearch、PostgreSQL、Qdrant、Milvus、Weaviate、Tencent VectorDB、SQLite 等引擎。接口同时管理用户在 DB 中创建的配置(`source: "user"`)以及通过 `RETRIEVE_DRIVER` 环境变量配置的虚拟存储(`source: "env"`,只读)。 +向量存储(VectorStore)API 用于管理空间的向量数据库连接配置,支持 Elasticsearch、PostgreSQL、Qdrant、Milvus、Weaviate、Tencent VectorDB、SQLite 等引擎。接口同时管理用户在 DB 中创建的配置(`source: "user"`)以及通过 `RETRIEVE_DRIVER` 环境变量配置的虚拟存储(`source: "env"`,只读)。 | 方法 | 路径 | 描述 | | ------ | ---------------------------- | -------------------------------- | @@ -109,13 +109,13 @@ curl --location --request POST 'http://localhost:8080/api/v1/vector-stores/test' ## POST `/vector-stores` - 创建向量存储 -为当前租户创建一个新的向量存储配置。同一 endpoint + index 组合在租户内不允许重复(与环境变量配置的存储也会冲突)。 +为当前空间创建一个新的向量存储配置。同一 endpoint + index 组合在空间内不允许重复(与环境变量配置的存储也会冲突)。 **参数说明(请求体)**: | 字段 | 类型 | 必填 | 说明 | | ----------------- | ------ | ---- | --------------------------------------------------------------- | -| name | string | 是 | 存储显示名(租户内友好名) | +| name | string | 是 | 存储显示名(空间内友好名) | | engine_type | string | 是 | 引擎类型,取自 `/vector-stores/types` | | connection_config | object | 是 | 连接配置(与所选引擎的 `connection_fields` 对应) | | index_config | object | 否 | 索引配置(与所选引擎的 `index_fields` 对应) | @@ -193,7 +193,7 @@ curl --location 'http://localhost:8080/api/v1/vector-stores' \ ## GET `/vector-stores` - 获取向量存储列表 -返回当前租户的所有向量存储,包含 `RETRIEVE_DRIVER` 环境变量配置的虚拟存储(`source: "env"`、`readonly: true`)和用户在 DB 中创建的存储(`source: "user"`、`readonly: false`)。环境变量存储排列在前。 +返回当前空间的所有向量存储,包含 `RETRIEVE_DRIVER` 环境变量配置的虚拟存储(`source: "env"`、`readonly: true`)和用户在 DB 中创建的存储(`source: "user"`、`readonly: false`)。环境变量存储排列在前。 **请求**: @@ -335,7 +335,7 @@ curl --location --request PUT 'http://localhost:8080/api/v1/vector-stores/550e84 **Phase 2 — 绑定保护**: -删除请求在事务中执行,并按 `(tenant_id, vector_store_id)` 复合索引统计当前租户中仍绑定到该存储的活跃知识库数量。**只要存在任意绑定的知识库(已软删除的 KB 不计入),删除即被拒绝**,调用者必须先解绑或删除这些知识库才能继续。在 PostgreSQL 上,事务期间会对 `vector_stores` 行加 `SELECT … FOR UPDATE` 行锁,阻止并发的知识库创建请求悄悄落到正在被删除的存储上(SQLite 上则依赖 WAL + 单写入序列化达成同样语义)。 +删除请求在事务中执行,并按 `(tenant_id, vector_store_id)` 复合索引统计当前空间中仍绑定到该存储的活跃知识库数量。**只要存在任意绑定的知识库(已软删除的 KB 不计入),删除即被拒绝**,调用者必须先解绑或删除这些知识库才能继续。在 PostgreSQL 上,事务期间会对 `vector_stores` 行加 `SELECT … FOR UPDATE` 行锁,阻止并发的知识库创建请求悄悄落到正在被删除的存储上(SQLite 上则依赖 WAL + 单写入序列化达成同样语义)。 **路径参数**: @@ -370,7 +370,7 @@ curl --location --request DELETE 'http://localhost:8080/api/v1/vector-stores/550 } ``` -HTTP `400`。错误消息中包含具体的知识库数量(便于运营定位),但不包含任何 KB 的 ID/名称,以避免跨租户信息泄漏。删除被拒绝时,DB 中的存储行保持原状,进程内引擎注册表也不会被清除。 +HTTP `400`。错误消息中包含具体的知识库数量(便于运营定位),但不包含任何 KB 的 ID/名称,以避免跨空间信息泄漏。删除被拒绝时,DB 中的存储行保持原状,进程内引擎注册表也不会被清除。 ## POST `/vector-stores/:id/test` - 测试已保存或环境变量存储的连接 @@ -427,9 +427,9 @@ Tencent VectorDB 环境变量存储可通过 `TENCENT_VECTORDB_REPLICA_NUMBER` | HTTP 状态码 | code | 含义 | | ----------- | ---- | --------------------------------------------------- | | 400 | 1000 | 请求参数错误、校验失败、尝试修改环境变量存储、删除时仍有知识库绑定 | -| 400 | 2200 | 知识库创建时引用的 `vector_store_id` 无效(不存在或属于其他租户) | +| 400 | 2200 | 知识库创建时引用的 `vector_store_id` 无效(不存在或属于其他空间) | | 400 | 2201 | 知识库创建时引用的存储当前不可用(DB 中存在但未注册到引擎) | -| 401 | 1001 | 未认证(缺少租户上下文或 API Key) | +| 401 | 1001 | 未认证(缺少空间上下文或 API Key) | | 404 | 1003 | 向量存储不存在 | | 409 | 1005 | 同一 endpoint + index 组合已存在 | | 500 | 1007 | 内部服务器错误 | diff --git a/docs/api/web-search.md b/docs/api/web-search.md index 38c336cc..e5c25fc3 100644 --- a/docs/api/web-search.md +++ b/docs/api/web-search.md @@ -4,15 +4,15 @@ 包含两组接口: - `/web-search/providers`:返回**可用的 provider 类型**(只读元数据) -- `/web-search-providers/*`:当前租户**自定义保存**的 provider CRUD 与连通性测试 +- `/web-search-providers/*`:当前空间**自定义保存**的 provider CRUD 与连通性测试 | 方法 | 路径 | 描述 | | ------ | ------------------------------------- | ----------------------------------- | | GET | `/web-search/providers` | 获取网络搜索服务商类型列表 | | GET | `/web-search-providers/types` | 获取 Provider 类型元数据(含参数定义) | | POST | `/web-search-providers/test` | 使用原始凭证测试连通性(不落库) | -| POST | `/web-search-providers` | 创建租户级 Provider 配置 | -| GET | `/web-search-providers` | 获取当前租户已保存的 Provider 列表 | +| POST | `/web-search-providers` | 创建空间级 Provider 配置 | +| GET | `/web-search-providers` | 获取当前空间已保存的 Provider 列表 | | GET | `/web-search-providers/:id` | 获取指定 Provider 详情 | | PUT | `/web-search-providers/:id` | 更新 Provider | | DELETE | `/web-search-providers/:id` | 删除 Provider | @@ -20,7 +20,7 @@ ## GET `/web-search/providers` - 获取网络搜索服务商类型列表 -获取系统中可用的网络搜索服务商列表(系统级元数据,与租户无关)。 +获取系统中可用的网络搜索服务商列表(系统级元数据,与空间无关)。 **请求**: @@ -132,11 +132,11 @@ curl --location --request POST 'http://localhost:8080/api/v1/web-search-provider | 字段 | 类型 | 必填 | 说明 | | ----------- | ------- | ---- | ------------------------------------------ | -| name | string | 是 | Provider 显示名(在租户内唯一友好名) | +| name | string | 是 | Provider 显示名(在空间内唯一友好名) | | provider | string | 是 | Provider 类型(来自 `/web-search-providers/types`) | | description | string | 否 | 备注 | | parameters | object | 否 | 凭证与参数 | -| is_default | boolean | 否 | 是否设为当前租户默认 Provider | +| is_default | boolean | 否 | 是否设为当前空间默认 Provider | **请求**: @@ -174,7 +174,7 @@ curl --location 'http://localhost:8080/api/v1/web-search-providers' \ ## GET `/web-search-providers` - 获取 Provider 列表 -返回当前租户已保存的所有 Provider。 +返回当前空间已保存的所有 Provider。 **请求**: diff --git a/docs/docs.go b/docs/docs.go index 45ef9ff7..44cac9ff 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -193,7 +193,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "获取当前租户的所有智能体(包括内置智能体)", + "description": "获取当前空间的所有智能体(包括内置智能体)", "consumes": [ "application/json" ], @@ -718,7 +718,7 @@ const docTemplate = `{ }, "/auth/auto-setup": { "post": { - "description": "Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程", + "description": "Lite 版专用:首次启动时自动创建默认用户和空间并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程", "consumes": [ "application/json" ], @@ -825,7 +825,7 @@ const docTemplate = `{ }, "/auth/invitations/lookup": { "post": { - "description": "根据邀请链接中的 token 返回邀请上下文(租户名 / 角色 / 过期时间),\n供注册页展示。无认证;token 无效或被撤销返回 410。\n使用 POST + body 而非 GET + path,避免 token 落入访问日志 / 浏览器历史 / tracing。", + "description": "根据邀请链接中的 token 返回邀请上下文(空间名 / 角色 / 过期时间),\n供注册页展示。无认证;token 无效或被撤销返回 410。\n使用 POST + body 而非 GET + path,避免 token 落入访问日志 / 浏览器历史 / tracing。", "consumes": [ "application/json" ], @@ -1226,7 +1226,7 @@ const docTemplate = `{ }, "/auth/register-by-invite": { "post": { - "description": "通过 Owner 生成的共享邀请链接 token 完成注册,绕过 invite_only 模式拦截。\n注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应租户。", + "description": "通过 Owner 生成的共享邀请链接 token 完成注册,绕过 invite_only 模式拦截。\n注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应空间。", "consumes": [ "application/json" ], @@ -1283,7 +1283,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系", + "description": "为当前用户在目标空间重新签发访问令牌;要求该用户在目标空间存在 active 成员关系", "consumes": [ "application/json" ], @@ -1293,7 +1293,7 @@ const docTemplate = `{ "tags": [ "认证" ], - "summary": "切换激活租户", + "summary": "切换激活空间", "parameters": [ { "description": "切换请求", @@ -1327,7 +1327,7 @@ const docTemplate = `{ } }, "403": { - "description": "无该租户成员关系", + "description": "无该空间成员关系", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } @@ -3619,7 +3619,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)", + "description": "获取当前空间的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)", "consumes": [ "application/json" ], @@ -5776,7 +5776,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件)", + "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的空间解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属空间查询(用于刷新后恢复共享知识库下的文件)", "consumes": [ "application/json" ], @@ -5807,7 +5807,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "可选,共享智能体ID(用于按智能体租户批量拉取文件详情)", + "description": "可选,共享智能体ID(用于按智能体空间批量拉取文件详情)", "name": "agent_id", "in": "query" } @@ -6240,7 +6240,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析", + "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析", "consumes": [ "application/json" ], @@ -7661,7 +7661,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "获取当前租户的所有MCP服务", + "description": "获取当前空间的所有MCP服务", "consumes": [ "application/json" ], @@ -8698,7 +8698,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "获取当前租户的所有模型", + "description": "获取当前空间的所有模型", "consumes": [ "application/json" ], @@ -8823,7 +8823,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "检查当前租户的 WeKnoraCloud 凭证是否完好;needs_reinit=true 表示需要重新保存", + "description": "检查当前空间的 WeKnoraCloud 凭证是否完好;needs_reinit=true 表示需要重新保存", "produces": [ "application/json" ], @@ -9002,7 +9002,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "获取当前租户所属的所有组织,并附带各空间内知识库/智能体数量", + "description": "获取当前空间所属的所有组织,并附带各空间内知识库/智能体数量", "produces": [ "application/json" ], @@ -9702,7 +9702,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "获取组织的所有成员(按租户)", + "description": "获取组织的所有成员(按空间)", "produces": [ "application/json" ], @@ -9736,7 +9736,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "更新组织成员(租户)的角色(需要管理员权限)", + "description": "更新组织成员(空间)的角色(需要管理员权限)", "consumes": [ "application/json" ], @@ -9757,7 +9757,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "成员租户ID", + "description": "成员空间ID", "name": "tenant_id", "in": "path", "required": true @@ -9794,7 +9794,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "从组织中移除成员租户(需要管理员权限)", + "description": "从组织中移除成员空间(需要管理员权限)", "tags": [ "组织管理" ], @@ -9809,7 +9809,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "成员租户ID", + "description": "成员空间ID", "name": "tenant_id", "in": "path", "required": true @@ -9892,14 +9892,14 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "搜索租户(排除已加入的租户)用于邀请加入组织;按租户去重,附带代表用户", + "description": "搜索空间(排除已加入的空间)用于邀请加入组织;按空间去重,附带代表用户", "produces": [ "application/json" ], "tags": [ "组织管理" ], - "summary": "搜索可邀请的租户", + "summary": "搜索可邀请的空间", "parameters": [ { "type": "string", @@ -9910,7 +9910,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "搜索关键词(租户名、用户名或邮箱)", + "description": "搜索关键词(空间名、用户名或邮箱)", "name": "q", "in": "query", "required": true @@ -10060,7 +10060,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "获取当前租户的会话列表,支持分页、关键字搜索、按来源/Agent 筛选", + "description": "获取当前空间的会话列表,支持分页、关键字搜索、按来源/Agent 筛选", "consumes": [ "application/json" ], @@ -10177,7 +10177,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "根据ID列表批量删除对话会话,或设置 delete_all=true 删除当前租户的所有会话", + "description": "根据ID列表批量删除对话会话,或设置 delete_all=true 删除当前空间的所有会话", "consumes": [ "application/json" ], @@ -11560,14 +11560,14 @@ const docTemplate = `{ }, "/system/admin/tenants/apply-default-storage-quota": { "post": { - "description": "Reads the current value of ` + "`" + `tenant.default_storage_quota_gb` + "`" + `\n(3-tier resolver: DB \u003e ENV \u003e default) and writes that many\nGiB into storage_quota for every row in tenants. Bypasses\nthe per-tenant PUT whitelist, which forbids storage_quota\nedits by Owners. SystemAdmin only.\nIdempotent — running twice with the same setting is a no-op.", + "description": "Reads the current value of ` + "`" + `tenant.default_storage_quota_gb` + "`" + `\n(3-tier resolver: DB \u003e ENV \u003e default) and writes that many\nGiB into storage_quota for every row in tenants. Bypasses\nthe per-workspace PUT whitelist, which forbids storage_quota\nedits by Owners. SystemAdmin only.\nIdempotent — running twice with the same setting is a no-op.", "produces": [ "application/json" ], "tags": [ "System Admin" ], - "summary": "Apply the default storage quota to every existing tenant", + "summary": "Apply the default storage quota to every existing workspace", "responses": { "200": { "description": "{ affected: int64, quota_bytes: int64 }", @@ -11806,7 +11806,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "获取当前用户可访问的租户列表", + "description": "获取当前用户可访问的空间列表", "consumes": [ "application/json" ], @@ -11814,12 +11814,12 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户列表", + "summary": "获取空间列表", "responses": { "200": { - "description": "租户列表", + "description": "空间列表", "schema": { "type": "object", "additionalProperties": true @@ -11839,7 +11839,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "创建新的租户。任意已登录用户均可调用以建立自己的新工作区,\n调用方会被自动设为该租户的 Owner。跨租户超管仍可像以前一样\n通过本接口创建任意租户。\n当 tenant.auto_create_api_key(或 WEKNORA_TENANT_AUTO_CREATE_API_KEY)\n开启时,会自动创建一个 full_access API Key,并在响应体的 data.api_key 字段返回其明文 token。", + "description": "创建新的空间。任意已登录用户均可调用以建立自己的新工作区,\n调用方会被自动设为该空间的 Owner。跨空间超管仍可像以前一样\n通过本接口创建任意空间。\n当 tenant.auto_create_api_key(或 WEKNORA_TENANT_AUTO_CREATE_API_KEY)\n开启时,会自动创建一个 full_access API Key,并在响应体的 data.api_key 字段返回其明文 token。", "consumes": [ "application/json" ], @@ -11847,12 +11847,12 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "创建租户", + "summary": "创建空间", "parameters": [ { - "description": "租户信息", + "description": "空间信息", "name": "request", "in": "body", "required": true, @@ -11863,7 +11863,7 @@ const docTemplate = `{ ], "responses": { "201": { - "description": "创建的租户(可选含 api_key)", + "description": "创建的空间(可选含 api_key)", "schema": { "type": "object", "additionalProperties": true @@ -11885,7 +11885,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "获取系统中所有租户(需要跨租户访问权限)", + "description": "获取系统中所有空间(需要跨空间访问权限)", "consumes": [ "application/json" ], @@ -11893,12 +11893,12 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取所有租户列表", + "summary": "获取所有空间列表", "responses": { "200": { - "description": "所有租户列表", + "description": "所有空间列表", "schema": { "type": "object", "additionalProperties": true @@ -11931,7 +11931,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], "summary": "获取提示词模板", "responses": { @@ -11961,7 +11961,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "获取租户的网络搜索配置", + "description": "获取空间的网络搜索配置", "consumes": [ "application/json" ], @@ -11969,9 +11969,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户网络搜索配置", + "summary": "获取空间网络搜索配置", "responses": { "200": { "description": "网络搜索配置", @@ -11999,7 +11999,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "获取租户级别的KV配置(支持web-search-config、prompt-templates、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", + "description": "获取空间级别的KV配置(支持web-search-config、prompt-templates、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", "consumes": [ "application/json" ], @@ -12007,9 +12007,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户KV配置", + "summary": "获取空间KV配置", "parameters": [ { "type": "string", @@ -12044,7 +12044,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "更新租户级别的KV配置(支持web-search-config、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", + "description": "更新空间级别的KV配置(支持web-search-config、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", "consumes": [ "application/json" ], @@ -12052,9 +12052,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "更新租户KV配置", + "summary": "更新空间KV配置", "parameters": [ { "type": "string", @@ -12100,7 +12100,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "分页搜索租户(需要跨租户访问权限)", + "description": "分页搜索空间(需要跨空间访问权限)", "consumes": [ "application/json" ], @@ -12108,9 +12108,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "搜索租户", + "summary": "搜索空间", "parameters": [ { "type": "string", @@ -12120,7 +12120,7 @@ const docTemplate = `{ }, { "type": "integer", - "description": "租户ID筛选", + "description": "空间ID筛选", "name": "tenant_id", "in": "query" }, @@ -12166,7 +12166,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "根据ID获取租户详情", + "description": "根据ID获取空间详情", "consumes": [ "application/json" ], @@ -12174,13 +12174,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户详情", + "summary": "获取空间详情", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12188,7 +12188,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "租户详情", + "description": "空间详情", "schema": { "type": "object", "additionalProperties": true @@ -12201,7 +12201,7 @@ const docTemplate = `{ } }, "404": { - "description": "租户不存在", + "description": "空间不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } @@ -12214,7 +12214,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "更新租户信息", + "description": "更新空间信息", "consumes": [ "application/json" ], @@ -12222,19 +12222,19 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "更新租户", + "summary": "更新空间", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true }, { - "description": "租户信息", + "description": "空间信息", "name": "request", "in": "body", "required": true, @@ -12245,7 +12245,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "更新后的租户", + "description": "更新后的空间", "schema": { "type": "object", "additionalProperties": true @@ -12265,7 +12265,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "删除指定的租户", + "description": "删除指定的空间", "consumes": [ "application/json" ], @@ -12273,13 +12273,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "删除租户", + "summary": "删除空间", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12317,13 +12317,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户 API Key 用户身份配置", + "summary": "获取空间 API Key 用户身份配置", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12365,13 +12365,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "更新租户 API Key 用户身份配置", + "summary": "更新空间 API Key 用户身份配置", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12416,7 +12416,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "使用租户已保存的 HMAC 密钥签发短期外部用户 JWT(Owner)", + "description": "使用空间已保存的 HMAC 密钥签发短期外部用户 JWT(Owner)", "consumes": [ "application/json" ], @@ -12424,13 +12424,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], "summary": "生成 API Playground 测试 JWT", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12478,18 +12478,18 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "返回该租户最近的审计事件,按 id 倒序。游标分页:将上次响应的 next_cursor 作为下一次请求的 after_id。", + "description": "返回该空间最近的审计事件,按 id 倒序。游标分页:将上次响应的 next_cursor 作为下一次请求的 after_id。", "produces": [ "application/json" ], "tags": [ "审计日志" ], - "summary": "获取租户审计日志", + "summary": "获取空间审计日志", "parameters": [ { "type": "string", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12548,18 +12548,18 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "按 tenant 列出待接受 / 历史邀请。query include_terminal=true 时附带 accepted/declined/revoked/expired。", + "description": "按空间列出待接受 / 历史邀请。query include_terminal=true 时附带 accepted/declined/revoked/expired。", "produces": [ "application/json" ], "tags": [ - "租户邀请" + "空间邀请" ], - "summary": "列出租户邀请", + "summary": "列出空间邀请", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12601,7 +12601,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "Owner 通过邮箱邀请已注册用户加入当前租户;被邀请人需要在 /me/invitations 接受后才会成为成员。", + "description": "Owner 通过邮箱邀请已注册用户加入当前空间;被邀请人需要在 /me/invitations 接受后才会成为成员。", "consumes": [ "application/json" ], @@ -12609,13 +12609,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户邀请" + "空间邀请" ], - "summary": "发出租户邀请", + "summary": "发出空间邀请", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12653,13 +12653,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户邀请" + "空间邀请" ], "summary": "撤销待接受邀请", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12690,7 +12690,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前租户。\n链接持续有效,直到过期或被撤销。", + "description": "生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前空间。\n链接持续有效,直到过期或被撤销。", "consumes": [ "application/json" ], @@ -12698,13 +12698,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户邀请" + "空间邀请" ], "summary": "生成共享邀请链接", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12737,18 +12737,18 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "调用方主动退出当前租户。等价于以自己的 user_id 调 RemoveMember,", + "description": "调用方主动退出当前空间。等价于以自己的 user_id 调 RemoveMember,", "produces": [ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "退出当前租户", + "summary": "退出当前空间", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12772,18 +12772,18 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "分页返回当前租户内 active 成员(含每位成员的角色、邮箱、头像);支持 q 按邮箱/用户名筛选", + "description": "分页返回当前空间内 active 成员(含每位成员的角色、邮箱、头像);支持 q 按邮箱/用户名筛选", "produces": [ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "列出租户成员", + "summary": "列出空间成员", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12832,13 +12832,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "直接添加租户成员(直加路径)", + "summary": "直接添加空间成员(直加路径)", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12871,7 +12871,7 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "Owner 修改某位成员在当前租户内的角色;不能将最后一位 Owner 降级", + "description": "Owner 修改某位成员在当前空间内的角色;不能将最后一位 Owner 降级", "consumes": [ "application/json" ], @@ -12879,13 +12879,13 @@ const docTemplate = `{ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "修改租户成员角色", + "summary": "修改空间成员角色", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12923,18 +12923,18 @@ const docTemplate = `{ "Bearer": [] } ], - "description": "Owner 将某位成员从当前租户中移除(软删除 tenant_members 行);不能移除最后一位 Owner", + "description": "Owner 将某位成员从当前空间中移除(软删除 tenant_members 行);不能移除最后一位 Owner", "produces": [ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "移除租户成员", + "summary": "移除空间成员", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12960,7 +12960,7 @@ const docTemplate = `{ }, "/user/favorites": { "get": { - "description": "Lists this user's starred resources in the current tenant for a given type", + "description": "Lists this user's starred resources in the current workspace for a given type", "tags": [ "User" ], @@ -13054,7 +13054,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "List all vector stores for the current tenant, including environment-configured and user-created stores", + "description": "List all vector stores for the current workspace, including environment-configured and user-created stores", "produces": [ "application/json" ], @@ -13088,7 +13088,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "Create a new vector store configuration for the current tenant", + "description": "Create a new vector store configuration for the current workspace", "consumes": [ "application/json" ], @@ -13852,7 +13852,7 @@ const docTemplate = `{ "ApiKeyAuth": [] } ], - "description": "保存 APPID/APPSECRET 到当前租户配置(不自动创建模型)", + "description": "保存 APPID/APPSECRET 到当前空间配置(不自动创建模型)", "consumes": [ "application/json" ], @@ -14676,7 +14676,7 @@ const docTemplate = `{ "type": "integer" }, "image_storage_provider": { - "description": "Storage provider for image uploads: \"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\".\nEmpty means use the global/tenant default provider.", + "description": "Storage provider for image uploads: \"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\".\nEmpty means use the global/workspace default provider.", "type": "string" }, "image_upload_enabled": { @@ -14819,7 +14819,7 @@ const docTemplate = `{ "type": "number" }, "vlm_model_id": { - "description": "VLM model ID for image analysis (optional, falls back to tenant-level VLM)", + "description": "VLM model ID for image analysis (optional, falls back to workspace-level VLM)", "type": "string" }, "web_fetch_enabled": { @@ -14839,7 +14839,7 @@ const docTemplate = `{ "type": "integer" }, "web_search_provider_id": { - "description": "WebSearchProviderID references a specific WebSearchProviderEntity.\nIf empty, the tenant's default provider (is_default=true) is used.", + "description": "WebSearchProviderID references a specific WebSearchProviderEntity.\nIf empty, the workspace's default provider (is_default=true) is used.", "type": "string" } } @@ -14933,7 +14933,7 @@ const docTemplate = `{ "type": "string" }, "tenant_id": { - "description": "Tenant ID for multi-tenancy", + "description": "Workspace ID for multi-workspace isolation", "type": "integer" }, "total_items_synced": { @@ -15366,7 +15366,7 @@ const docTemplate = `{ ], "properties": { "representative_user_id": { - "description": "RepresentativeUserID identifies the user attached to the OTM row for\ndisplay/audit. Optional: when unset, the handler picks a stable default\n(the user from the legacy UserID field, or the tenant's owner).", + "description": "RepresentativeUserID identifies the user attached to the OTM row for\ndisplay/audit. Optional: when unset, the handler picks a stable default\n(the user from the legacy UserID field, or the workspace's owner).", "type": "string" }, "role": { @@ -15378,7 +15378,7 @@ const docTemplate = `{ ] }, "tenant_id": { - "description": "TenantID is the tenant to enrol as an org member. Preferred field.", + "description": "TenantID is the workspace to enrol as an org member. Preferred field.", "type": "integer" }, "user_id": { @@ -15575,7 +15575,7 @@ const docTemplate = `{ } }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "title": { @@ -15620,11 +15620,11 @@ const docTemplate = `{ "type": "string" }, "creator_id": { - "description": "CreatorID records the user ID of whoever originally created the KB.\nUsed by the tenant-level RBAC middleware to let Contributors edit\ntheir own KBs without granting them access to everyone else's.\nNullable for backward compatibility with rows created before the\nRBAC migration backfilled the column to the tenant Owner.", + "description": "CreatorID records the user ID of whoever originally created the KB.\nUsed by the workspace-level RBAC middleware to let Contributors edit\ntheir own KBs without granting them access to everyone else's.\nNullable for backward compatibility with rows created before the\nRBAC migration backfilled the column to the workspace Owner.", "type": "string" }, "creator_name": { - "description": "CreatorName 是 CreatorID 对应用户的展示名(username / email 等),\n仅在列表场景由 handler 批量回填,不落库;为空表示创建者无法解析(用户已删除、\nCreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs tenant 的二分。", + "description": "CreatorName 是 CreatorID 对应用户的展示名(username / email 等),\n仅在列表场景由 handler 批量回填,不落库;为空表示创建者无法解析(用户已删除、\nCreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs workspace 的二分。", "type": "string" }, "deleted_at": { @@ -15680,7 +15680,7 @@ const docTemplate = `{ ] }, "is_pinned": { - "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a tenant-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged ` + "`" + `gorm:\"-\"` + "`" + ` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", + "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a workspace-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged ` + "`" + `gorm:\"-\"` + "`" + ` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", "type": "boolean" }, "is_processing": { @@ -15728,7 +15728,7 @@ const docTemplate = `{ ] }, "storage_provider_config": { - "description": "Storage provider config (new): only stores provider selection; credentials from tenant StorageEngineConfig", + "description": "Storage provider config (new): only stores provider selection; credentials from workspace StorageEngineConfig", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StorageProviderConfig" @@ -15740,7 +15740,7 @@ const docTemplate = `{ "type": "string" }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "type": { @@ -15752,7 +15752,7 @@ const docTemplate = `{ "type": "string" }, "vector_store_id": { - "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the tenant's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (` + "`" + `\u003c-:create` + "`" + `) plus the service-layer\nKB update path, which omits this field from its update DTO.", + "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the workspace's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (` + "`" + `\u003c-:create` + "`" + `) plus the service-layer\nKB update path, which omits this field from its update DTO.", "type": "string" }, "vlm_config": { @@ -15942,7 +15942,7 @@ const docTemplate = `{ "type": "boolean" }, "parser_engine_overrides": { - "description": "ParserEngineOverrides passes key-value configuration to docreader parsers\n(e.g. pdf_force_scanned=true). Merged with tenant-level overrides in the\nparse pipeline; per-upload values take priority on conflict.", + "description": "ParserEngineOverrides passes key-value configuration to docreader parsers\n(e.g. pdf_force_scanned=true). Merged with workspace-level overrides in the\nparse pipeline; per-upload values take priority on conflict.", "type": "object", "additionalProperties": { "type": "string" @@ -15994,7 +15994,7 @@ const docTemplate = `{ "type": "integer" }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "updated_at": { @@ -16081,7 +16081,7 @@ const docTemplate = `{ "type": "object", "properties": { "active_tenant": { - "description": "ActiveTenant is the tenant whose ID is encoded in the issued JWT;\nfuture requests are scoped to it until the client calls /auth/switch-tenant.\nDefaults to the user's home tenant on a fresh login.", + "description": "ActiveTenant is the workspace whose ID is encoded in the issued JWT;\nfuture requests are scoped to it until the client calls /auth/switch-tenant.\nDefaults to the user's home workspace on a fresh login.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Tenant" @@ -16089,7 +16089,7 @@ const docTemplate = `{ ] }, "memberships": { - "description": "Memberships lists every tenant the user can authenticate into,\nalong with their role in each. Always populated (length 1 for users\nwho only belong to their home tenant) so frontends can render a\ntenant switcher without a follow-up request. Serialised without\nomitempty so the field is always present as a JSON array (possibly\nempty) — the \"always populated\" contract relies on the server side\nguaranteeing a non-nil slice.", + "description": "Memberships lists every workspace the user can authenticate into,\nalong with their role in each. Always populated (length 1 for users\nwho only belong to their home workspace) so frontends can render a\nworkspace switcher without a follow-up request. Serialised without\nomitempty so the field is always present as a JSON array (possibly\nempty) — the \"always populated\" contract relies on the server side\nguaranteeing a non-nil slice.", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Membership" @@ -16232,7 +16232,7 @@ const docTemplate = `{ "type": "string" }, "is_builtin": { - "description": "Whether this is a builtin MCP service (visible to all tenants)", + "description": "Whether this is a builtin MCP service (visible to all workspaces)", "type": "boolean" }, "name": { @@ -16954,7 +16954,7 @@ const docTemplate = `{ "type": "string" }, "owner_tenant_id": { - "description": "OwnerTenantID is the persisted owner tenant of the organization\n(Plan 3, migration 000046). Frontend uses this to identify the\n\"owner row\" in the tenant-keyed members list — comparing\nmember.tenant_id against owner_tenant_id is the post-Plan-3\nequivalent of the old member.user_id == owner_id check.", + "description": "OwnerTenantID is the persisted owner workspace of the organization\n(Plan 3, migration 000046). Frontend uses this to identify the\n\"owner row\" in the workspace-keyed members list — comparing\nmember.tenant_id against owner_tenant_id is the post-Plan-3\nequivalent of the old member.user_id == owner_id check.", "type": "integer" }, "pending_join_request_count": { @@ -17785,7 +17785,7 @@ const docTemplate = `{ "type": "string" }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "title": { @@ -18075,7 +18075,7 @@ const docTemplate = `{ "type": "string" }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "updated_at": { @@ -18179,7 +18179,7 @@ const docTemplate = `{ ] }, "context_config": { - "description": "Global Context configuration for this tenant (default for all sessions)", + "description": "Global Context configuration for this workspace (default for all sessions)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ContextConfig" @@ -18267,7 +18267,7 @@ const docTemplate = `{ "type": "string" }, "web_search_config": { - "description": "Global WebSearch configuration for this tenant", + "description": "Global WebSearch configuration for this workspace", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchConfig" @@ -18435,7 +18435,7 @@ const docTemplate = `{ "type": "string" }, "can_access_all_tenants": { - "description": "Whether the user can access all tenants (cross-tenant access)", + "description": "Whether the user can access all workspaces (cross-workspace access)", "type": "boolean" }, "created_at": { @@ -18463,7 +18463,7 @@ const docTemplate = `{ "type": "boolean" }, "is_system_admin": { - "description": "Whether the user is a system administrator (independent of tenant roles)", + "description": "Whether the user is a system administrator (independent of workspace roles)", "type": "boolean" }, "preferences": { @@ -18483,7 +18483,7 @@ const docTemplate = `{ ] }, "tenant_id": { - "description": "Tenant ID that the user belongs to", + "description": "Workspace ID that the user belongs to", "type": "integer" }, "updated_at": { @@ -18542,7 +18542,7 @@ const docTemplate = `{ "type": "boolean" }, "last_active_tenant_id": { - "description": "LastActiveTenantID remembers the last tenant the user actively\nswitched into, so a fresh login (new device, cleared browser, new\nrefresh token) lands them back in that workspace instead of always\nbouncing to their home tenant. Login / RefreshToken validate that\nthe tenant still exists and the user still has an active membership\n(or CanAccessAllTenants) before honouring this preference; an\ninvalid pointer is best-effort cleared and the user falls back to\nhome.\n\nnil = no preference (use user.TenantID, i.e. home)\n*0 = \"clear preference\" sentinel for the partial-update endpoint\n (UpdateUserPreferences turns this into nil). Otherwise treat\n a stored *0 the same as nil.\n*N = preferred tenant id.", + "description": "LastActiveTenantID remembers the last workspace the user actively\nswitched into, so a fresh login (new device, cleared browser, new\nrefresh token) lands them back in that workspace instead of always\nbouncing to their home workspace. Login / RefreshToken validate that\nthe workspace still exists and the user still has an active membership\n(or CanAccessAllTenants) before honouring this preference; an\ninvalid pointer is best-effort cleared and the user falls back to\nhome.\n\nnil = no preference (use user.TenantID, i.e. home)\n*0 = \"clear preference\" sentinel for the partial-update endpoint\n (UpdateUserPreferences turns this into nil). Otherwise treat\n a stored *0 the same as nil.\n*N = preferred workspace id.", "type": "integer" } } @@ -18664,7 +18664,7 @@ const docTemplate = `{ "type": "string" }, "is_default": { - "description": "Whether this is the default provider for the tenant", + "description": "Whether this is the default provider for the workspace", "type": "boolean" }, "name": { @@ -18688,7 +18688,7 @@ const docTemplate = `{ ] }, "tenant_id": { - "description": "Tenant ID for scoping", + "description": "Workspace ID for scoping", "type": "integer" }, "updated_at": { @@ -19113,7 +19113,7 @@ const docTemplate = `{ "type": "string" }, "tenant_id": { - "description": "Tenant scope, mirrored from the enclosing knowledge base.", + "description": "Workspace scope, mirrored from the enclosing knowledge base.", "type": "integer" } } @@ -19252,7 +19252,7 @@ const docTemplate = `{ "type": "string" }, "tenant_id": { - "description": "Tenant ID for multi-tenant isolation", + "description": "Workspace ID for multi-workspace isolation", "type": "integer" }, "title": { @@ -20400,7 +20400,7 @@ const docTemplate = `{ } }, "internal_handler.RuntimeWorkerPool": { - "description": "Return every row in the system_settings table (system-scope, not tenant-scope). SystemAdmin only.", + "description": "Return every row in the system_settings table (system-scope, not workspace-scoped). SystemAdmin only.", "type": "object", "properties": { "active": { @@ -20957,7 +20957,7 @@ const docTemplate = `{ "type": "boolean" }, "last_active_tenant_id": { - "description": "LastActiveTenantID lets the SPA persist \"after a fresh login,\ndrop me back into this workspace\" across devices. Send a positive\ntenant id to set / replace, or 0 to clear. Membership is validated\nat next login, not here. Nil = field omitted from the PATCH and\nstays untouched.", + "description": "LastActiveTenantID lets the SPA persist \"after a fresh login,\ndrop me back into this workspace\" across devices. Send a positive\nworkspace id to set / replace, or 0 to clear. Membership is validated\nat next login, not here. Nil = field omitted from the PATCH and\nstays untouched.", "type": "integer" } } @@ -20990,7 +20990,7 @@ const docTemplate = `{ "type": "boolean" }, "agent_id": { - "description": "Selected custom agent ID (backend resolves shared agent and its tenant from share relation)", + "description": "Selected custom agent ID (backend resolves shared agent and its workspace from share relation)", "type": "string" }, "attachment_uploads": { @@ -21230,7 +21230,7 @@ const docTemplate = `{ }, "securityDefinitions": { "ApiKeyAuth": { - "description": "租户身份认证:输入 sk- 开头的 API Key", + "description": "空间身份认证:输入 sk- 开头的 API Key", "type": "apiKey", "name": "X-API-Key", "in": "header" diff --git a/docs/swagger.json b/docs/swagger.json index 8061ed23..14c6cd58 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -186,7 +186,7 @@ "ApiKeyAuth": [] } ], - "description": "获取当前租户的所有智能体(包括内置智能体)", + "description": "获取当前空间的所有智能体(包括内置智能体)", "consumes": [ "application/json" ], @@ -711,7 +711,7 @@ }, "/auth/auto-setup": { "post": { - "description": "Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程", + "description": "Lite 版专用:首次启动时自动创建默认用户和空间并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程", "consumes": [ "application/json" ], @@ -818,7 +818,7 @@ }, "/auth/invitations/lookup": { "post": { - "description": "根据邀请链接中的 token 返回邀请上下文(租户名 / 角色 / 过期时间),\n供注册页展示。无认证;token 无效或被撤销返回 410。\n使用 POST + body 而非 GET + path,避免 token 落入访问日志 / 浏览器历史 / tracing。", + "description": "根据邀请链接中的 token 返回邀请上下文(空间名 / 角色 / 过期时间),\n供注册页展示。无认证;token 无效或被撤销返回 410。\n使用 POST + body 而非 GET + path,避免 token 落入访问日志 / 浏览器历史 / tracing。", "consumes": [ "application/json" ], @@ -1219,7 +1219,7 @@ }, "/auth/register-by-invite": { "post": { - "description": "通过 Owner 生成的共享邀请链接 token 完成注册,绕过 invite_only 模式拦截。\n注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应租户。", + "description": "通过 Owner 生成的共享邀请链接 token 完成注册,绕过 invite_only 模式拦截。\n注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应空间。", "consumes": [ "application/json" ], @@ -1276,7 +1276,7 @@ "Bearer": [] } ], - "description": "为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系", + "description": "为当前用户在目标空间重新签发访问令牌;要求该用户在目标空间存在 active 成员关系", "consumes": [ "application/json" ], @@ -1286,7 +1286,7 @@ "tags": [ "认证" ], - "summary": "切换激活租户", + "summary": "切换激活空间", "parameters": [ { "description": "切换请求", @@ -1320,7 +1320,7 @@ } }, "403": { - "description": "无该租户成员关系", + "description": "无该空间成员关系", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } @@ -3612,7 +3612,7 @@ "ApiKeyAuth": [] } ], - "description": "获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)", + "description": "获取当前空间的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及)", "consumes": [ "application/json" ], @@ -5769,7 +5769,7 @@ "ApiKeyAuth": [] } ], - "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件)", + "description": "根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的空间解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属空间查询(用于刷新后恢复共享知识库下的文件)", "consumes": [ "application/json" ], @@ -5800,7 +5800,7 @@ }, { "type": "string", - "description": "可选,共享智能体ID(用于按智能体租户批量拉取文件详情)", + "description": "可选,共享智能体ID(用于按智能体空间批量拉取文件详情)", "name": "agent_id", "in": "query" } @@ -6233,7 +6233,7 @@ "ApiKeyAuth": [] } ], - "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析", + "description": "批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析", "consumes": [ "application/json" ], @@ -7654,7 +7654,7 @@ "ApiKeyAuth": [] } ], - "description": "获取当前租户的所有MCP服务", + "description": "获取当前空间的所有MCP服务", "consumes": [ "application/json" ], @@ -8691,7 +8691,7 @@ "ApiKeyAuth": [] } ], - "description": "获取当前租户的所有模型", + "description": "获取当前空间的所有模型", "consumes": [ "application/json" ], @@ -8816,7 +8816,7 @@ "ApiKeyAuth": [] } ], - "description": "检查当前租户的 WeKnoraCloud 凭证是否完好;needs_reinit=true 表示需要重新保存", + "description": "检查当前空间的 WeKnoraCloud 凭证是否完好;needs_reinit=true 表示需要重新保存", "produces": [ "application/json" ], @@ -8995,7 +8995,7 @@ "Bearer": [] } ], - "description": "获取当前租户所属的所有组织,并附带各空间内知识库/智能体数量", + "description": "获取当前空间所属的所有组织,并附带各空间内知识库/智能体数量", "produces": [ "application/json" ], @@ -9695,7 +9695,7 @@ "Bearer": [] } ], - "description": "获取组织的所有成员(按租户)", + "description": "获取组织的所有成员(按空间)", "produces": [ "application/json" ], @@ -9729,7 +9729,7 @@ "Bearer": [] } ], - "description": "更新组织成员(租户)的角色(需要管理员权限)", + "description": "更新组织成员(空间)的角色(需要管理员权限)", "consumes": [ "application/json" ], @@ -9750,7 +9750,7 @@ }, { "type": "string", - "description": "成员租户ID", + "description": "成员空间ID", "name": "tenant_id", "in": "path", "required": true @@ -9787,7 +9787,7 @@ "Bearer": [] } ], - "description": "从组织中移除成员租户(需要管理员权限)", + "description": "从组织中移除成员空间(需要管理员权限)", "tags": [ "组织管理" ], @@ -9802,7 +9802,7 @@ }, { "type": "string", - "description": "成员租户ID", + "description": "成员空间ID", "name": "tenant_id", "in": "path", "required": true @@ -9885,14 +9885,14 @@ "Bearer": [] } ], - "description": "搜索租户(排除已加入的租户)用于邀请加入组织;按租户去重,附带代表用户", + "description": "搜索空间(排除已加入的空间)用于邀请加入组织;按空间去重,附带代表用户", "produces": [ "application/json" ], "tags": [ "组织管理" ], - "summary": "搜索可邀请的租户", + "summary": "搜索可邀请的空间", "parameters": [ { "type": "string", @@ -9903,7 +9903,7 @@ }, { "type": "string", - "description": "搜索关键词(租户名、用户名或邮箱)", + "description": "搜索关键词(空间名、用户名或邮箱)", "name": "q", "in": "query", "required": true @@ -10053,7 +10053,7 @@ "ApiKeyAuth": [] } ], - "description": "获取当前租户的会话列表,支持分页、关键字搜索、按来源/Agent 筛选", + "description": "获取当前空间的会话列表,支持分页、关键字搜索、按来源/Agent 筛选", "consumes": [ "application/json" ], @@ -10170,7 +10170,7 @@ "ApiKeyAuth": [] } ], - "description": "根据ID列表批量删除对话会话,或设置 delete_all=true 删除当前租户的所有会话", + "description": "根据ID列表批量删除对话会话,或设置 delete_all=true 删除当前空间的所有会话", "consumes": [ "application/json" ], @@ -11553,14 +11553,14 @@ }, "/system/admin/tenants/apply-default-storage-quota": { "post": { - "description": "Reads the current value of `tenant.default_storage_quota_gb`\n(3-tier resolver: DB \u003e ENV \u003e default) and writes that many\nGiB into storage_quota for every row in tenants. Bypasses\nthe per-tenant PUT whitelist, which forbids storage_quota\nedits by Owners. SystemAdmin only.\nIdempotent — running twice with the same setting is a no-op.", + "description": "Reads the current value of `tenant.default_storage_quota_gb`\n(3-tier resolver: DB \u003e ENV \u003e default) and writes that many\nGiB into storage_quota for every row in tenants. Bypasses\nthe per-workspace PUT whitelist, which forbids storage_quota\nedits by Owners. SystemAdmin only.\nIdempotent — running twice with the same setting is a no-op.", "produces": [ "application/json" ], "tags": [ "System Admin" ], - "summary": "Apply the default storage quota to every existing tenant", + "summary": "Apply the default storage quota to every existing workspace", "responses": { "200": { "description": "{ affected: int64, quota_bytes: int64 }", @@ -11799,7 +11799,7 @@ "Bearer": [] } ], - "description": "获取当前用户可访问的租户列表", + "description": "获取当前用户可访问的空间列表", "consumes": [ "application/json" ], @@ -11807,12 +11807,12 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户列表", + "summary": "获取空间列表", "responses": { "200": { - "description": "租户列表", + "description": "空间列表", "schema": { "type": "object", "additionalProperties": true @@ -11832,7 +11832,7 @@ "Bearer": [] } ], - "description": "创建新的租户。任意已登录用户均可调用以建立自己的新工作区,\n调用方会被自动设为该租户的 Owner。跨租户超管仍可像以前一样\n通过本接口创建任意租户。\n当 tenant.auto_create_api_key(或 WEKNORA_TENANT_AUTO_CREATE_API_KEY)\n开启时,会自动创建一个 full_access API Key,并在响应体的 data.api_key 字段返回其明文 token。", + "description": "创建新的空间。任意已登录用户均可调用以建立自己的新工作区,\n调用方会被自动设为该空间的 Owner。跨空间超管仍可像以前一样\n通过本接口创建任意空间。\n当 tenant.auto_create_api_key(或 WEKNORA_TENANT_AUTO_CREATE_API_KEY)\n开启时,会自动创建一个 full_access API Key,并在响应体的 data.api_key 字段返回其明文 token。", "consumes": [ "application/json" ], @@ -11840,12 +11840,12 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "创建租户", + "summary": "创建空间", "parameters": [ { - "description": "租户信息", + "description": "空间信息", "name": "request", "in": "body", "required": true, @@ -11856,7 +11856,7 @@ ], "responses": { "201": { - "description": "创建的租户(可选含 api_key)", + "description": "创建的空间(可选含 api_key)", "schema": { "type": "object", "additionalProperties": true @@ -11878,7 +11878,7 @@ "Bearer": [] } ], - "description": "获取系统中所有租户(需要跨租户访问权限)", + "description": "获取系统中所有空间(需要跨空间访问权限)", "consumes": [ "application/json" ], @@ -11886,12 +11886,12 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取所有租户列表", + "summary": "获取所有空间列表", "responses": { "200": { - "description": "所有租户列表", + "description": "所有空间列表", "schema": { "type": "object", "additionalProperties": true @@ -11924,7 +11924,7 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], "summary": "获取提示词模板", "responses": { @@ -11954,7 +11954,7 @@ "ApiKeyAuth": [] } ], - "description": "获取租户的网络搜索配置", + "description": "获取空间的网络搜索配置", "consumes": [ "application/json" ], @@ -11962,9 +11962,9 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户网络搜索配置", + "summary": "获取空间网络搜索配置", "responses": { "200": { "description": "网络搜索配置", @@ -11992,7 +11992,7 @@ "ApiKeyAuth": [] } ], - "description": "获取租户级别的KV配置(支持web-search-config、prompt-templates、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", + "description": "获取空间级别的KV配置(支持web-search-config、prompt-templates、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", "consumes": [ "application/json" ], @@ -12000,9 +12000,9 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户KV配置", + "summary": "获取空间KV配置", "parameters": [ { "type": "string", @@ -12037,7 +12037,7 @@ "ApiKeyAuth": [] } ], - "description": "更新租户级别的KV配置(支持web-search-config、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", + "description": "更新空间级别的KV配置(支持web-search-config、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config)", "consumes": [ "application/json" ], @@ -12045,9 +12045,9 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "更新租户KV配置", + "summary": "更新空间KV配置", "parameters": [ { "type": "string", @@ -12093,7 +12093,7 @@ "ApiKeyAuth": [] } ], - "description": "分页搜索租户(需要跨租户访问权限)", + "description": "分页搜索空间(需要跨空间访问权限)", "consumes": [ "application/json" ], @@ -12101,9 +12101,9 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "搜索租户", + "summary": "搜索空间", "parameters": [ { "type": "string", @@ -12113,7 +12113,7 @@ }, { "type": "integer", - "description": "租户ID筛选", + "description": "空间ID筛选", "name": "tenant_id", "in": "query" }, @@ -12159,7 +12159,7 @@ "ApiKeyAuth": [] } ], - "description": "根据ID获取租户详情", + "description": "根据ID获取空间详情", "consumes": [ "application/json" ], @@ -12167,13 +12167,13 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户详情", + "summary": "获取空间详情", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12181,7 +12181,7 @@ ], "responses": { "200": { - "description": "租户详情", + "description": "空间详情", "schema": { "type": "object", "additionalProperties": true @@ -12194,7 +12194,7 @@ } }, "404": { - "description": "租户不存在", + "description": "空间不存在", "schema": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError" } @@ -12207,7 +12207,7 @@ "Bearer": [] } ], - "description": "更新租户信息", + "description": "更新空间信息", "consumes": [ "application/json" ], @@ -12215,19 +12215,19 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "更新租户", + "summary": "更新空间", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true }, { - "description": "租户信息", + "description": "空间信息", "name": "request", "in": "body", "required": true, @@ -12238,7 +12238,7 @@ ], "responses": { "200": { - "description": "更新后的租户", + "description": "更新后的空间", "schema": { "type": "object", "additionalProperties": true @@ -12258,7 +12258,7 @@ "Bearer": [] } ], - "description": "删除指定的租户", + "description": "删除指定的空间", "consumes": [ "application/json" ], @@ -12266,13 +12266,13 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "删除租户", + "summary": "删除空间", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12310,13 +12310,13 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "获取租户 API Key 用户身份配置", + "summary": "获取空间 API Key 用户身份配置", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12358,13 +12358,13 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], - "summary": "更新租户 API Key 用户身份配置", + "summary": "更新空间 API Key 用户身份配置", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12409,7 +12409,7 @@ "Bearer": [] } ], - "description": "使用租户已保存的 HMAC 密钥签发短期外部用户 JWT(Owner)", + "description": "使用空间已保存的 HMAC 密钥签发短期外部用户 JWT(Owner)", "consumes": [ "application/json" ], @@ -12417,13 +12417,13 @@ "application/json" ], "tags": [ - "租户管理" + "空间管理" ], "summary": "生成 API Playground 测试 JWT", "parameters": [ { "type": "integer", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12471,18 +12471,18 @@ "ApiKeyAuth": [] } ], - "description": "返回该租户最近的审计事件,按 id 倒序。游标分页:将上次响应的 next_cursor 作为下一次请求的 after_id。", + "description": "返回该空间最近的审计事件,按 id 倒序。游标分页:将上次响应的 next_cursor 作为下一次请求的 after_id。", "produces": [ "application/json" ], "tags": [ "审计日志" ], - "summary": "获取租户审计日志", + "summary": "获取空间审计日志", "parameters": [ { "type": "string", - "description": "租户ID", + "description": "空间ID", "name": "id", "in": "path", "required": true @@ -12541,18 +12541,18 @@ "Bearer": [] } ], - "description": "按 tenant 列出待接受 / 历史邀请。query include_terminal=true 时附带 accepted/declined/revoked/expired。", + "description": "按空间列出待接受 / 历史邀请。query include_terminal=true 时附带 accepted/declined/revoked/expired。", "produces": [ "application/json" ], "tags": [ - "租户邀请" + "空间邀请" ], - "summary": "列出租户邀请", + "summary": "列出空间邀请", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12594,7 +12594,7 @@ "Bearer": [] } ], - "description": "Owner 通过邮箱邀请已注册用户加入当前租户;被邀请人需要在 /me/invitations 接受后才会成为成员。", + "description": "Owner 通过邮箱邀请已注册用户加入当前空间;被邀请人需要在 /me/invitations 接受后才会成为成员。", "consumes": [ "application/json" ], @@ -12602,13 +12602,13 @@ "application/json" ], "tags": [ - "租户邀请" + "空间邀请" ], - "summary": "发出租户邀请", + "summary": "发出空间邀请", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12646,13 +12646,13 @@ "application/json" ], "tags": [ - "租户邀请" + "空间邀请" ], "summary": "撤销待接受邀请", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12683,7 +12683,7 @@ "Bearer": [] } ], - "description": "生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前租户。\n链接持续有效,直到过期或被撤销。", + "description": "生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前空间。\n链接持续有效,直到过期或被撤销。", "consumes": [ "application/json" ], @@ -12691,13 +12691,13 @@ "application/json" ], "tags": [ - "租户邀请" + "空间邀请" ], "summary": "生成共享邀请链接", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12730,18 +12730,18 @@ "Bearer": [] } ], - "description": "调用方主动退出当前租户。等价于以自己的 user_id 调 RemoveMember,", + "description": "调用方主动退出当前空间。等价于以自己的 user_id 调 RemoveMember,", "produces": [ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "退出当前租户", + "summary": "退出当前空间", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12765,18 +12765,18 @@ "Bearer": [] } ], - "description": "分页返回当前租户内 active 成员(含每位成员的角色、邮箱、头像);支持 q 按邮箱/用户名筛选", + "description": "分页返回当前空间内 active 成员(含每位成员的角色、邮箱、头像);支持 q 按邮箱/用户名筛选", "produces": [ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "列出租户成员", + "summary": "列出空间成员", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12825,13 +12825,13 @@ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "直接添加租户成员(直加路径)", + "summary": "直接添加空间成员(直加路径)", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12864,7 +12864,7 @@ "Bearer": [] } ], - "description": "Owner 修改某位成员在当前租户内的角色;不能将最后一位 Owner 降级", + "description": "Owner 修改某位成员在当前空间内的角色;不能将最后一位 Owner 降级", "consumes": [ "application/json" ], @@ -12872,13 +12872,13 @@ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "修改租户成员角色", + "summary": "修改空间成员角色", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12916,18 +12916,18 @@ "Bearer": [] } ], - "description": "Owner 将某位成员从当前租户中移除(软删除 tenant_members 行);不能移除最后一位 Owner", + "description": "Owner 将某位成员从当前空间中移除(软删除 tenant_members 行);不能移除最后一位 Owner", "produces": [ "application/json" ], "tags": [ - "租户成员" + "空间成员" ], - "summary": "移除租户成员", + "summary": "移除空间成员", "parameters": [ { "type": "string", - "description": "租户 ID", + "description": "空间 ID", "name": "id", "in": "path", "required": true @@ -12953,7 +12953,7 @@ }, "/user/favorites": { "get": { - "description": "Lists this user's starred resources in the current tenant for a given type", + "description": "Lists this user's starred resources in the current workspace for a given type", "tags": [ "User" ], @@ -13047,7 +13047,7 @@ "ApiKeyAuth": [] } ], - "description": "List all vector stores for the current tenant, including environment-configured and user-created stores", + "description": "List all vector stores for the current workspace, including environment-configured and user-created stores", "produces": [ "application/json" ], @@ -13081,7 +13081,7 @@ "ApiKeyAuth": [] } ], - "description": "Create a new vector store configuration for the current tenant", + "description": "Create a new vector store configuration for the current workspace", "consumes": [ "application/json" ], @@ -13845,7 +13845,7 @@ "ApiKeyAuth": [] } ], - "description": "保存 APPID/APPSECRET 到当前租户配置(不自动创建模型)", + "description": "保存 APPID/APPSECRET 到当前空间配置(不自动创建模型)", "consumes": [ "application/json" ], @@ -14669,7 +14669,7 @@ "type": "integer" }, "image_storage_provider": { - "description": "Storage provider for image uploads: \"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\".\nEmpty means use the global/tenant default provider.", + "description": "Storage provider for image uploads: \"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\".\nEmpty means use the global/workspace default provider.", "type": "string" }, "image_upload_enabled": { @@ -14812,7 +14812,7 @@ "type": "number" }, "vlm_model_id": { - "description": "VLM model ID for image analysis (optional, falls back to tenant-level VLM)", + "description": "VLM model ID for image analysis (optional, falls back to workspace-level VLM)", "type": "string" }, "web_fetch_enabled": { @@ -14832,7 +14832,7 @@ "type": "integer" }, "web_search_provider_id": { - "description": "WebSearchProviderID references a specific WebSearchProviderEntity.\nIf empty, the tenant's default provider (is_default=true) is used.", + "description": "WebSearchProviderID references a specific WebSearchProviderEntity.\nIf empty, the workspace's default provider (is_default=true) is used.", "type": "string" } } @@ -14926,7 +14926,7 @@ "type": "string" }, "tenant_id": { - "description": "Tenant ID for multi-tenancy", + "description": "Workspace ID for multi-workspace isolation", "type": "integer" }, "total_items_synced": { @@ -15359,7 +15359,7 @@ ], "properties": { "representative_user_id": { - "description": "RepresentativeUserID identifies the user attached to the OTM row for\ndisplay/audit. Optional: when unset, the handler picks a stable default\n(the user from the legacy UserID field, or the tenant's owner).", + "description": "RepresentativeUserID identifies the user attached to the OTM row for\ndisplay/audit. Optional: when unset, the handler picks a stable default\n(the user from the legacy UserID field, or the workspace's owner).", "type": "string" }, "role": { @@ -15371,7 +15371,7 @@ ] }, "tenant_id": { - "description": "TenantID is the tenant to enrol as an org member. Preferred field.", + "description": "TenantID is the workspace to enrol as an org member. Preferred field.", "type": "integer" }, "user_id": { @@ -15568,7 +15568,7 @@ } }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "title": { @@ -15613,11 +15613,11 @@ "type": "string" }, "creator_id": { - "description": "CreatorID records the user ID of whoever originally created the KB.\nUsed by the tenant-level RBAC middleware to let Contributors edit\ntheir own KBs without granting them access to everyone else's.\nNullable for backward compatibility with rows created before the\nRBAC migration backfilled the column to the tenant Owner.", + "description": "CreatorID records the user ID of whoever originally created the KB.\nUsed by the workspace-level RBAC middleware to let Contributors edit\ntheir own KBs without granting them access to everyone else's.\nNullable for backward compatibility with rows created before the\nRBAC migration backfilled the column to the workspace Owner.", "type": "string" }, "creator_name": { - "description": "CreatorName 是 CreatorID 对应用户的展示名(username / email 等),\n仅在列表场景由 handler 批量回填,不落库;为空表示创建者无法解析(用户已删除、\nCreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs tenant 的二分。", + "description": "CreatorName 是 CreatorID 对应用户的展示名(username / email 等),\n仅在列表场景由 handler 批量回填,不落库;为空表示创建者无法解析(用户已删除、\nCreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs workspace 的二分。", "type": "string" }, "deleted_at": { @@ -15673,7 +15673,7 @@ ] }, "is_pinned": { - "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a tenant-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged `gorm:\"-\"` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", + "description": "IsPinned and PinnedAt are computed per-caller from user_kb_pins\n(see migration 000050). They used to be stored on the row itself,\nwhich made pinning a workspace-wide ordering decision gated behind\nthe kb-edit RBAC guard. The columns are still present in legacy\nschemas for rollback safety but are no longer read or written by\nthe application — both fields are tagged `gorm:\"-\"` so GORM\nignores them on every CRUD call and the list handler stamps them\nafter enriching with the caller's pin set.", "type": "boolean" }, "is_processing": { @@ -15721,7 +15721,7 @@ ] }, "storage_provider_config": { - "description": "Storage provider config (new): only stores provider selection; credentials from tenant StorageEngineConfig", + "description": "Storage provider config (new): only stores provider selection; credentials from workspace StorageEngineConfig", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StorageProviderConfig" @@ -15733,7 +15733,7 @@ "type": "string" }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "type": { @@ -15745,7 +15745,7 @@ "type": "string" }, "vector_store_id": { - "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the tenant's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (`\u003c-:create`) plus the service-layer\nKB update path, which omits this field from its update DTO.", + "description": "VectorStoreID references the VectorStore this knowledge base is bound to.\nWhen nil, the KB falls back to the workspace's effective engines derived from\nthe RETRIEVE_DRIVER environment variable (env store flow).\nThis field is set once at creation time and must not be modified afterwards;\nenforcement lives at the GORM layer (`\u003c-:create`) plus the service-layer\nKB update path, which omits this field from its update DTO.", "type": "string" }, "vlm_config": { @@ -15935,7 +15935,7 @@ "type": "boolean" }, "parser_engine_overrides": { - "description": "ParserEngineOverrides passes key-value configuration to docreader parsers\n(e.g. pdf_force_scanned=true). Merged with tenant-level overrides in the\nparse pipeline; per-upload values take priority on conflict.", + "description": "ParserEngineOverrides passes key-value configuration to docreader parsers\n(e.g. pdf_force_scanned=true). Merged with workspace-level overrides in the\nparse pipeline; per-upload values take priority on conflict.", "type": "object", "additionalProperties": { "type": "string" @@ -15987,7 +15987,7 @@ "type": "integer" }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "updated_at": { @@ -16074,7 +16074,7 @@ "type": "object", "properties": { "active_tenant": { - "description": "ActiveTenant is the tenant whose ID is encoded in the issued JWT;\nfuture requests are scoped to it until the client calls /auth/switch-tenant.\nDefaults to the user's home tenant on a fresh login.", + "description": "ActiveTenant is the workspace whose ID is encoded in the issued JWT;\nfuture requests are scoped to it until the client calls /auth/switch-tenant.\nDefaults to the user's home workspace on a fresh login.", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Tenant" @@ -16082,7 +16082,7 @@ ] }, "memberships": { - "description": "Memberships lists every tenant the user can authenticate into,\nalong with their role in each. Always populated (length 1 for users\nwho only belong to their home tenant) so frontends can render a\ntenant switcher without a follow-up request. Serialised without\nomitempty so the field is always present as a JSON array (possibly\nempty) — the \"always populated\" contract relies on the server side\nguaranteeing a non-nil slice.", + "description": "Memberships lists every workspace the user can authenticate into,\nalong with their role in each. Always populated (length 1 for users\nwho only belong to their home workspace) so frontends can render a\nworkspace switcher without a follow-up request. Serialised without\nomitempty so the field is always present as a JSON array (possibly\nempty) — the \"always populated\" contract relies on the server side\nguaranteeing a non-nil slice.", "type": "array", "items": { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.Membership" @@ -16225,7 +16225,7 @@ "type": "string" }, "is_builtin": { - "description": "Whether this is a builtin MCP service (visible to all tenants)", + "description": "Whether this is a builtin MCP service (visible to all workspaces)", "type": "boolean" }, "name": { @@ -16947,7 +16947,7 @@ "type": "string" }, "owner_tenant_id": { - "description": "OwnerTenantID is the persisted owner tenant of the organization\n(Plan 3, migration 000046). Frontend uses this to identify the\n\"owner row\" in the tenant-keyed members list — comparing\nmember.tenant_id against owner_tenant_id is the post-Plan-3\nequivalent of the old member.user_id == owner_id check.", + "description": "OwnerTenantID is the persisted owner workspace of the organization\n(Plan 3, migration 000046). Frontend uses this to identify the\n\"owner row\" in the workspace-keyed members list — comparing\nmember.tenant_id against owner_tenant_id is the post-Plan-3\nequivalent of the old member.user_id == owner_id check.", "type": "integer" }, "pending_join_request_count": { @@ -17778,7 +17778,7 @@ "type": "string" }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "title": { @@ -18068,7 +18068,7 @@ "type": "string" }, "tenant_id": { - "description": "Tenant ID", + "description": "Workspace ID", "type": "integer" }, "updated_at": { @@ -18172,7 +18172,7 @@ ] }, "context_config": { - "description": "Global Context configuration for this tenant (default for all sessions)", + "description": "Global Context configuration for this workspace (default for all sessions)", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.ContextConfig" @@ -18260,7 +18260,7 @@ "type": "string" }, "web_search_config": { - "description": "Global WebSearch configuration for this tenant", + "description": "Global WebSearch configuration for this workspace", "allOf": [ { "$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchConfig" @@ -18428,7 +18428,7 @@ "type": "string" }, "can_access_all_tenants": { - "description": "Whether the user can access all tenants (cross-tenant access)", + "description": "Whether the user can access all workspaces (cross-workspace access)", "type": "boolean" }, "created_at": { @@ -18456,7 +18456,7 @@ "type": "boolean" }, "is_system_admin": { - "description": "Whether the user is a system administrator (independent of tenant roles)", + "description": "Whether the user is a system administrator (independent of workspace roles)", "type": "boolean" }, "preferences": { @@ -18476,7 +18476,7 @@ ] }, "tenant_id": { - "description": "Tenant ID that the user belongs to", + "description": "Workspace ID that the user belongs to", "type": "integer" }, "updated_at": { @@ -18535,7 +18535,7 @@ "type": "boolean" }, "last_active_tenant_id": { - "description": "LastActiveTenantID remembers the last tenant the user actively\nswitched into, so a fresh login (new device, cleared browser, new\nrefresh token) lands them back in that workspace instead of always\nbouncing to their home tenant. Login / RefreshToken validate that\nthe tenant still exists and the user still has an active membership\n(or CanAccessAllTenants) before honouring this preference; an\ninvalid pointer is best-effort cleared and the user falls back to\nhome.\n\nnil = no preference (use user.TenantID, i.e. home)\n*0 = \"clear preference\" sentinel for the partial-update endpoint\n (UpdateUserPreferences turns this into nil). Otherwise treat\n a stored *0 the same as nil.\n*N = preferred tenant id.", + "description": "LastActiveTenantID remembers the last workspace the user actively\nswitched into, so a fresh login (new device, cleared browser, new\nrefresh token) lands them back in that workspace instead of always\nbouncing to their home workspace. Login / RefreshToken validate that\nthe workspace still exists and the user still has an active membership\n(or CanAccessAllTenants) before honouring this preference; an\ninvalid pointer is best-effort cleared and the user falls back to\nhome.\n\nnil = no preference (use user.TenantID, i.e. home)\n*0 = \"clear preference\" sentinel for the partial-update endpoint\n (UpdateUserPreferences turns this into nil). Otherwise treat\n a stored *0 the same as nil.\n*N = preferred workspace id.", "type": "integer" } } @@ -18657,7 +18657,7 @@ "type": "string" }, "is_default": { - "description": "Whether this is the default provider for the tenant", + "description": "Whether this is the default provider for the workspace", "type": "boolean" }, "name": { @@ -18681,7 +18681,7 @@ ] }, "tenant_id": { - "description": "Tenant ID for scoping", + "description": "Workspace ID for scoping", "type": "integer" }, "updated_at": { @@ -19106,7 +19106,7 @@ "type": "string" }, "tenant_id": { - "description": "Tenant scope, mirrored from the enclosing knowledge base.", + "description": "Workspace scope, mirrored from the enclosing knowledge base.", "type": "integer" } } @@ -19245,7 +19245,7 @@ "type": "string" }, "tenant_id": { - "description": "Tenant ID for multi-tenant isolation", + "description": "Workspace ID for multi-workspace isolation", "type": "integer" }, "title": { @@ -20393,7 +20393,7 @@ } }, "internal_handler.RuntimeWorkerPool": { - "description": "Return every row in the system_settings table (system-scope, not tenant-scope). SystemAdmin only.", + "description": "Return every row in the system_settings table (system-scope, not workspace-scoped). SystemAdmin only.", "type": "object", "properties": { "active": { @@ -20950,7 +20950,7 @@ "type": "boolean" }, "last_active_tenant_id": { - "description": "LastActiveTenantID lets the SPA persist \"after a fresh login,\ndrop me back into this workspace\" across devices. Send a positive\ntenant id to set / replace, or 0 to clear. Membership is validated\nat next login, not here. Nil = field omitted from the PATCH and\nstays untouched.", + "description": "LastActiveTenantID lets the SPA persist \"after a fresh login,\ndrop me back into this workspace\" across devices. Send a positive\nworkspace id to set / replace, or 0 to clear. Membership is validated\nat next login, not here. Nil = field omitted from the PATCH and\nstays untouched.", "type": "integer" } } @@ -20983,7 +20983,7 @@ "type": "boolean" }, "agent_id": { - "description": "Selected custom agent ID (backend resolves shared agent and its tenant from share relation)", + "description": "Selected custom agent ID (backend resolves shared agent and its workspace from share relation)", "type": "string" }, "attachment_uploads": { @@ -21223,7 +21223,7 @@ }, "securityDefinitions": { "ApiKeyAuth": { - "description": "租户身份认证:输入 sk- 开头的 API Key", + "description": "空间身份认证:输入 sk- 开头的 API Key", "type": "apiKey", "name": "X-API-Key", "in": "header" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 28c62a23..0ddbc861 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -651,7 +651,7 @@ definitions: image_storage_provider: description: |- Storage provider for image uploads: "local", "minio", "cos", "tos", "s3", "oss", "ks3". - Empty means use the global/tenant default provider. + Empty means use the global/workspace default provider. type: string image_upload_enabled: description: |- @@ -792,7 +792,7 @@ definitions: description: Vector retrieval threshold type: number vlm_model_id: - description: VLM model ID for image analysis (optional, falls back to tenant-level + description: VLM model ID for image analysis (optional, falls back to workspace-level VLM) type: string web_fetch_enabled: @@ -813,7 +813,7 @@ definitions: web_search_provider_id: description: |- WebSearchProviderID references a specific WebSearchProviderEntity. - If empty, the tenant's default provider (is_default=true) is used. + If empty, the workspace's default provider (is_default=true) is used. type: string type: object github_com_Tencent_WeKnora_internal_types.DataSource: @@ -881,7 +881,7 @@ definitions: 6 hours) type: string tenant_id: - description: Tenant ID for multi-tenancy + description: Workspace ID for multi-workspace isolation type: integer total_items_synced: description: Total items synced (not stored in DB, calculated on query) @@ -1186,14 +1186,15 @@ definitions: description: |- RepresentativeUserID identifies the user attached to the OTM row for display/audit. Optional: when unset, the handler picks a stable default - (the user from the legacy UserID field, or the tenant's owner). + (the user from the legacy UserID field, or the workspace's owner). type: string role: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.OrgMemberRole' description: 'Role to assign: admin/editor/viewer' tenant_id: - description: TenantID is the tenant to enrol as an org member. Preferred field. + description: TenantID is the workspace to enrol as an org member. Preferred + field. type: integer user_id: description: |- @@ -1343,7 +1344,7 @@ definitions: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.KnowledgeTag' type: array tenant_id: - description: Tenant ID + description: Workspace ID type: integer title: description: Title of the knowledge @@ -1374,16 +1375,16 @@ definitions: creator_id: description: |- CreatorID records the user ID of whoever originally created the KB. - Used by the tenant-level RBAC middleware to let Contributors edit + Used by the workspace-level RBAC middleware to let Contributors edit their own KBs without granting them access to everyone else's. Nullable for backward compatibility with rows created before the - RBAC migration backfilled the column to the tenant Owner. + RBAC migration backfilled the column to the workspace Owner. type: string creator_name: description: |- CreatorName 是 CreatorID 对应用户的展示名(username / email 等), 仅在列表场景由 handler 批量回填,不落库;为空表示创建者无法解析(用户已删除、 - CreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs tenant 的二分。 + CreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs workspace 的二分。 type: string deleted_at: allOf: @@ -1421,7 +1422,7 @@ definitions: description: |- IsPinned and PinnedAt are computed per-caller from user_kb_pins (see migration 000050). They used to be stored on the row itself, - which made pinning a tenant-wide ordering decision gated behind + which made pinning a workspace-wide ordering decision gated behind the kb-edit RBAC guard. The columns are still present in legacy schemas for rollback safety but are no longer read or written by the application — both fields are tagged `gorm:"-"` so GORM @@ -1469,12 +1470,12 @@ definitions: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.StorageProviderConfig' description: 'Storage provider config (new): only stores provider selection; - credentials from tenant StorageEngineConfig' + credentials from workspace StorageEngineConfig' summary_model_id: description: Summary model ID type: string tenant_id: - description: Tenant ID + description: Workspace ID type: integer type: description: Type of the knowledge base (document, faq, etc.) @@ -1485,7 +1486,7 @@ definitions: vector_store_id: description: |- VectorStoreID references the VectorStore this knowledge base is bound to. - When nil, the KB falls back to the tenant's effective engines derived from + When nil, the KB falls back to the workspace's effective engines derived from the RETRIEVE_DRIVER environment variable (env store flow). This field is set once at creation time and must not be modified afterwards; enforcement lives at the GORM layer (`<-:create`) plus the service-layer @@ -1616,7 +1617,7 @@ definitions: type: string description: |- ParserEngineOverrides passes key-value configuration to docreader parsers - (e.g. pdf_force_scanned=true). Merged with tenant-level overrides in the + (e.g. pdf_force_scanned=true). Merged with workspace-level overrides in the parse pipeline; per-upload values take priority on conflict. type: object parser_engine_rules: @@ -1652,7 +1653,7 @@ definitions: description: Sort order within the same knowledge base type: integer tenant_id: - description: Tenant ID + description: Workspace ID type: integer updated_at: description: Last updated time @@ -1711,15 +1712,15 @@ definitions: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.Tenant' description: |- - ActiveTenant is the tenant whose ID is encoded in the issued JWT; + ActiveTenant is the workspace whose ID is encoded in the issued JWT; future requests are scoped to it until the client calls /auth/switch-tenant. - Defaults to the user's home tenant on a fresh login. + Defaults to the user's home workspace on a fresh login. memberships: description: |- - Memberships lists every tenant the user can authenticate into, + Memberships lists every workspace the user can authenticate into, along with their role in each. Always populated (length 1 for users - who only belong to their home tenant) so frontends can render a - tenant switcher without a follow-up request. Serialised without + who only belong to their home workspace) so frontends can render a + workspace switcher without a follow-up request. Serialised without omitempty so the field is always present as a JSON array (possibly empty) — the "always populated" contract relies on the server side guaranteeing a non-nil slice. @@ -1829,7 +1830,7 @@ definitions: id: type: string is_builtin: - description: Whether this is a builtin MCP service (visible to all tenants) + description: Whether this is a builtin MCP service (visible to all workspaces) type: boolean name: type: string @@ -2385,9 +2386,9 @@ definitions: type: string owner_tenant_id: description: |- - OwnerTenantID is the persisted owner tenant of the organization + OwnerTenantID is the persisted owner workspace of the organization (Plan 3, migration 000046). Frontend uses this to identify the - "owner row" in the tenant-keyed members list — comparing + "owner row" in the workspace-keyed members list — comparing member.tenant_id against owner_tenant_id is the post-Plan-3 equivalent of the old member.user_id == owner_id check. type: integer @@ -3008,7 +3009,7 @@ definitions: description: PinnedAt records when the session was pinned; nil when not pinned. type: string tenant_id: - description: Tenant ID + description: Workspace ID type: integer title: description: Title @@ -3211,7 +3212,7 @@ definitions: description: 'Sync status: running, success, partial, failed, canceled' type: string tenant_id: - description: Tenant ID + description: Workspace ID type: integer updated_at: description: Last update timestamp @@ -3305,8 +3306,8 @@ definitions: context_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.ContextConfig' - description: Global Context configuration for this tenant (default for all - sessions) + description: Global Context configuration for this workspace (default for + all sessions) created_at: description: Creation time type: string @@ -3363,7 +3364,7 @@ definitions: web_search_config: allOf: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchConfig' - description: Global WebSearch configuration for this tenant + description: Global WebSearch configuration for this workspace type: object github_com_Tencent_WeKnora_internal_types.TenantRole: enum: @@ -3476,7 +3477,7 @@ definitions: description: Avatar URL of the user type: string can_access_all_tenants: - description: Whether the user can access all tenants (cross-tenant access) + description: Whether the user can access all workspaces (cross-workspace access) type: boolean created_at: description: Creation time of the user @@ -3495,7 +3496,7 @@ definitions: description: Whether the user is active type: boolean is_system_admin: - description: Whether the user is a system administrator (independent of tenant + description: Whether the user is a system administrator (independent of workspace roles) type: boolean preferences: @@ -3510,7 +3511,7 @@ definitions: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.Tenant' description: Association relationship, not stored in the database tenant_id: - description: Tenant ID that the user belongs to + description: Workspace ID that the user belongs to type: integer updated_at: description: Last updated time of the user @@ -3554,11 +3555,11 @@ definitions: type: boolean last_active_tenant_id: description: |- - LastActiveTenantID remembers the last tenant the user actively + LastActiveTenantID remembers the last workspace the user actively switched into, so a fresh login (new device, cleared browser, new refresh token) lands them back in that workspace instead of always - bouncing to their home tenant. Login / RefreshToken validate that - the tenant still exists and the user still has an active membership + bouncing to their home workspace. Login / RefreshToken validate that + the workspace still exists and the user still has an active membership (or CanAccessAllTenants) before honouring this preference; an invalid pointer is best-effort cleared and the user falls back to home. @@ -3567,7 +3568,7 @@ definitions: *0 = "clear preference" sentinel for the partial-update endpoint (UpdateUserPreferences turns this into nil). Otherwise treat a stored *0 the same as nil. - *N = preferred tenant id. + *N = preferred workspace id. type: integer type: object github_com_Tencent_WeKnora_internal_types.VLMConfig: @@ -3661,7 +3662,7 @@ definitions: description: Unique identifier (UUID, auto-generated) type: string is_default: - description: Whether this is the default provider for the tenant + description: Whether this is the default provider for the workspace type: boolean name: description: User-friendly name, e.g., "Production Bing Search" @@ -3676,7 +3677,7 @@ definitions: - $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.WebSearchProviderType' description: 'Provider type: bing, google, duckduckgo, tavily' tenant_id: - description: Tenant ID for scoping + description: Workspace ID for scoping type: integer updated_at: type: string @@ -4015,7 +4016,7 @@ definitions: logged. type: string tenant_id: - description: Tenant scope, mirrored from the enclosing knowledge base. + description: Workspace scope, mirrored from the enclosing knowledge base. type: integer type: object github_com_Tencent_WeKnora_internal_types.WikiLogEntryListResponse: @@ -4139,7 +4140,7 @@ definitions: description: One-line summary for index listing type: string tenant_id: - description: Tenant ID for multi-tenant isolation + description: Workspace ID for multi-workspace isolation type: integer title: description: Human-readable title @@ -4942,7 +4943,7 @@ definitions: type: object internal_handler.RuntimeWorkerPool: description: Return every row in the system_settings table (system-scope, not - tenant-scope). SystemAdmin only. + workspace-scoped). SystemAdmin only. properties: active: description: live workers assigned to this pool @@ -5319,7 +5320,7 @@ definitions: description: |- LastActiveTenantID lets the SPA persist "after a fresh login, drop me back into this workspace" across devices. Send a positive - tenant id to set / replace, or 0 to clear. Membership is validated + workspace id to set / replace, or 0 to clear. Membership is validated at next login, not here. Nil = field omitted from the PATCH and stays untouched. type: integer @@ -5343,7 +5344,7 @@ definitions: type: boolean agent_id: description: Selected custom agent ID (backend resolves shared agent and its - tenant from share relation) + workspace from share relation) type: string attachment_uploads: description: Attached files (documents, audio, etc.) @@ -5641,7 +5642,7 @@ paths: get: consumes: - application/json - description: 获取当前租户的所有智能体(包括内置智能体) + description: 获取当前空间的所有智能体(包括内置智能体) produces: - application/json responses: @@ -5976,7 +5977,7 @@ paths: post: consumes: - application/json - description: Lite 版专用:首次启动时自动创建默认用户和租户并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程 + description: Lite 版专用:首次启动时自动创建默认用户和空间并返回令牌,后续启动直接签发令牌,免除手动注册/登录流程 produces: - application/json responses: @@ -6046,7 +6047,7 @@ paths: consumes: - application/json description: |- - 根据邀请链接中的 token 返回邀请上下文(租户名 / 角色 / 过期时间), + 根据邀请链接中的 token 返回邀请上下文(空间名 / 角色 / 过期时间), 供注册页展示。无认证;token 无效或被撤销返回 410。 使用 POST + body 而非 GET + path,避免 token 落入访问日志 / 浏览器历史 / tracing。 parameters: @@ -6311,7 +6312,7 @@ paths: - application/json description: |- 通过 Owner 生成的共享邀请链接 token 完成注册,绕过 invite_only 模式拦截。 - 注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应租户。 + 注册者自填邮箱(与 token 不绑定);注册成功后自动加入对应空间。 parameters: - description: 邀请注册请求 in: body @@ -6345,7 +6346,7 @@ paths: post: consumes: - application/json - description: 为当前用户在目标租户重新签发访问令牌;要求该用户在目标租户存在 active 成员关系 + description: 为当前用户在目标空间重新签发访问令牌;要求该用户在目标空间存在 active 成员关系 parameters: - description: 切换请求 in: body @@ -6370,12 +6371,12 @@ paths: schema: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' "403": - description: 无该租户成员关系 + description: 无该空间成员关系 schema: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 切换激活租户 + summary: 切换激活空间 tags: - 认证 /auth/validate: @@ -7835,7 +7836,7 @@ paths: get: consumes: - application/json - description: 获取当前租户的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及) + description: 获取当前空间的所有知识库;或当传入 agent_id(共享智能体)时,校验权限后返回该智能体配置的知识库范围(用于 @ 提及) parameters: - description: 共享智能体 ID(传入时返回该智能体可用的知识库) in: query @@ -9433,7 +9434,7 @@ paths: get: consumes: - application/json - description: 根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的租户解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属租户查询(用于刷新后恢复共享知识库下的文件) + description: 根据ID列表批量获取知识条目。可选 kb_id:指定时按该知识库校验权限并用于共享知识库的空间解析;可选 agent_id:使用共享智能体时传此参数,后端按智能体所属空间查询(用于刷新后恢复共享知识库下的文件) parameters: - collectionFormat: csv description: 知识ID列表 @@ -9447,7 +9448,7 @@ paths: in: query name: kb_id type: string - - description: 可选,共享智能体ID(用于按智能体租户批量拉取文件详情) + - description: 可选,共享智能体ID(用于按智能体空间批量拉取文件详情) in: query name: agent_id type: string @@ -9724,7 +9725,7 @@ paths: put: consumes: - application/json - description: 批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的租户解析 + description: 批量更新知识条目的标签。可选 kb_id:指定时按该知识库校验编辑权限并用于共享知识库的空间解析 parameters: - description: 标签更新请求(updates 必填,kb_id 可选) in: body @@ -10411,7 +10412,7 @@ paths: get: consumes: - application/json - description: 获取当前租户的所有MCP服务 + description: 获取当前空间的所有MCP服务 produces: - application/json responses: @@ -11059,7 +11060,7 @@ paths: get: consumes: - application/json - description: 获取当前租户的所有模型 + description: 获取当前空间的所有模型 produces: - application/json responses: @@ -11224,7 +11225,7 @@ paths: - 模型管理 /models/weknoracloud/status: get: - description: 检查当前租户的 WeKnoraCloud 凭证是否完好;needs_reinit=true 表示需要重新保存 + description: 检查当前空间的 WeKnoraCloud 凭证是否完好;needs_reinit=true 表示需要重新保存 produces: - application/json responses: @@ -11246,7 +11247,7 @@ paths: - WeKnoraCloud /organizations: get: - description: 获取当前租户所属的所有组织,并附带各空间内知识库/智能体数量 + description: 获取当前空间所属的所有组织,并附带各空间内知识库/智能体数量 produces: - application/json responses: @@ -11551,7 +11552,7 @@ paths: - 组织管理 /organizations/{id}/members: get: - description: 获取组织的所有成员(按租户) + description: 获取组织的所有成员(按空间) parameters: - description: 组织ID in: path @@ -11572,14 +11573,14 @@ paths: - 组织管理 /organizations/{id}/members/{tenant_id}: delete: - description: 从组织中移除成员租户(需要管理员权限) + description: 从组织中移除成员空间(需要管理员权限) parameters: - description: 组织ID in: path name: id required: true type: string - - description: 成员租户ID + - description: 成员空间ID in: path name: tenant_id required: true @@ -11602,14 +11603,14 @@ paths: put: consumes: - application/json - description: 更新组织成员(租户)的角色(需要管理员权限) + description: 更新组织成员(空间)的角色(需要管理员权限) parameters: - description: 组织ID in: path name: id required: true type: string - - description: 成员租户ID + - description: 成员空间ID in: path name: tenant_id required: true @@ -11673,14 +11674,14 @@ paths: - 组织管理 /organizations/{id}/search-tenants: get: - description: 搜索租户(排除已加入的租户)用于邀请加入组织;按租户去重,附带代表用户 + description: 搜索空间(排除已加入的空间)用于邀请加入组织;按空间去重,附带代表用户 parameters: - description: 组织ID in: path name: id required: true type: string - - description: 搜索关键词(租户名、用户名或邮箱) + - description: 搜索关键词(空间名、用户名或邮箱) in: query name: q required: true @@ -11704,7 +11705,7 @@ paths: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 搜索可邀请的租户 + summary: 搜索可邀请的空间 tags: - 组织管理 /organizations/{id}/search-users: @@ -11919,7 +11920,7 @@ paths: get: consumes: - application/json - description: 获取当前租户的会话列表,支持分页、关键字搜索、按来源/Agent 筛选 + description: 获取当前空间的会话列表,支持分页、关键字搜索、按来源/Agent 筛选 parameters: - description: 页码 in: query @@ -12402,7 +12403,7 @@ paths: delete: consumes: - application/json - description: 根据ID列表批量删除对话会话,或设置 delete_all=true 删除当前租户的所有会话 + description: 根据ID列表批量删除对话会话,或设置 delete_all=true 删除当前空间的所有会话 parameters: - description: 批量删除请求 in: body @@ -12904,7 +12905,7 @@ paths: Reads the current value of `tenant.default_storage_quota_gb` (3-tier resolver: DB > ENV > default) and writes that many GiB into storage_quota for every row in tenants. Bypasses - the per-tenant PUT whitelist, which forbids storage_quota + the per-workspace PUT whitelist, which forbids storage_quota edits by Owners. SystemAdmin only. Idempotent — running twice with the same setting is a no-op. produces: @@ -12920,7 +12921,7 @@ paths: schema: additionalProperties: true type: object - summary: Apply the default storage quota to every existing tenant + summary: Apply the default storage quota to every existing workspace tags: - System Admin /system/admin/users/reset-password: @@ -13068,12 +13069,12 @@ paths: get: consumes: - application/json - description: 获取当前用户可访问的租户列表 + description: 获取当前用户可访问的空间列表 produces: - application/json responses: "200": - description: 租户列表 + description: 空间列表 schema: additionalProperties: true type: object @@ -13083,20 +13084,20 @@ paths: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 获取租户列表 + summary: 获取空间列表 tags: - - 租户管理 + - 空间管理 post: consumes: - application/json description: |- - 创建新的租户。任意已登录用户均可调用以建立自己的新工作区, - 调用方会被自动设为该租户的 Owner。跨租户超管仍可像以前一样 - 通过本接口创建任意租户。 + 创建新的空间。任意已登录用户均可调用以建立自己的新工作区, + 调用方会被自动设为该空间的 Owner。跨空间超管仍可像以前一样 + 通过本接口创建任意空间。 当 tenant.auto_create_api_key(或 WEKNORA_TENANT_AUTO_CREATE_API_KEY) 开启时,会自动创建一个 full_access API Key,并在响应体的 data.api_key 字段返回其明文 token。 parameters: - - description: 租户信息 + - description: 空间信息 in: body name: request required: true @@ -13106,7 +13107,7 @@ paths: - application/json responses: "201": - description: 创建的租户(可选含 api_key) + description: 创建的空间(可选含 api_key) schema: additionalProperties: true type: object @@ -13116,16 +13117,16 @@ paths: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 创建租户 + summary: 创建空间 tags: - - 租户管理 + - 空间管理 /tenants/{id}: delete: consumes: - application/json - description: 删除指定的租户 + description: 删除指定的空间 parameters: - - description: 租户ID + - description: 空间ID in: path name: id required: true @@ -13144,15 +13145,15 @@ paths: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 删除租户 + summary: 删除空间 tags: - - 租户管理 + - 空间管理 get: consumes: - application/json - description: 根据ID获取租户详情 + description: 根据ID获取空间详情 parameters: - - description: 租户ID + - description: 空间ID in: path name: id required: true @@ -13161,7 +13162,7 @@ paths: - application/json responses: "200": - description: 租户详情 + description: 空间详情 schema: additionalProperties: true type: object @@ -13170,26 +13171,26 @@ paths: schema: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' "404": - description: 租户不存在 + description: 空间不存在 schema: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - ApiKeyAuth: [] - summary: 获取租户详情 + summary: 获取空间详情 tags: - - 租户管理 + - 空间管理 put: consumes: - application/json - description: 更新租户信息 + description: 更新空间信息 parameters: - - description: 租户ID + - description: 空间ID in: path name: id required: true type: integer - - description: 租户信息 + - description: 空间信息 in: body name: request required: true @@ -13199,7 +13200,7 @@ paths: - application/json responses: "200": - description: 更新后的租户 + description: 更新后的空间 schema: additionalProperties: true type: object @@ -13209,16 +13210,16 @@ paths: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 更新租户 + summary: 更新空间 tags: - - 租户管理 + - 空间管理 /tenants/{id}/api-principal-config: get: consumes: - application/json description: 返回 X-API-Key 请求如何映射为终端 Principal 的配置(Owner) parameters: - - description: 租户ID + - description: 空间ID in: path name: id required: true @@ -13241,15 +13242,15 @@ paths: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 获取租户 API Key 用户身份配置 + summary: 获取空间 API Key 用户身份配置 tags: - - 租户管理 + - 空间管理 put: consumes: - application/json description: 配置 X-API-Key 请求如何映射为终端 Principal(Owner) parameters: - - description: 租户ID + - description: 空间ID in: path name: id required: true @@ -13278,16 +13279,16 @@ paths: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 更新租户 API Key 用户身份配置 + summary: 更新空间 API Key 用户身份配置 tags: - - 租户管理 + - 空间管理 /tenants/{id}/api-principal-test-token: post: consumes: - application/json - description: 使用租户已保存的 HMAC 密钥签发短期外部用户 JWT(Owner) + description: 使用空间已保存的 HMAC 密钥签发短期外部用户 JWT(Owner) parameters: - - description: 租户ID + - description: 空间ID in: path name: id required: true @@ -13318,12 +13319,12 @@ paths: - Bearer: [] summary: 生成 API Playground 测试 JWT tags: - - 租户管理 + - 空间管理 /tenants/{id}/audit-log: get: - description: 返回该租户最近的审计事件,按 id 倒序。游标分页:将上次响应的 next_cursor 作为下一次请求的 after_id。 + description: 返回该空间最近的审计事件,按 id 倒序。游标分页:将上次响应的 next_cursor 作为下一次请求的 after_id。 parameters: - - description: 租户ID + - description: 空间ID in: path name: id required: true @@ -13362,14 +13363,14 @@ paths: security: - Bearer: [] - ApiKeyAuth: [] - summary: 获取租户审计日志 + summary: 获取空间审计日志 tags: - 审计日志 /tenants/{id}/invitations: get: - description: 按 tenant 列出待接受 / 历史邀请。query include_terminal=true 时附带 accepted/declined/revoked/expired。 + description: 按空间列出待接受 / 历史邀请。query include_terminal=true 时附带 accepted/declined/revoked/expired。 parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13398,15 +13399,15 @@ paths: type: object security: - Bearer: [] - summary: 列出租户邀请 + summary: 列出空间邀请 tags: - - 租户邀请 + - 空间邀请 post: consumes: - application/json - description: Owner 通过邮箱邀请已注册用户加入当前租户;被邀请人需要在 /me/invitations 接受后才会成为成员。 + description: Owner 通过邮箱邀请已注册用户加入当前空间;被邀请人需要在 /me/invitations 接受后才会成为成员。 parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13427,14 +13428,14 @@ paths: type: object security: - Bearer: [] - summary: 发出租户邀请 + summary: 发出空间邀请 tags: - - 租户邀请 + - 空间邀请 /tenants/{id}/invitations/{inv_id}: delete: description: Owner 取消一条还在 pending 的邀请;已 accepted/declined/revoked/expired 的行不可再撤销。 parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13456,16 +13457,16 @@ paths: - Bearer: [] summary: 撤销待接受邀请 tags: - - 租户邀请 + - 空间邀请 /tenants/{id}/invite-links: post: consumes: - application/json description: |- - 生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前租户。 + 生成一条多次使用的共享邀请链接:谁拿到链接谁就能注册并加入当前空间。 链接持续有效,直到过期或被撤销。 parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13488,12 +13489,12 @@ paths: - Bearer: [] summary: 生成共享邀请链接 tags: - - 租户邀请 + - 空间邀请 /tenants/{id}/leave: post: - description: 调用方主动退出当前租户。等价于以自己的 user_id 调 RemoveMember, + description: 调用方主动退出当前空间。等价于以自己的 user_id 调 RemoveMember, parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13508,14 +13509,14 @@ paths: type: object security: - Bearer: [] - summary: 退出当前租户 + summary: 退出当前空间 tags: - - 租户成员 + - 空间成员 /tenants/{id}/members: get: - description: 分页返回当前租户内 active 成员(含每位成员的角色、邮箱、头像);支持 q 按邮箱/用户名筛选 + description: 分页返回当前空间内 active 成员(含每位成员的角色、邮箱、头像);支持 q 按邮箱/用户名筛选 parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13544,14 +13545,14 @@ paths: type: object security: - Bearer: [] - summary: 列出租户成员 + summary: 列出空间成员 tags: - - 租户成员 + - 空间成员 post: consumes: - application/json parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13572,14 +13573,14 @@ paths: type: object security: - Bearer: [] - summary: 直接添加租户成员(直加路径) + summary: 直接添加空间成员(直加路径) tags: - - 租户成员 + - 空间成员 /tenants/{id}/members/{user_id}: delete: - description: Owner 将某位成员从当前租户中移除(软删除 tenant_members 行);不能移除最后一位 Owner + description: Owner 将某位成员从当前空间中移除(软删除 tenant_members 行);不能移除最后一位 Owner parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13599,15 +13600,15 @@ paths: type: object security: - Bearer: [] - summary: 移除租户成员 + summary: 移除空间成员 tags: - - 租户成员 + - 空间成员 put: consumes: - application/json - description: Owner 修改某位成员在当前租户内的角色;不能将最后一位 Owner 降级 + description: Owner 修改某位成员在当前空间内的角色;不能将最后一位 Owner 降级 parameters: - - description: 租户 ID + - description: 空间 ID in: path name: id required: true @@ -13633,19 +13634,19 @@ paths: type: object security: - Bearer: [] - summary: 修改租户成员角色 + summary: 修改空间成员角色 tags: - - 租户成员 + - 空间成员 /tenants/all: get: consumes: - application/json - description: 获取系统中所有租户(需要跨租户访问权限) + description: 获取系统中所有空间(需要跨空间访问权限) produces: - application/json responses: "200": - description: 所有租户列表 + description: 所有空间列表 schema: additionalProperties: true type: object @@ -13655,14 +13656,14 @@ paths: $ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError' security: - Bearer: [] - summary: 获取所有租户列表 + summary: 获取所有空间列表 tags: - - 租户管理 + - 空间管理 /tenants/kv/{key}: get: consumes: - application/json - description: 获取租户级别的KV配置(支持web-search-config、prompt-templates、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config) + description: 获取空间级别的KV配置(支持web-search-config、prompt-templates、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config) parameters: - description: 配置键名 in: path @@ -13684,13 +13685,13 @@ paths: security: - Bearer: [] - ApiKeyAuth: [] - summary: 获取租户KV配置 + summary: 获取空间KV配置 tags: - - 租户管理 + - 空间管理 put: consumes: - application/json - description: 更新租户级别的KV配置(支持web-search-config、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config) + description: 更新空间级别的KV配置(支持web-search-config、parser-engine-config、storage-engine-config、chat-history-config、retrieval-config) parameters: - description: 配置键名 in: path @@ -13718,9 +13719,9 @@ paths: security: - Bearer: [] - ApiKeyAuth: [] - summary: 更新租户KV配置 + summary: 更新空间KV配置 tags: - - 租户管理 + - 空间管理 /tenants/kv/prompt-templates: get: consumes: @@ -13743,12 +13744,12 @@ paths: - ApiKeyAuth: [] summary: 获取提示词模板 tags: - - 租户管理 + - 空间管理 /tenants/kv/web-search-config: get: consumes: - application/json - description: 获取租户的网络搜索配置 + description: 获取空间的网络搜索配置 produces: - application/json responses: @@ -13764,20 +13765,20 @@ paths: security: - Bearer: [] - ApiKeyAuth: [] - summary: 获取租户网络搜索配置 + summary: 获取空间网络搜索配置 tags: - - 租户管理 + - 空间管理 /tenants/search: get: consumes: - application/json - description: 分页搜索租户(需要跨租户访问权限) + description: 分页搜索空间(需要跨空间访问权限) parameters: - description: 搜索关键词 in: query name: keyword type: string - - description: 租户ID筛选 + - description: 空间ID筛选 in: query name: tenant_id type: integer @@ -13806,13 +13807,13 @@ paths: security: - Bearer: [] - ApiKeyAuth: [] - summary: 搜索租户 + summary: 搜索空间 tags: - - 租户管理 + - 空间管理 /user/favorites: get: - description: Lists this user's starred resources in the current tenant for a - given type + description: Lists this user's starred resources in the current workspace for + a given type parameters: - description: Resource type (kb | agent) in: query @@ -13869,7 +13870,7 @@ paths: - User /vector-stores: get: - description: List all vector stores for the current tenant, including environment-configured + description: List all vector stores for the current workspace, including environment-configured and user-created stores produces: - application/json @@ -13893,7 +13894,7 @@ paths: post: consumes: - application/json - description: Create a new vector store configuration for the current tenant + description: Create a new vector store configuration for the current workspace parameters: - description: Vector store configuration in: body @@ -14379,7 +14380,7 @@ paths: post: consumes: - application/json - description: 保存 APPID/APPSECRET 到当前租户配置(不自动创建模型) + description: 保存 APPID/APPSECRET 到当前空间配置(不自动创建模型) parameters: - description: '{app_id, app_secret}' in: body @@ -14409,7 +14410,7 @@ paths: - WeKnoraCloud securityDefinitions: ApiKeyAuth: - description: 租户身份认证:输入 sk- 开头的 API Key + description: 空间身份认证:输入 sk- 开头的 API Key in: header name: X-API-Key type: apiKey diff --git a/docs/wiki/API参考/API文档概览.md b/docs/wiki/API参考/API文档概览.md index 3db84085..734984ba 100644 --- a/docs/wiki/API参考/API文档概览.md +++ b/docs/wiki/API参考/API文档概览.md @@ -46,7 +46,7 @@ API Key 在 Web 页面完成账户注册后,前往账户信息页面获取。 | 分类 | 描述 | 详细文档 | |------|------|----------| | 认证管理 | 用户注册、登录、令牌管理;OIDC 流程 | [auth.md](../../api/auth.md) · [OIDC认证调用流程.md](../安全认证/OIDC认证调用流程.md) | -| 租户管理 | 创建和管理租户账户 | [tenant.md](../../api/tenant.md) | +| 空间管理 | 创建和管理空间账户 | [tenant.md](../../api/tenant.md) | | 知识库管理 | 创建、查询和管理知识库 | [knowledge-base.md](../../api/knowledge-base.md) | | 知识管理 | 上传、检索和管理知识内容 | [knowledge.md](../../api/knowledge.md) | | 模型管理 | 配置和管理各种AI模型 | [model.md](../../api/model.md) | diff --git a/docs/wiki/Home.md b/docs/wiki/Home.md index fd676f58..bed1b07d 100644 --- a/docs/wiki/Home.md +++ b/docs/wiki/Home.md @@ -42,8 +42,8 @@ aliases: [Home, Index, wiki首页] | 页面 | 简介 | |------|------| | [OIDC认证调用流程](安全认证/OIDC认证调用流程.md) | OIDC 第三方登录的完整调用链路 | -| [租户RBAC说明](安全认证/RBAC说明.md) | 租户内角色矩阵、资源归属与审计 | -| [共享空间说明](安全认证/共享空间说明.md) | 跨租户协作与知识库/智能体共享 | +| [空间RBAC说明](安全认证/RBAC说明.md) | 空间内角色矩阵、资源归属与审计 | +| [共享空间说明](安全认证/共享空间说明.md) | 跨空间协作与知识库/智能体共享 | ## 开发与部署 @@ -95,7 +95,7 @@ graph TB 集成扩展 --> VecDB[集成向量数据库] 安全认证 --> OIDC[OIDC认证调用流程] - 安全认证 --> RBAC[租户RBAC说明] + 安全认证 --> RBAC[空间RBAC说明] 安全认证 --> SharedSpace[共享空间说明] 开发部署 --> DevGuide[开发指南] diff --git a/docs/wiki/安全认证/OIDC认证调用流程.md b/docs/wiki/安全认证/OIDC认证调用流程.md index 4d85cdd5..5944b7c9 100644 --- a/docs/wiki/安全认证/OIDC认证调用流程.md +++ b/docs/wiki/安全认证/OIDC认证调用流程.md @@ -9,7 +9,7 @@ source: OIDC认证调用流程.md 本文档说明 WeKnora 当前 OIDC 登录能力的实际调用过程,覆盖前后端完整链路。 -> OIDC 认证是标准版多租户场景下的登录方式,[Lite 版](../项目概述/Lite与标准版区别.md)不需要 +> OIDC 认证是标准版多空间场景下的登录方式,[Lite 版](../项目概述/Lite与标准版区别.md)不需要 ## 整体设计说明 @@ -19,10 +19,10 @@ source: OIDC认证调用流程.md 1. **前端只负责发起跳转**,不直接和 OIDC Provider 交换 token 2. **后端负责用授权码 `code` 向 OIDC Provider 换取 token** -3. 后端拿到 OIDC 用户信息后,会查找本地用户;若不存在则自动创建本地账号和默认租户 +3. 后端拿到 OIDC 用户信息后,会查找本地用户;若不存在则自动创建本地账号和默认空间 4. 最终签发 WeKnora 自己的本地 JWT,OIDC token 只用于后端换取用户身份 -> 自动创建用户与租户的逻辑与 [共享空间说明](../安全认证/共享空间说明.md) 的多租户模型相关 +> 自动创建用户与空间的逻辑与 [共享空间说明](../安全认证/共享空间说明.md) 的多空间模型相关 ## 相关接口 @@ -72,13 +72,13 @@ Provider 回调后端 `/auth/oidc/callback`,后端用 `code` 换 token、拉 1. **`redirect_uri` 必须严格匹配** Provider 客户端配置 2. **邮箱是本地账号关联主键** — 若 Provider 没返回 email,将无法完成登录 -3. **首次 OIDC 登录会自动创建用户和默认租户** +3. **首次 OIDC 登录会自动创建用户和默认空间** 4. **真正用于访问 API 的是本地 JWT**,不是 OIDC access token ## 相关主题 -- [共享空间说明](../安全认证/共享空间说明.md) — 多租户场景下的用户与组织管理 -- [Lite与标准版区别](../项目概述/Lite与标准版区别.md) — Lite 版无需 OIDC(单租户) +- [共享空间说明](../安全认证/共享空间说明.md) — 多空间场景下的用户与组织管理 +- [Lite与标准版区别](../项目概述/Lite与标准版区别.md) — Lite 版无需 OIDC(单空间) - [API文档概览](../API参考/API文档概览.md) — API 认证机制 --- @@ -86,6 +86,6 @@ Provider 回调后端 `/auth/oidc/callback`,后端用 `code` 换 token、拉 ## 反向链接 - [Home](../Home.md) — Wiki 首页导航 -- [共享空间说明](../安全认证/共享空间说明.md) — OIDC 创建的用户与租户可用于共享空间 -- [Lite与标准版区别](../项目概述/Lite与标准版区别.md) — Lite 不需要 OIDC(单租户无需注册) +- [共享空间说明](../安全认证/共享空间说明.md) — OIDC 创建的用户与空间可用于共享空间 +- [Lite与标准版区别](../项目概述/Lite与标准版区别.md) — Lite 不需要 OIDC(单空间无需注册) - [API文档概览](../API参考/API文档概览.md) — API 的认证机制与 OIDC JWT 相关 diff --git a/docs/wiki/安全认证/RBAC说明.md b/docs/wiki/安全认证/RBAC说明.md index 85f06501..95e4df83 100644 --- a/docs/wiki/安全认证/RBAC说明.md +++ b/docs/wiki/安全认证/RBAC说明.md @@ -1,20 +1,20 @@ --- -title: 租户RBAC说明 -tags: [安全认证, RBAC, 权限, 多租户, 角色] -aliases: [RBAC, 角色权限, 租户角色, TenantRBAC] +title: 空间RBAC说明 +tags: [安全认证, RBAC, 权限, 多空间, 角色] +aliases: [RBAC, 角色权限, 空间角色, TenantRBAC] source: RBAC说明.md --- -# 租户 RBAC 说明 +# 空间 RBAC 说明 -本文档介绍 WeKnora 的**租户内权限控制(Tenant RBAC)**,包括角色矩阵、资源归属模型,以及它与 [共享空间](./共享空间说明.md) 的关系。 +本文档介绍 WeKnora 的**空间内权限控制(Workspace RBAC)**,包括角色矩阵、资源归属模型,以及它与 [共享空间](./共享空间说明.md) 的关系。 > 状态:已发布;由配置项 `tenant.enable_rbac` 控制,默认 `true`(强制鉴权)。 > 完整说明、灰度方案、Schema、路由守卫等参见 [`docs/RBAC说明.md`](../../RBAC说明.md)。 ## 解决的问题 -RBAC 引入前,只要通过 `X-API-Key` 或 JWT 认证成功,调用方在租户内基本等同管理员。一旦一个租户出现多名真人成员,就需要区分: +RBAC 引入前,只要通过 `X-API-Key` 或 JWT 认证成功,调用方在空间内基本等同管理员。一旦一个空间出现多名真人成员,就需要区分: - 谁可以删除知识库、撤销 API Key; - 谁可以编辑「自己」的 KB / Agent; @@ -26,53 +26,53 @@ RBAC 引入前,只要通过 `X-API-Key` 或 JWT 认证成功,调用方在租 |------|------|----------| | 只读 | `viewer` | 仅读 | | 贡献者 | `contributor` | 可变更 `creator_id == 自己` 的资源;他人资源按 Viewer | -| 管理员 | `admin` | 可变更租户内任意资源;管理成员、共享基础设施 | -| Owner | `owner` | Admin + 可删租户;每个租户唯一 | +| 管理员 | `admin` | 可变更空间内任意资源;管理成员、共享基础设施 | +| Owner | `owner` | Admin + 可删空间;每个空间唯一 | 层级 `viewer < contributor < admin < owner`,高角色继承低角色。 ### 鉴权层的例外 -- **跨租户超管**:`enable_cross_tenant_access` 打开且账号 `CanAccessAllTenants=true`,通过 `X-Tenant-ID` 切换后等同 Admin。 -- **API Key**:合成虚拟用户在所属租户内固定 Admin(删租户除外)。 -- **孤儿租户自愈**:首位认证的真人自动晋升 Owner,避免 API Key-only 租户锁死。 +- **跨空间超管**:`enable_cross_tenant_access` 打开且账号 `CanAccessAllTenants=true`,通过 `X-Tenant-ID` 切换后等同 Admin。 +- **API Key**:合成虚拟用户在所属空间内固定 Admin(删空间除外)。 +- **孤儿空间自愈**:首位认证的真人自动晋升 Owner,避免 API Key-only 空间锁死。 ## 资源归属 迁移 `000043` 在关键表加上 `creator_id`: -- `knowledge_bases.creator_id` —— 老数据回填为该租户的 Owner; +- `knowledge_bases.creator_id` —— 老数据回填为该空间的 Owner; - `custom_agents.creator_id` + `runnable_by_viewer`(默认 `true`,允许 Viewer 在对话中调用)。 子资源沿 `chunk → knowledge → kb → creator_id` 链回溯。 由此得到两类守卫: -- **角色守卫**:只看角色,用于租户级基础设施(模型、向量库、IM 通道等)。 +- **角色守卫**:只看角色,用于空间级基础设施(模型、向量库、IM 通道等)。 - **归属守卫**`OwnedXxxOrAdmin`:creator 或 Admin+ 二者其一即放行,用于具体资源写操作。 ## 与共享空间的关系 | 维度 | 解决什么 | 主键 | |------|---------|------| -| **租户 RBAC** | 同一租户内「你能对自己/别人/共享基础设施做什么」 | `tenant_members(user_id, tenant_id, role)` | -| **共享空间** | 跨租户「让别的租户的人也能用我的 KB / Agent」 | `organization_members` + 共享关系 | +| **空间 RBAC** | 同一空间内「你能对自己/别人/共享基础设施做什么」 | `tenant_members(user_id, tenant_id, role)` | +| **共享空间** | 跨空间「让别的空间的人也能用我的 KB / Agent」 | `organization_members` + 共享关系 | 两者**正交**: - 共享空间不持有 KB / Agent,只记录「以何种权限共享到了哪个空间」;资源归属与 `creator_id` 不变; -- 一次对**他人共享过来**的 KB 的写操作,需要同时满足:共享时设了「可写」 + 你在该空间不是 Viewer + 源租户的 RBAC 仍然放行; +- 一次对**他人共享过来**的 KB 的写操作,需要同时满足:共享时设了「可写」 + 你在该空间不是 Viewer + 源空间的 RBAC 仍然放行; - API Key 跨空间访问**不会**带 Admin 光环——共享路径由 `organization_members.role` 决定,与 API Key 无关。 判定顺序见 `internal/middleware/kb_access.go`: ```text -KB 属于我当前租户?─是─► 走租户 RBAC(角色 + creator_id) +KB 属于我当前空间?─是─► 走空间 RBAC(角色 + creator_id) └─否─► KB 共享给我所在空间?─是─► 取 min(共享权限, 空间角色) └─否─► 403 / 404 ``` -一句话:**租户 RBAC 是纵向的纵深防御,共享空间是横向的协作通道;跨租户写动作必须同时穿过两道闸口。** +一句话:**空间 RBAC 是纵向的纵深防御,共享空间是横向的协作通道;跨空间写动作必须同时穿过两道闸口。** ## 配置 @@ -99,8 +99,8 @@ audit: ## 相关主题 -- [共享空间说明](./共享空间说明.md) — 跨租户协作与共享,与 RBAC 正交 -- [OIDC认证调用流程](./OIDC认证调用流程.md) — 多租户用户体系的认证入口 +- [共享空间说明](./共享空间说明.md) — 跨空间协作与共享,与 RBAC 正交 +- [OIDC认证调用流程](./OIDC认证调用流程.md) — 多空间用户体系的认证入口 - [Lite与标准版区别](../项目概述/Lite与标准版区别.md) — Lite 单用户场景下 RBAC 实际不发挥作用 --- @@ -108,5 +108,5 @@ audit: ## 反向链接 - [Home](../Home.md) — Wiki 首页导航 -- [共享空间说明](./共享空间说明.md) — 共享空间访问最终落到租户 RBAC 校验 +- [共享空间说明](./共享空间说明.md) — 共享空间访问最终落到空间 RBAC 校验 - [OIDC认证调用流程](./OIDC认证调用流程.md) — JWT 解析后即进入 RBAC 角色匹配 diff --git a/docs/wiki/安全认证/共享空间说明.md b/docs/wiki/安全认证/共享空间说明.md index 25e4374a..83c8ab09 100644 --- a/docs/wiki/安全认证/共享空间说明.md +++ b/docs/wiki/安全认证/共享空间说明.md @@ -1,6 +1,6 @@ --- title: 共享空间说明 -tags: [安全认证, 共享空间, 协作, 多租户, 权限] +tags: [安全认证, 共享空间, 协作, 多空间, 权限] aliases: [共享空间, SharedSpace, Organization, 组织] source: 共享空间说明.md --- @@ -13,20 +13,20 @@ source: 共享空间说明.md ## 共享空间概述 -共享空间是跨租户协作的载体。用户可以在同一系统内属于不同租户(账户),通过**加入同一共享空间**,实现: +共享空间是跨空间协作的载体。用户可以在同一系统内属于不同空间(账户),通过**加入同一共享空间**,实现: -- 共享知识库:将本租户的知识库共享到空间,供空间内其他成员使用 -- 共享智能体:将本租户的智能体共享到空间,供空间内其他成员在对话等场景中使用 +- 共享知识库:将本空间的知识库共享到空间,供空间内其他成员使用 +- 共享智能体:将本空间的智能体共享到空间,供空间内其他成员在对话等场景中使用 - 访问他人共享的知识库和智能体 ### 核心概念对照 | 概念 | 说明 | |------|------| -| 共享空间 | 系统中的「组织」(Organization),用于跨租户共享 | +| 共享空间 | 系统中的「组织」(Organization),用于跨空间共享 | | 空间创建者 | 自动成为管理员,不可被移除或降级 | | 空间成员 | 管理员 / 编辑者 / 只读 三种角色 | -| 知识库/智能体归属 | 始终属于一个租户;共享不改变归属 | +| 知识库/智能体归属 | 始终属于一个空间;共享不改变归属 | ## 角色与权限 @@ -40,7 +40,7 @@ source: 共享空间说明.md ## 知识库共享规则 -- 只有知识库所属租户下的用户才能发起共享 +- 只有知识库所属空间下的用户才能发起共享 - 发起人必须是目标空间的**管理员**或**编辑者** - 共享时指定权限:只读或可写 - 同一知识库可共享到多个空间,各自独立配置权限 @@ -54,15 +54,15 @@ source: 共享空间说明.md ## 智能体停用机制 -- 停用是当前租户对**通过共享空间获得的智能体**的个人偏好设置 -- 仅影响本租户在对话中选择智能体时的展示,不改变共享关系 +- 停用是当前空间对**通过共享空间获得的智能体**的个人偏好设置 +- 仅影响本空间在对话中选择智能体时的展示,不改变共享关系 - 不影响其他成员 ## 相关主题 -- [租户RBAC说明](./RBAC说明.md) — 单租户内的角色与资源归属,跨租户写操作需同时满足两边 +- [空间RBAC说明](./RBAC说明.md) — 单空间内的角色与资源归属,跨空间写操作需同时满足两边 - [Lite与标准版区别](../项目概述/Lite与标准版区别.md) — Lite 不支持共享空间 -- [OIDC认证调用流程](../安全认证/OIDC认证调用流程.md) — 多租户场景下的用户认证 +- [OIDC认证调用流程](../安全认证/OIDC认证调用流程.md) — 多空间场景下的用户认证 - [数据源导入开发](../集成扩展/数据源导入开发.md) — 数据源导入的知识库可被共享 - [内置模型管理](../核心功能/内置模型管理.md) — 智能体共享前需确保模型已配置 @@ -71,8 +71,8 @@ source: 共享空间说明.md ## 反向链接 - [Home](../Home.md) — Wiki 首页导航 -- [租户RBAC说明](./RBAC说明.md) — 共享空间访问最终落到租户 RBAC 校验 +- [空间RBAC说明](./RBAC说明.md) — 共享空间访问最终落到空间 RBAC 校验 - [Lite与标准版区别](../项目概述/Lite与标准版区别.md) — Lite 不支持共享空间 -- [OIDC认证调用流程](../安全认证/OIDC认证调用流程.md) — 多租户用户体系支撑共享空间 +- [OIDC认证调用流程](../安全认证/OIDC认证调用流程.md) — 多空间用户体系支撑共享空间 - [数据源导入开发](../集成扩展/数据源导入开发.md) — 导入的知识库可通过共享空间共享 - [内置模型管理](../核心功能/内置模型管理.md) — 智能体共享前的模型配置要求 diff --git a/docs/wiki/核心功能/MCP功能使用说明.md b/docs/wiki/核心功能/MCP功能使用说明.md index 3d688d54..fb027f84 100644 --- a/docs/wiki/核心功能/MCP功能使用说明.md +++ b/docs/wiki/核心功能/MCP功能使用说明.md @@ -17,7 +17,7 @@ source: MCP功能使用说明.md ## 入口与界面 -- 打开控制台左侧菜单 `设置 -> MCP 服务`,即可看到当前租户下的所有 MCP 服务列表。 +- 打开控制台左侧菜单 `设置 -> MCP 服务`,即可看到当前空间下的所有 MCP 服务列表。 - 列表中可快速启停服务、查看描述,并通过右侧菜单执行"测试 / 编辑 / 删除"。 - "添加服务"按钮会弹出 `McpServiceDialog`,用于创建或修改服务。 diff --git a/docs/wiki/核心功能/内置MCP服务管理.md b/docs/wiki/核心功能/内置MCP服务管理.md index 2f9ad5f2..4a208bed 100644 --- a/docs/wiki/核心功能/内置MCP服务管理.md +++ b/docs/wiki/核心功能/内置MCP服务管理.md @@ -9,13 +9,13 @@ source: BUILTIN_MCP_SERVICES.md ## 概述 -内置 MCP 服务是系统级别的 MCP(Model Context Protocol)服务配置,对所有租户可见,但敏感信息会被隐藏,且不可编辑或删除。内置 MCP 服务通常用于提供系统默认的外部工具和资源接入,确保所有租户都能使用统一的 MCP 服务。 +内置 MCP 服务是系统级别的 MCP(Model Context Protocol)服务配置,对所有空间可见,但敏感信息会被隐藏,且不可编辑或删除。内置 MCP 服务通常用于提供系统默认的外部工具和资源接入,确保所有空间都能使用统一的 MCP 服务。 > 用户视角的 MCP 服务操作参见 [MCP功能使用说明](MCP功能使用说明.md) ## 内置 MCP 服务特性 -- **所有租户可见**:内置 MCP 服务对所有租户都可见,无需单独配置 +- **所有空间可见**:内置 MCP 服务对所有空间都可见,无需单独配置 - **安全保护**:内置 MCP 服务的敏感信息(URL、认证配置、Headers、环境变量)会被隐藏,无法查看详情 - **只读保护**:内置 MCP 服务不能被编辑或删除,仅支持测试连接 - **统一管理**:由系统管理员统一维护,确保配置一致性和安全性 @@ -25,7 +25,7 @@ source: BUILTIN_MCP_SERVICES.md | 特性 | 内置模型 | 内置 MCP 服务 | |------|---------|--------------| | 标识字段 | `is_builtin` | `is_builtin` | -| 可见范围 | 所有租户 | 所有租户 | +| 可见范围 | 所有空间 | 所有空间 | | 隐藏信息 | API Key、Base URL | URL、认证配置、Headers、环境变量 | | 编辑保护 | 不可编辑/删除 | 不可编辑/删除 | | 前端标签 | 显示"内置"标签 | 显示"内置"标签 | @@ -45,7 +45,7 @@ source: BUILTIN_MCP_SERVICES.md - 服务地址(url) - 认证配置(auth_config) - 高级配置(advanced_config) -- 租户ID(tenant_id):建议使用小于 10000 的租户ID +- 空间ID(tenant_id):建议使用小于 10000 的空间ID **支持的传输方式**: - `sse`:Server-Sent Events,推荐用于流式体验 @@ -78,7 +78,7 @@ FROM mcp_services WHERE is_builtin = true ORDER BY created_at; ## 注意事项 1. **ID 命名规范**:建议使用 `builtin-mcp-{序号}` 格式 -2. **租户ID**:建议使用第一个租户ID(通常是 10000) +2. **空间ID**:建议使用第一个空间ID(通常是 10000) 3. **JSON 格式**:`auth_config`、`advanced_config`、`headers` 必须是有效的 JSON 4. **幂等性**:使用 `ON CONFLICT (id) DO NOTHING` 确保重复执行不会报错 5. **安全性**:内置 MCP 服务的 URL、认证信息在前端会被自动隐藏 diff --git a/docs/wiki/核心功能/内置模型管理.md b/docs/wiki/核心功能/内置模型管理.md index cb76295d..8526c355 100644 --- a/docs/wiki/核心功能/内置模型管理.md +++ b/docs/wiki/核心功能/内置模型管理.md @@ -9,13 +9,13 @@ source: BUILTIN_MODELS.md ## 概述 -内置模型是系统级别的模型配置,对所有租户可见,但敏感信息会被隐藏,且不可编辑或删除。内置模型通常用于提供系统默认的模型配置,确保所有租户都能使用统一的模型服务。 +内置模型是系统级别的模型配置,对所有空间可见,但敏感信息会被隐藏,且不可编辑或删除。内置模型通常用于提供系统默认的模型配置,确保所有空间都能使用统一的模型服务。 > 同为内置系统配置的还有 [内置MCP服务管理](内置MCP服务管理.md) ## 内置模型特性 -- **所有租户可见**:无需单独配置 +- **所有空间可见**:无需单独配置 - **安全保护**:API Key、Base URL 被隐藏 - **只读保护**:不能被编辑或删除,只能设置为默认模型 - **统一管理**:由系统管理员统一维护 @@ -28,7 +28,7 @@ source: BUILTIN_MODELS.md - 模型类型(type):`KnowledgeQA`、`Embedding`、`Rerank` 或 `VLLM` - 模型来源(source):`local` 或 `remote` - 模型参数(parameters):包括 base_url、api_key、provider 等 -- 租户ID(tenant_id):建议使用小于10000的租户ID +- 空间ID(tenant_id):建议使用小于10000的空间ID **支持的服务商(provider)**:`generic`、`openai`、`aliyun`、`zhipu`、`volcengine`、`hunyuan`、`deepseek`、`minimax`、`mimo`、`siliconflow`、`jina`、`openrouter`、`requesty`、`gemini`、`modelscope`、`moonshot`、`qianfan`、`qiniu`、`longcat`、`gpustack` @@ -63,7 +63,7 @@ FROM models WHERE is_builtin = true ORDER BY type, created_at; ## 注意事项 1. **ID 命名规范**:建议使用 `builtin-{type}-{序号}` 格式 -2. **租户ID**:建议使用第一个租户ID(通常是 10000) +2. **空间ID**:建议使用第一个空间ID(通常是 10000) 3. **参数格式**:`parameters` 字段必须是有效的 JSON 格式 4. **幂等性**:使用 `ON CONFLICT (id) DO NOTHING` 5. **安全性**:API Key 和 Base URL 在前端会被自动隐藏 diff --git a/docs/wiki/项目概述/Lite与标准版区别.md b/docs/wiki/项目概述/Lite与标准版区别.md index b68b79c0..8c0a1c79 100644 --- a/docs/wiki/项目概述/Lite与标准版区别.md +++ b/docs/wiki/项目概述/Lite与标准版区别.md @@ -7,23 +7,23 @@ source: LITE.md # Lite 与标准版区别 -Lite 面向希望快速在本地使用、部署尽量简单的场景;标准版面向多租户协作与完整企业能力。主要差异如下。 +Lite 面向希望快速在本地使用、部署尽量简单的场景;标准版面向多空间协作与完整企业能力。主要差异如下。 | 维度 | Lite | 标准版 | |------|------|--------| -| **共享空间** | 不提供共享空间(成员邀请、跨成员共享知识库与智能体等) | 提供共享空间及租户隔离检索等协作能力 | -| **租户与账号** | 单租户;开箱即用,**无需注册** | 多租户;通常需要注册、登录与组织管理 | +| **共享空间** | 不提供共享空间(成员邀请、跨成员共享知识库与智能体等) | 提供共享空间及空间隔离检索等协作能力 | +| **空间与账号** | 单空间;开箱即用,**无需注册** | 多空间;通常需要注册、登录与组织管理 | | **文档解析** | 内置仅 **Simple** 类型解析引擎;可通过 **Cloud** 等方式接入其他解析能力 | 可配置多种解析引擎(含高精度等),与完整文档处理链路集成 | | **部署形态** | **单应用、零依赖**(不依赖独立的数据库、消息队列等外部服务栈) | 典型为 Docker Compose 等多服务部署,依赖与组件更多 | | **数据归属** | 数据**完全在本地**存储与处理 | 私有化部署时数据也可在本地;具体取决于你的部署方式 | | **网络暴露** | **默认仅本机访问**;可按需配置,**选择是否放行到公网** | 按部署与安全策略自行绑定地址与网关 | -> 若你不需要多团队协作、复杂解析流水线与多服务架构,Lite 更适合个人或小团队在本机零依赖试用;需要共享空间、多租户与完整解析引擎矩阵时,请使用标准版。 +> 若你不需要多团队协作、复杂解析流水线与多服务架构,Lite 更适合个人或小团队在本机零依赖试用;需要共享空间、多空间与完整解析引擎矩阵时,请使用标准版。 ## 相关主题 - 共享空间的详细说明参见 [共享空间说明](../安全认证/共享空间说明.md) — 标准版独有功能 -- 认证体系参见 [OIDC认证调用流程](../安全认证/OIDC认证调用流程.md) — 标准版多租户 OIDC 登录 +- 认证体系参见 [OIDC认证调用流程](../安全认证/OIDC认证调用流程.md) — 标准版多空间 OIDC 登录 - 开发环境搭建参见 [开发指南](../开发部署/开发指南.md) - 部署相关 FAQ 参见 [常见问题](../运维排障/常见问题.md) @@ -34,4 +34,4 @@ Lite 面向希望快速在本地使用、部署尽量简单的场景;标准版 - [Home](../Home.md) — Wiki 首页导航 - [版本路线图](版本路线图.md) — 路线图中的轻量化部署方向 - [共享空间说明](../安全认证/共享空间说明.md) — Lite 不支持的共享空间功能的详细说明 -- [OIDC认证调用流程](../安全认证/OIDC认证调用流程.md) — 标准版多租户场景下的认证方式 +- [OIDC认证调用流程](../安全认证/OIDC认证调用流程.md) — 标准版多空间场景下的认证方式 diff --git a/docs/zh/mcp-approval.md b/docs/zh/mcp-approval.md index 3dac8379..faf68d96 100644 --- a/docs/zh/mcp-approval.md +++ b/docs/zh/mcp-approval.md @@ -39,4 +39,4 @@ WEKNORA_AGENT_TOOL_APPROVAL_TIMEOUT=600 - **审批等待状态保存在进程内存** 中:`pending_id` 仅对当前实例有效;进程重启后进行中的等待会失败(表现为拒绝/取消)。 - **多副本部署**:当配置了 `REDIS_ADDR` 时,`Resolve` 会通过 Redis Pub/Sub(频道 `weknora:mcp_approval:resolve`)跨实例转发,因此 SSE 与提交审批的 HTTP 请求落到不同实例也能正确唤醒等待者;未配置 Redis 时退化为单机模式,需要使用会话粘滞(sticky session)。 - **审批等待不会被工具默认 60s 超时取消**:审批阶段使用 round 级别的 ctx(不带 `defaultToolExecTimeout`),仅受 `agent.tool_approval_timeout_seconds` 与请求级取消控制。 -- 安全边界:审核通过后的参数仍由当前登录租户提交;请仅在可信环境下授予「通过」权限。 +- 安全边界:审核通过后的参数仍由当前登录空间提交;请仅在可信环境下授予「通过」权限。 diff --git a/docs/共享空间说明.md b/docs/共享空间说明.md index 94f9e157..6a77d120 100644 --- a/docs/共享空间说明.md +++ b/docs/共享空间说明.md @@ -2,7 +2,7 @@ 本文档说明 WeKnora 中的**共享空间**功能,包括空间创建与加入、成员角色与权限、知识库与智能体共享规则、智能体停用机制,以及用户对知识库的最终访问权限计算方式。 -> 共享空间解决「跨租户协作」,与单租户内的角色权限([租户 RBAC 说明](./RBAC说明.md))正交:一次跨租户的写操作必须同时穿过两道闸口。详见 RBAC 文档「与共享空间的关系」一节。 +> 共享空间解决「跨空间协作」,与单空间内的角色权限([空间 RBAC 说明](./RBAC说明.md))正交:一次跨空间的写操作必须同时穿过两道闸口。详见 RBAC 文档「与共享空间的关系」一节。 --- @@ -10,16 +10,16 @@ ### 1.1 什么是共享空间 -共享空间是跨租户协作的载体。用户可以在同一系统内属于不同租户(账户),通过**加入同一共享空间**,实现: +共享空间是跨空间协作的载体。用户可以在同一系统内属于不同空间(账户),通过**加入同一共享空间**,实现: -- 共享知识库:将本租户的知识库共享到空间,供空间内其他成员使用; -- 共享智能体:将本租户的智能体共享到空间,供空间内其他成员在对话等场景中使用; +- 共享知识库:将本空间的知识库共享到空间,供空间内其他成员使用; +- 共享智能体:将本空间的智能体共享到空间,供空间内其他成员在对话等场景中使用; - 访问他人共享的知识库:在「知识库列表」中看到并打开通过空间共享给自己的知识库; - 在对话、智能体等场景中选择并使用这些共享知识库与共享智能体。 数据与权限关系简要如下: -- **租户**:知识库、智能体的归属单位,每个知识库/智能体属于一个租户; +- **空间**:知识库、智能体的归属单位,每个知识库/智能体属于一个空间; - **共享空间**:不拥有知识库或智能体,只记录「某知识库/智能体被共享到某空间」以及「共享时的权限」; - **成员**:用户通过邀请码或管理员邀请加入空间,在空间内拥有一个角色(管理员 / 编辑者 / 只读)。 @@ -27,10 +27,10 @@ | 概念 | 说明 | |------|------| -| 共享空间 | 系统中的「组织」(Organization),用于跨租户共享知识库与智能体 | +| 共享空间 | 系统中的「组织」(Organization),用于跨空间共享知识库与智能体 | | 空间创建者 | 创建该空间的用户,自动成为该空间的管理员,且不可被移除或降级 | | 空间成员 | 通过邀请码加入或由管理员邀请加入的用户,拥有管理员、编辑者或只读之一角色 | -| 知识库/智能体归属 | 知识库、智能体始终属于一个租户;共享到空间不改变归属,只建立「空间 ↔ 知识库/智能体」的共享关系 | +| 知识库/智能体归属 | 知识库、智能体始终属于一个空间;共享到空间不改变归属,只建立「空间 ↔ 知识库/智能体」的共享关系 | | 共享关系 | 一条记录表示:某知识库以某种权限(只读/可写)被共享到某共享空间;或某智能体以只读方式被共享到某共享空间 | --- @@ -124,7 +124,7 @@ ### 4.1 谁可以发起共享 -- 只有**知识库所属租户下的用户**(即「拥有」该知识库的账户下的用户)才能将该知识库共享到某个共享空间。 +- 只有**知识库所属空间下的用户**(即「拥有」该知识库的账户下的用户)才能将该知识库共享到某个共享空间。 - 同时,该用户必须是目标共享空间的**成员**,且角色为**管理员**或**编辑者**。 即:**只读成员不能把任何知识库(包括自己的)共享到该空间。** @@ -158,7 +158,7 @@ ### 5.1 谁可以发起智能体共享 -- 只有**智能体所属租户下的用户**才能将该智能体共享到某个共享空间。 +- 只有**智能体所属空间下的用户**才能将该智能体共享到某个共享空间。 - 同时,该用户必须是目标共享空间的**成员**,且角色为**管理员**或**编辑者**(与知识库共享一致)。 - 智能体须已配置完成(如已选模型、若使用知识库则已选 rerank 模型等)方可共享。 @@ -177,17 +177,17 @@ ## 六、智能体停用机制 -「停用」是当前租户对**通过共享空间获得的智能体**的一种个人偏好设置,仅影响本租户在**对话中选择智能体**时的展示与使用体验,不改变共享关系,也不影响其他成员。 +「停用」是当前空间对**通过共享空间获得的智能体**的一种个人偏好设置,仅影响本空间在**对话中选择智能体**时的展示与使用体验,不改变共享关系,也不影响其他成员。 ### 6.1 停用的含义 -- 当某租户将某个「通过共享空间获得的智能体」标记为**已停用**时: - - 在该租户的对话界面中,该智能体可在下拉列表中被隐藏或标记为已停用,减少干扰; +- 当某空间将某个「通过共享空间获得的智能体」标记为**已停用**时: + - 在该空间的对话界面中,该智能体可在下拉列表中被隐藏或标记为已停用,减少干扰; - 该智能体仍对该共享空间的其他成员可见、可用; - 共享关系不变,发起共享的用户与空间管理员仍可照常管理该条共享。 -- 停用状态按「租户 + 智能体(含来源租户)」记录,即:同一智能体被多个空间共享时,用户停用后在所有入口对该智能体的展示偏好一致。 +- 停用状态按「空间 + 智能体(含来源空间)」记录,即:同一智能体被多个空间共享时,用户停用后在所有入口对该智能体的展示偏好一致。 ### 6.2 停用与恢复 - 用户可随时将已停用的共享智能体**恢复**,恢复后该智能体重新在对话下拉等列表中正常显示。 -- 停用/恢复仅影响当前租户自己的视图与选择列表,不影响他人,也不影响该用户通过直接链接等方式访问该智能体。 +- 停用/恢复仅影响当前空间自己的视图与选择列表,不影响他人,也不影响该用户通过直接链接等方式访问该智能体。 diff --git a/docs/数据源导入开发文档.md b/docs/数据源导入开发文档.md index c364f28a..a5255c31 100644 --- a/docs/数据源导入开发文档.md +++ b/docs/数据源导入开发文档.md @@ -442,7 +442,7 @@ type Resource struct { │ 1. 解析任务体 (DataSourceSyncPayload) │ │ 2. 加载数据源配置 │ │ 3. 解密凭证 → 获取 Connector │ -│ 4. 设置租户上下文 │ +│ 4. 设置空间上下文 │ │ 5. 创建/获取自动标签 (连接器名·数据源名) │ │ 6. 判断同步模式: │ │ ├─ ForceFull 或 SyncModeFull → FetchAll │ diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 7e86e17b..9b50e3b4 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -194,7 +194,7 @@ watch( { immediate: true }, ) -// 切换租户后会 hard reload;切换前 stash 的 toast 这里 consume 并弹出, +// 切换空间后会 hard reload;切换前 stash 的 toast 这里 consume 并弹出, // 这样 toast 显示在新页面上,duration 才真正生效。 const showPendingTenantSwitchToast = () => { const pending = consumePendingTenantSwitchToast() diff --git a/frontend/src/api/agent/index.ts b/frontend/src/api/agent/index.ts index 4a9dad45..b74c95ab 100644 --- a/frontend/src/api/agent/index.ts +++ b/frontend/src/api/agent/index.ts @@ -163,7 +163,7 @@ export const BUILTIN_AGENT_NORMAL_ID = BUILTIN_QUICK_ANSWER_ID; export const BUILTIN_AGENT_AGENT_ID = BUILTIN_SMART_REASONING_ID; // 获取智能体列表(包括内置智能体) -// disabled_own_agent_ids: 当前租户在对话下拉中停用的「我的」智能体 ID,仅影响本租户 +// disabled_own_agent_ids: 当前空间在对话下拉中停用的「我的」智能体 ID,仅影响本空间 export function listAgents(params?: { /** * Optional creator filter; mirrors listKnowledgeBases. Built-in agents diff --git a/frontend/src/api/auth/index.ts b/frontend/src/api/auth/index.ts index b0bcc35f..1271dbc6 100644 --- a/frontend/src/api/auth/index.ts +++ b/frontend/src/api/auth/index.ts @@ -157,7 +157,7 @@ export function userInfoFromApi( } } -// 租户信息接口 +// 空间信息接口 export interface TenantInfo { id: string name: string @@ -288,7 +288,7 @@ export async function register(data: RegisterRequest): Promise } /** - * Lite 版自动初始化(创建默认用户/租户 + 签发令牌) + * Lite 版自动初始化(创建默认用户/空间 + 签发令牌) */ export async function autoSetup(): Promise { try { @@ -353,7 +353,7 @@ export async function updateMyPreferences( } /** - * 获取当前租户信息 + * 获取当前空间信息 */ export async function getCurrentTenant(): Promise<{ success: boolean; data?: TenantInfo; message?: string }> { try { diff --git a/frontend/src/api/chat/streame.ts b/frontend/src/api/chat/streame.ts index 879ef57c..4d4f6595 100644 --- a/frontend/src/api/chat/streame.ts +++ b/frontend/src/api/chat/streame.ts @@ -55,13 +55,13 @@ export function useStream() { return; } - // 跨租户访问请求头:只要 setSelectedTenant 写过激活租户,就附 + // 跨空间访问请求头:只要 setSelectedTenant 写过激活空间,就附 // X-Tenant-ID。早期版本会 short-circuit "selectedTenantId === // defaultTenantId 时不附" 来减少 header 体积,但任何把 weknora_tenant - // 写成激活租户的代码(OIDC 同步 / UserMenu loadUserInfo / router + // 写成激活空间的代码(OIDC 同步 / UserMenu loadUserInfo / router // hydrate)都会让两者相等,使得后续流式请求悄悄丢 header、落到 - // home 租户上,导致 SSE 接口返回 404。直接附即可——后端 - // IsTenantAccessible 也允许 header 指向自家租户。 + // home 空间上,导致 SSE 接口返回 404。直接附即可——后端 + // IsTenantAccessible 也允许 header 指向自家空间。 const selectedTenantId = localStorage.getItem('weknora_selected_tenant_id'); const tenantIdHeader: string | null = selectedTenantId || null; diff --git a/frontend/src/api/initialization/index.ts b/frontend/src/api/initialization/index.ts index de8cace9..fcfe65ec 100644 --- a/frontend/src/api/initialization/index.ts +++ b/frontend/src/api/initialization/index.ts @@ -464,7 +464,7 @@ export function testMultimodalFunction(testData: { headers['Authorization'] = `Bearer ${token}`; } - // 跨租户访问请求头:直接附,避免 short-circuit "selectedTenantId + // 跨空间访问请求头:直接附,避免 short-circuit "selectedTenantId // === defaultTenantId 时不附" 在某些边角下让 header 静默丢失。 // 与 utils/request.ts、api/chat/streame.ts 行为一致。 const selectedTenantId = localStorage.getItem('weknora_selected_tenant_id'); diff --git a/frontend/src/api/system/index.ts b/frontend/src/api/system/index.ts index 067b57b0..62e2697d 100644 --- a/frontend/src/api/system/index.ts +++ b/frontend/src/api/system/index.ts @@ -71,7 +71,7 @@ export interface ParserEngineInfo { UnavailableReason?: string } -/** 解析引擎配置(引擎相关存租户;docreader 地址由环境变量配置) */ +/** 解析引擎配置(引擎相关存空间;docreader 地址由环境变量配置) */ export interface ParserEngineConfig { docreader_addr?: string docreader_transport?: string @@ -130,7 +130,7 @@ export function reconnectDocReader(addr: string): Promise i18n.global.t(key) -// 租户信息接口 +// 空间信息接口 export interface TenantInfo { id: number name: string @@ -109,7 +109,7 @@ export interface CreateTenantAPIKeyPayload { expires_at_unix?: number } -// 搜索租户参数 +// 搜索空间参数 export interface SearchTenantsParams { keyword?: string tenant_id?: number @@ -117,7 +117,7 @@ export interface SearchTenantsParams { page_size?: number } -// 搜索租户响应 +// 搜索空间响应 export interface SearchTenantsResponse { success: boolean data?: { @@ -130,7 +130,7 @@ export interface SearchTenantsResponse { } /** - * 获取所有租户列表(需要跨租户访问权限) + * 获取所有空间列表(需要跨空间访问权限) * @deprecated 建议使用 searchTenants 代替,支持分页和搜索 */ export async function listAllTenants(): Promise<{ success: boolean; data?: { items: TenantInfo[] }; message?: string }> { @@ -234,7 +234,7 @@ export async function deleteTenantAPIKey( } /** - * 更新租户信息(目前暴露名称、描述两个字段的编辑入口)。 + * 更新空间信息(目前暴露名称、描述两个字段的编辑入口)。 * 后端 `PUT /tenants/:id` 用指针字段区分"未传"和"显式空串",未传的列不会 * 被改动;这里也按需选择性传 `name` / `description`,互不影响。 * 权限:owner(与 router.go 中的 g.Owner() 守卫保持一致)。 @@ -273,7 +273,7 @@ export async function deleteTenant( /** * 创建新工作区(任意已登录用户均可调用)。 - * 后端会自动把调用者写成新租户的 Owner,并填充默认 storage_quota + * 后端会自动把调用者写成新空间的 Owner,并填充默认 storage_quota * 等服务端字段;API Key 由用户在集成页手动创建。 * 路由:POST /api/v1/tenants(router 上不挂 g.CrossTenant(),自助场景使用)。 */ @@ -295,7 +295,7 @@ export async function createTenant( } /** - * 搜索租户(支持分页、关键词搜索和租户ID过滤) + * 搜索空间(支持分页、关键词搜索和空间ID过滤) */ export async function searchTenants(params: SearchTenantsParams = {}): Promise { try { diff --git a/frontend/src/api/tenant/members.ts b/frontend/src/api/tenant/members.ts index f7b9df86..2e274a7b 100644 --- a/frontend/src/api/tenant/members.ts +++ b/frontend/src/api/tenant/members.ts @@ -65,7 +65,7 @@ export interface SimpleResponse { } /** - * 分页列出租户成员。 + * 分页列出空间成员。 * Backend: GET /api/v1/tenants/:id/members (Viewer+)。查询参数:`q`、`page`、`page_size`。 */ export async function listMembers( @@ -79,7 +79,7 @@ export async function listMembers( } /** - * 遍历分页拉取租户的全部成员(每页最大 100,最多 500 页兜底)。 + * 遍历分页拉取空间的全部成员(每页最大 100,最多 500 页兜底)。 * 用于「退出空间」等对全量成员的轻量校验;普通表格请直接使用 {@link listMembers} 分页接口。 */ export async function fetchAllTenantMembers(tenantId: number): Promise { diff --git a/frontend/src/components/CreateTenantDialog.vue b/frontend/src/components/CreateTenantDialog.vue index a7a064f7..37829b55 100644 --- a/frontend/src/components/CreateTenantDialog.vue +++ b/frontend/src/components/CreateTenantDialog.vue @@ -1,7 +1,7 @@