Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
docs: remove WeCom document integration from data source import documentation
wizardcheneaf17e65f8df
diff --git "a/docs/\346\225\260\346\215\256\346\272\220\345\257\274\345\205\245\345\274\200\345\217\221\346\226\207\346\241\243.md" "b/docs/\346\225\260\346\215\256\346\272\220\345\257\274\345\205\245\345\274\200\345\217\221\346\226\207\346\241\243.md"index 04b092eaf..c364f28a2 100644--- "a/docs/\346\225\260\346\215\256\346\272\220\345\257\274\345\205\245\345\274\200\345\217\221\346\226\207\346\241\243.md"+++ "b/docs/\346\225\260\346\215\256\346\272\220\345\257\274\345\205\245\345\274\200\345\217\221\346\226\207\346\241\243.md"@@ -8,7 +8,6 @@ WeKnora 的数据源导入模块支持从外部平台(飞书、企业微信、- [快速接入指南](#快速接入指南)- [飞书知识库接入](#飞书知识库接入)- - [企业微信文档接入](#企业微信文档接入)- [前端管理](#前端管理)- [架构总览](#架构总览)- [数据模型](#数据模型)@@ -245,18 +244,6 @@ CREATE TABLE data_sources (| 连接器类型 | 凭证字段 | 认证方式 ||-----------|---------|---------|| 飞书 (feishu) | `app_id`, `app_secret` | OAuth2 (Tenant Access Token) |-| Notion | `api_key` | API Key |-| Confluence | `base_url`, `username`, `api_token` | API Token |-| 语雀 (yuque) | `api_token`, `group_login` | API Token |-| GitHub | `access_token`, `owner`, `repo` | Personal Access Token |-| Google Drive | `credentials_json` | OAuth2 Service Account |-| OneDrive | `client_id`, `client_secret`, `tenant_id` | OAuth2 |-| 钉钉文档 (dingtalk) | `app_key`, `app_secret` | OAuth2 |-| 企业微信文档 (wecom_doc) | `corp_id`, `corp_secret` | access_token (自建应用) |-| Web 爬虫 (web_crawler) | `start_urls`, `max_depth` | 无需认证 |-| Slack | `bot_token` | Bot Token |-| IMAP | `host`, `port`, `username`, `password` | 密码认证 |-| RSS | `feed_urls` | 无需认证 |### sync_logs 表@@ -698,137 +685,6 @@ DownloadDriveFile → GET /drive/v1/files/{token}/download| `internal/datasource/connector/feishu/connector.go` | Connector 接口实现:Validate、ListResources、FetchAll、FetchIncremental || `internal/datasource/connector/feishu/connector_test.go` | 单元测试:使用 HTTP Mock 模拟飞书开放平台 |-### 企业微信文档 (WeCom Doc)--企微文档连接器支持两种数据源:**智能文档**(企微原生在线文档/表格)和 **微盘文件**(上传的 PDF/Word/Excel 等)。--#### 认证机制--```-Corp ID + Corp Secret- │- ▼- GET /cgi-bin/gettoken?corpid=xxx&corpsecret=xxx- │- ▼- 获取 access_token(有效期 7200 秒 / 2 小时)- │- ▼- Token 缓存,提前 5 分钟刷新-```--- **认证类型**:企业自建应用,access_token-- **Token 有效期**:7200 秒(2 小时),内置缓存,提前 5 分钟自动刷新-- **API 地址**:`https://qyapi.weixin.qq.com`-- **Token 传递方式**:通过 URL 参数 `access_token=xxx`--#### 资源发现--`ListResources` 返回配置的智能文档和微盘空间资源。--> **注意**:WeCom 不提供公开的"获取文档列表"API,智能文档必须通过 `settings.doc_ids` 手动配置文档 ID。微盘空间必须通过 `settings.space_ids` 手动配置空间 ID。--**智能文档(从 `settings.doc_ids` 配置获取):**--| 资源 ExternalID | 名称 | 类型 |-|----------------|------|------|-| `doc:<docid>` | 文档名称(通过 API 查询) | `smart_doc` |--**微盘空间(从 `settings.space_ids` 配置获取):**--| 资源 ExternalID | 名称 | 类型 |-|----------------|------|------|-| `wedrive:<space_id>` | 微盘空间: {id} | `wedrive_space` |--#### 智能文档同步--智能文档通过已知的 docid 直接获取元数据,不依赖列表 API。--**获取文档元数据(用于增量同步时间对比):**--```-POST /cgi-bin/wedoc/get_doc_base_info?access_token=xxx-Body: { "docid": "xxx" }--返回: { "doc_base_info": { "docid": "...", "doc_name": "...", "create_time": 1700000000, "modify_time": 1700001000, "doc_type": 3 } }-```--每个文档映射为一个 `FetchedItem`:--| 字段 | 值 |-|------|------|-| `ExternalID` | docid |-| `Title` | doc_name |-| `URL` | `https://doc.weixin.qq.com/doc/{docid}` 或 `sheet/{docid}` |-| `ContentType` | `text/html` |-| `Metadata.channel` | `wecom` |-| `Metadata.doc_type` | 文档类型(3=文档, 4=表格) |--#### 微盘文件同步--**列举文件(递归遍历子目录):**--```-POST /cgi-bin/wedrive/file_list?access_token=xxx-Body: { "spaceid": "xxx", "sort_type": 5, "start": 0, "limit": 1000 }--返回: { "file_list": { "item": [...], "has_more": false } }-```--**文件类型:**--| `file_type` | 类型 | 同步行为 |-|-------------|------|---------|-| 1 | 文件夹 | 递归遍历子项 |-| 2 | 上传文件 | 通过 file_download 下载二进制内容 |-| 3 | 智能文档 | 通过 URL 导入 |-| 4 | 智能表格 | 通过 URL 导入 |-| 5 | 收集表 | 通过 URL 导入 |--**下载上传文件(file_type=2):**--```-POST /cgi-bin/wedrive/file_download?access_token=xxx-Body: { "fileid": "xxx", "userid": "admin_userid" }--返回: { "download_url": "https://...", "cookie_name": "...", "cookie_value": "..." }-```--下载时需携带返回的 Cookie 请求 `download_url` 获取文件内容。--#### 增量同步 (FetchIncremental)--增量同步基于文档 `modify_time` 对比:--```-1. 加载上次游标 (wecomCursor)- └─ DocModifyTimes[docid] = 上次记录的修改时间--2. 对每个选中的 doc: 资源:- └─ 通过 GetDocBaseInfo 获取元数据--3. 对比变更:- ├─ 新文档(游标中不存在)→ 加入变更列表- ├─ modify_time 变更 → 加入变更列表- ├─ modify_time 未变 → 跳过- └─ 游标中存在但已从配置移除 → 标记为 IsDeleted--4. 微盘空间:- └─ 列举所有文件 (ListAllDriveFilesRecursive)- └─ 对比 mtime,逻辑同上--5. 返回新游标(含本轮每个文档/文件的最新修改时间)-```--#### 源码文件--| 文件 | 职责 |-|------|------|-| `internal/datasource/connector/wecom/types.go` | WeCom API 类型定义、配置结构、常量(文档/微盘类型) |-| `internal/datasource/connector/wecom/client.go` | API 客户端:Token 管理、文档详情、微盘文件列表/递归/下载 |-| `internal/datasource/connector/wecom/connector.go` | Connector 接口实现:Validate、ListResources、FetchAll、FetchIncremental |-----## 定时调度diff --git a/internal/datasource/scheduler_test.go b/internal/datasource/scheduler_test.goindex c27ed62a1..645d2082f 100644--- a/internal/datasource/scheduler_test.go+++ b/internal/datasource/scheduler_test.go@@ -117,6 +117,10 @@ func (r *fakeSyncLogRepo) Update(_ context.Context, log *types.SyncLog) error {return nil}+func (r *fakeSyncLogRepo) CancelPendingByDataSource(_ context.Context, dsID string) error {+ return nil+}+func (r *fakeSyncLogRepo) CleanupOldLogs(_ context.Context, retentionDays int) error {return nil}diff --git a/internal/models/provider/aliyun.go b/internal/models/provider/aliyun.goindex 74d28f497..a6477412b 100644--- a/internal/models/provider/aliyun.go+++ b/internal/models/provider/aliyun.go@@ -64,6 +64,11 @@ func IsQwenThinkingModel(modelName string) bool {strings.HasPrefix(lowerName, "qwen-turbo")}+// IsQwen3Model checks whether the model belongs to the Qwen3 family only.+func IsQwen3Model(modelName string) bool {+ return strings.HasPrefix(strings.ToLower(modelName), "qwen3")+}+// IsDeepSeekModel 检查模型名是否为 DeepSeek 模型// DeepSeek 模型不支持 tool_choice 参数func IsDeepSeekModel(modelName string) bool {