Compare commits
1 Commits
93736b5495
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d42988185 |
2
.obsidian/app.json
vendored
2
.obsidian/app.json
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"pdfExportSettings": {
|
||||
"includeName": false,
|
||||
"includeName": true,
|
||||
"pageSize": "Tabloid",
|
||||
"landscape": false,
|
||||
"margin": "1",
|
||||
|
||||
39
.obsidian/workspace.json
vendored
39
.obsidian/workspace.json
vendored
@@ -13,12 +13,12 @@
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "三方渠道对接/微信视频号反馈.md",
|
||||
"file": "美洽AI/Rag/RAG对外接口文档.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "微信视频号反馈"
|
||||
"title": "RAG对外接口文档"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -53,7 +53,7 @@
|
||||
"state": {
|
||||
"type": "search",
|
||||
"state": {
|
||||
"query": "",
|
||||
"query": "rag",
|
||||
"matchingCase": false,
|
||||
"explainSearch": false,
|
||||
"collapseAll": false,
|
||||
@@ -180,10 +180,24 @@
|
||||
},
|
||||
"active": "e29338cdcaee82a9",
|
||||
"lastOpenFiles": [
|
||||
"三方渠道对接/企微.md",
|
||||
"Untitled.md",
|
||||
"Untitled.base",
|
||||
"参考台词.md",
|
||||
"第三关 - 火眼金睛·看图猜台词.md",
|
||||
"第二关 - 万里挑一.md",
|
||||
"第二关 - 看图猜台词.md",
|
||||
"公司/周报/2026-04-W2.md",
|
||||
"公司/周报/2025-12-W4.md",
|
||||
"美洽AI/Rag/RAG对外接口文档.md",
|
||||
"三方渠道对接/微信视频号反馈.md",
|
||||
"三方渠道对接/微信公众号.md",
|
||||
"Untitled.md",
|
||||
"三方渠道对接/企微.md",
|
||||
"随笔/网络冲浪中的隐私保护.md",
|
||||
"tmp.md",
|
||||
"数据仓库/数仓分层.md",
|
||||
"数据仓库/业务数据表.md",
|
||||
"美洽AI/Rag",
|
||||
"SQL.md",
|
||||
"公司/日报/2026年/3月/2026-03-27.md",
|
||||
"三方渠道对接",
|
||||
"公司/Untitled",
|
||||
@@ -197,25 +211,10 @@
|
||||
"公司/日报/2026年/3月",
|
||||
"公司/日报/2026年/3月/2026-03-20.md",
|
||||
"公司/日报/2026年/3月/2026-03-19.md",
|
||||
"公司/日报/2026年/3月/2026-03-18.md",
|
||||
"公司/日报/2026年/3月/2026-03-17.md",
|
||||
"公司/日报/2026年/3月/2026-03-16.md",
|
||||
"公司/日报/2026年/3月/2026-03-13.md",
|
||||
"公司/日报/2026年/3月/2026-03-12.md",
|
||||
"公司/日报/2026年/3月/2026-03-11.md",
|
||||
"公司/日报/2026年/3月/2026-03-10.md",
|
||||
"公司/日报/2026年/3月/2026-03-09.md",
|
||||
"公司/日报/2026年/3月/2026-03-06.md",
|
||||
"公司/日报/2026年/2月/2026-02-04.md",
|
||||
"公司/日报/2026年",
|
||||
"公司/日报/2026年/1月/2026-01-04.md",
|
||||
"公司/日报/2026年/2月",
|
||||
"公司/日报/2025年/12月/2025-12-23.md",
|
||||
"公司/日报/2026年/1月",
|
||||
"公司/日报/2025年",
|
||||
"公司/日报/2025年/12月",
|
||||
"公司/日报/2026年/3月/2026-03-05.md",
|
||||
"Untitled.base",
|
||||
"src/定制模板(千人千面).png",
|
||||
"src/Pasted image 20250514170546.png",
|
||||
"src/试用期考核.jpeg"
|
||||
|
||||
123
sql.md
123
sql.md
@@ -1,123 +0,0 @@
|
||||
```sql
|
||||
CREATE TABLE `auth_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '认证信息ID',
|
||||
`phone` varchar(50) NOT NULL COMMENT '手机号',
|
||||
`password` varchar(255) NOT NULL COMMENT '加密后的密码',
|
||||
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted_at` datetime DEFAULT NULL COMMENT '删除时间(软删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_phone_deleted` (`phone`, `deleted_at`),
|
||||
KEY `idx_phone` (`phone`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='统一认证信息表';
|
||||
|
||||
CREATE TABLE `auth_info_agent` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '关联ID',
|
||||
`auth_info_id` bigint(20) NOT NULL COMMENT '认证信息ID',
|
||||
`agent_id` bigint(20) NOT NULL COMMENT '客服ID',
|
||||
`ent_id` bigint(20) NOT NULL COMMENT '企业ID(冗余字段,便于查询)',
|
||||
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_auth_agent` (`auth_info_id`, `agent_id`),
|
||||
KEY `idx_agent` (`agent_id`),
|
||||
KEY `idx_auth_info` (`auth_info_id`),
|
||||
KEY `idx_ent` (`ent_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='认证信息与客服关联表';
|
||||
|
||||
CREATE TABLE `user_login_status` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`agent_id` bigint(20) NOT NULL COMMENT '客服ID',
|
||||
`platform` varchar(50) NOT NULL COMMENT '登录平台: web, ios, android, mac, windows等',
|
||||
`token` varchar(255) NOT NULL COMMENT '登录token',
|
||||
`user_agent` varchar(500) DEFAULT NULL COMMENT '用户代理字符串',
|
||||
`ip` varchar(50) DEFAULT NULL COMMENT 'IP地址',
|
||||
`isp` varchar(100) DEFAULT NULL COMMENT '运营商',
|
||||
`country` varchar(100) DEFAULT NULL COMMENT '国家',
|
||||
`province` varchar(100) DEFAULT NULL COMMENT '省份',
|
||||
`city` varchar(100) DEFAULT NULL COMMENT '城市',
|
||||
`status` varchar(20) NOT NULL COMMENT '状态: online(在线), invisible(隐身), off_duty(离线)',
|
||||
`login_at` datetime NOT NULL COMMENT '登录时间',
|
||||
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_token` (`token`),
|
||||
KEY `idx_ent_agent`(`ent_id`,`agent_id`),
|
||||
KEY `idx_agent_platform` (`agent_id`, `platform`),
|
||||
KEY `idx_status` (`status`),
|
||||
KEY `idx_login_at` (`login_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户登录状态表';
|
||||
|
||||
INSERT INTO auth_info (phone, password, created_at, updated_at)
|
||||
SELECT DISTINCT
|
||||
phone,
|
||||
COALESCE(password, '') as password,
|
||||
NOW(6),
|
||||
NOW(6)
|
||||
FROM agent
|
||||
WHERE deleted_at IS NULL
|
||||
AND phone IS NOT NULL
|
||||
AND phone != ''
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM auth_info ai WHERE ai.phone = agent.phone AND ai.deleted_at IS NULL
|
||||
)
|
||||
GROUP BY phone;
|
||||
|
||||
-- 步骤2: 创建 auth_info 与 agent 的关联关系
|
||||
INSERT INTO auth_info_agent (auth_info_id, agent_id, created_at)
|
||||
SELECT
|
||||
ai.id as auth_info_id,
|
||||
a.id as agent_id,
|
||||
NOW(6)
|
||||
FROM agent a
|
||||
INNER JOIN auth_info ai ON a.phone = ai.phone AND ai.deleted_at IS NULL
|
||||
WHERE a.deleted_at IS NULL
|
||||
AND a.phone IS NOT NULL
|
||||
AND a.phone != ''
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM auth_info_agent aia
|
||||
WHERE aia.auth_info_id = ai.id AND aia.agent_id = a.id
|
||||
);
|
||||
|
||||
-- 步骤3(可选): 验证迁移结果
|
||||
-- 检查是否所有 agent 都有对应的 auth_info_agent 记录
|
||||
SELECT
|
||||
'未关联的 agent 数量' as check_item,
|
||||
COUNT(*) as count
|
||||
FROM agent a
|
||||
WHERE a.deleted_at IS NULL
|
||||
AND a.phone IS NOT NULL
|
||||
AND a.phone != ''
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM auth_info_agent aia WHERE aia.agent_id = a.id
|
||||
);
|
||||
|
||||
-- 检查 auth_info 记录数
|
||||
SELECT
|
||||
'auth_info 记录数' as check_item,
|
||||
COUNT(*) as count
|
||||
FROM auth_info
|
||||
WHERE deleted_at IS NULL;
|
||||
|
||||
-- 检查 auth_info_agent 关联记录数
|
||||
SELECT
|
||||
'auth_info_agent 关联记录数' as check_item,
|
||||
COUNT(*) as count
|
||||
FROM auth_info_agent;
|
||||
|
||||
-- 检查有多个 agent 的手机号
|
||||
SELECT
|
||||
ai.phone,
|
||||
COUNT(aia.agent_id) as agent_count,
|
||||
GROUP_CONCAT(a.realname SEPARATOR ', ') as agent_names
|
||||
FROM auth_info ai
|
||||
INNER JOIN auth_info_agent aia ON ai.id = aia.auth_info_id
|
||||
INNER JOIN agent a ON aia.agent_id = a.id
|
||||
WHERE ai.deleted_at IS NULL AND a.deleted_at IS NULL
|
||||
GROUP BY ai.phone
|
||||
HAVING COUNT(aia.agent_id) > 1;
|
||||
|
||||
```
|
||||
|
||||
```sql
|
||||
alter table webhook
|
||||
add workec_id json comment 'workec配置' default '{}' after push_platform;
|
||||
```
|
||||
@@ -1,2 +1,45 @@
|
||||
1. 消息丢失和消息接收回执有关,视频号服务在高并发情况下推送数据没有拿到回执队列会有消息丢失
|
||||
2. IP纯净度问题,视频号服务商说的微信被封号是用了四叶天的住宅IP被封,目前我们使用的IDC IP,只有一家未实名的账号被封
|
||||
|
||||
```sql
|
||||
alter table wx_video_fansinfo
|
||||
modify openid varchar(255) default '' not null comment '粉丝openid';
|
||||
```
|
||||
|
||||
```sql
|
||||
CREATE TABLE `wx_video_mention` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
|
||||
`ent_id` bigint(20) NOT NULL COMMENT '企业ID',
|
||||
`account_id` bigint(20) NOT NULL COMMENT '视频号账号ID',
|
||||
`app_id` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '视频号AppID',
|
||||
`finder_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '视频号finder用户名',
|
||||
`sub_source` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '子来源标识',
|
||||
`client_id` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '顾客ID',
|
||||
`req_scene` tinyint(4) NOT NULL COMMENT '消息场景(3点赞,4评论,5关注)',
|
||||
`mention_id` bigint(20) NOT NULL COMMENT '消息ID',
|
||||
`svr_mention_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '服务端消息ID',
|
||||
`mention_type` int(11) NOT NULL DEFAULT '0' COMMENT '消息类型',
|
||||
`username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '对方username',
|
||||
`nickname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '昵称',
|
||||
`head_url` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '头像URL',
|
||||
`mention_content` text COLLATE utf8mb4_unicode_ci COMMENT '消息内容',
|
||||
`ref_content` text COLLATE utf8mb4_unicode_ci COMMENT '引用内容',
|
||||
`description` text COLLATE utf8mb4_unicode_ci COMMENT '描述',
|
||||
`thumb_url` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '缩略图URL',
|
||||
`reply_nickname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '被回复昵称',
|
||||
`comment_reply_content` text COLLATE utf8mb4_unicode_ci COMMENT '评论区回复内容',
|
||||
`is_private_reply` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否私信回复',
|
||||
`ref_object_nonce_id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '引用对象nonce_id',
|
||||
`ref_object_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '引用作品ID',
|
||||
`ref_comment_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '引用评论ID',
|
||||
`media_type` int(11) NOT NULL DEFAULT '0' COMMENT '媒体类型',
|
||||
`mention_created_at` datetime(6) NOT NULL COMMENT '消息创建时间',
|
||||
`created_at` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
|
||||
`updated_at` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_account_mention` (`account_id`,`mention_id`),
|
||||
KEY `idx_ent_id` (`ent_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='微信视频号mention明细'
|
||||
|
||||
|
||||
```
|
||||
|
||||
6
公司/周报/2026-04-W2.md
Normal file
6
公司/周报/2026-04-W2.md
Normal file
@@ -0,0 +1,6 @@
|
||||
1. 微信视频号场景深化
|
||||
2. 服务号跳转URL
|
||||
3. 恒信接口对接
|
||||
4. 处理值班问题
|
||||
5. 开发rag open接口
|
||||
6. 输出rag open文档
|
||||
222
美洽AI/Rag/RAG对外接口文档.md
Normal file
222
美洽AI/Rag/RAG对外接口文档.md
Normal file
@@ -0,0 +1,222 @@
|
||||
|
||||
本文档对应以下 3 个内部接口:
|
||||
|
||||
- `POST /rag/index`
|
||||
- `POST /rag/query`
|
||||
- `POST /rag/delete`
|
||||
|
||||
baseURL: http://api-gateway.meiqia.cn/openapi/
|
||||
|
||||
请求头使用:
|
||||
|
||||
```http
|
||||
Content-Type: application/json
|
||||
OrgName: {org_name}
|
||||
Token: {token}
|
||||
```
|
||||
org_name和token一一对应
|
||||
org_name枚举:meiqia、laigu
|
||||
token等开发之后会提供
|
||||
|
||||
## 通用响应格式
|
||||
|
||||
接口成功时:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {}
|
||||
}
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
- 成功时 HTTP 状态码通常为 `200`
|
||||
- 如果接口返回为空,响应可能只有 `{"success": true}`
|
||||
|
||||
接口失败时:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"message": "missing required fields"
|
||||
}
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
- 参数错误默认返回 `400`
|
||||
- 部分服务内部错误可能返回 `500`
|
||||
|
||||
## 1. 索引文档
|
||||
|
||||
### 接口地址
|
||||
|
||||
```http
|
||||
POST /rag/index
|
||||
```
|
||||
|
||||
### 接口说明
|
||||
|
||||
将指定知识库文档下载后切分为 RAG chunk,并写入 RAG 检索集合。
|
||||
|
||||
补充说明:
|
||||
|
||||
- `file_url` 为服务端可访问的文件下载地址
|
||||
- 文件类型主要根据 `file_name` 后缀或 `file_url` 路径后缀识别
|
||||
- 当前代码中明确支持的文件类型有:`.md`、`.pdf`、`.txt`、`.docx`、`.xlsx`、`.xls`、`.csv`
|
||||
|
||||
### 请求参数
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| `ent_id` | `int64` | 是 | 企业 ID |
|
||||
| `knowledge_id` | `string` | 是 | 知识库 ID |
|
||||
| `knowledge_doc_id` | `string` | 是 | 知识文档 ID |
|
||||
| `file_name` | `string` | 否 | 文件名,建议传真实文件名及后缀,便于识别文件类型 |
|
||||
| `file_url` | `string` | 是 | 文件下载地址 |
|
||||
|
||||
### 请求示例
|
||||
|
||||
```json
|
||||
{
|
||||
"ent_id": 10001,
|
||||
"knowledge_id": "kb_001",
|
||||
"knowledge_doc_id": "doc_001",
|
||||
"file_name": "产品使用手册.pdf",
|
||||
"file_url": "https://example.com/files/doc_001.pdf"
|
||||
}
|
||||
```
|
||||
|
||||
### 成功响应示例
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
### 失败响应示例
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"message": "unsupported file type: .zip"
|
||||
}
|
||||
```
|
||||
|
||||
## 2. 查询 RAG 文本
|
||||
|
||||
### 接口地址
|
||||
|
||||
```http
|
||||
POST
|
||||
/rag/query
|
||||
```
|
||||
|
||||
### 接口说明
|
||||
|
||||
根据问题和知识库 ID 列表检索最相关的 RAG 文本片段。
|
||||
|
||||
补充说明:
|
||||
|
||||
- `knowledge_ids` 至少需要传 1 个
|
||||
- 当 `top_k <= 0` 时,服务端会自动使用默认值 `10`
|
||||
- 当前接口只返回文本内容,不返回分数、文档 ID、chunk 索引等元数据
|
||||
|
||||
### 请求参数
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| `ent_id` | `int64` | 是 | 企业 ID |
|
||||
| `knowledge_ids` | `[]string` | 是 | 待检索的知识库 ID 列表 |
|
||||
| `query` | `string` | 是 | 用户查询问题 |
|
||||
| `top_k` | `int` | 否 | 返回条数,未传或小于等于 `0` 时默认取 `10` |
|
||||
|
||||
### 请求示例
|
||||
|
||||
```json
|
||||
{
|
||||
"ent_id": 10001,
|
||||
"knowledge_ids": ["kb_001", "kb_002"],
|
||||
"query": "如何重置管理员密码?",
|
||||
"top_k": 5
|
||||
}
|
||||
```
|
||||
|
||||
### 成功响应示例
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"texts": [
|
||||
"管理员可以在设置中心的账号安全页面重置密码。",
|
||||
"如果开启了双重验证,重置密码后需要重新绑定验证设备。"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 失败响应示例
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"message": "missing required fields"
|
||||
}
|
||||
```
|
||||
|
||||
## 3. 删除文档索引
|
||||
|
||||
### 接口地址
|
||||
|
||||
```http
|
||||
POST /rag/delete
|
||||
```
|
||||
|
||||
### 接口说明
|
||||
|
||||
删除指定知识文档的索引数据。
|
||||
|
||||
实际行为如下:
|
||||
|
||||
- 删除指定知识文档的 RAG 索引数据
|
||||
- `knowledge_id` 不是必填
|
||||
- 当 `knowledge_id` 为空时,会按 `ent_id + knowledge_doc_id` 删除
|
||||
- 当 `knowledge_id` 不为空时,会按 `ent_id + knowledge_id + knowledge_doc_id` 精确删除
|
||||
|
||||
### 请求参数
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| `ent_id` | `int64` | 是 | 企业 ID |
|
||||
| `knowledge_id` | `string` | 否 | 知识库 ID;传入后删除范围更精确 |
|
||||
| `knowledge_doc_id` | `string` | 是 | 知识文档 ID |
|
||||
|
||||
### 请求示例
|
||||
|
||||
```json
|
||||
{
|
||||
"ent_id": 10001,
|
||||
"knowledge_id": "kb_001",
|
||||
"knowledge_doc_id": "doc_001"
|
||||
}
|
||||
```
|
||||
|
||||
### 成功响应示例
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
### 失败响应示例
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"message": "missing required fields"
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user