POST https://lxapi.lexiangla.com/cgi-bin/v1/ai/qa
Content-Type: application/json
{
"query": "乐享是什么?",
"stream": false,
"anonymous_staff_id": "anonymous_staff_id00",
"skip_faq":false,
"new_session":false,
"session_id":"3e22842cxxxxxxxxxxxxxxxxxxx1b602cb706e5",
"qa_mode":"reasoning",
"max_chars": 200,
"targets": [
{
"type": "team",
"id": "74d76195adxxxxxxd49239d56e44f"
},
{
"type": "team",
"id": "74d76195adxxxxxxd49239d56e55d"
},
{
"type": "team_code",
"id": "k100XX"
}
]
}
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
query | 是 | 无 | 用户最新输入问题,最长 128 字符 |
stream | 否 | false | 是否流式输出 |
anonymous_staff_id | 否 | 无 | 匿名用户 ID,由业务调用方生成,字符串长度范围:[16, 32] |
skip_faq | 否 | false | 是否跳过已关联的FAQ,仅调用AI根据站内知识生成的回答。false:不跳过FAQ,若问题命中关联FAQ,则输出对应问答;true,跳过FAQ,仅调用AI根据站内知识生成的回答 |
new_session | 否 | false | 是否重置并开启全新话题,避免此前对话混淆 AI 助手的理解。false:参考对话上下文进行问答;true:重置并开启全新会话,此时传入session_id字段无效 |
session_id | 否 | 无 | 会话ID,可用以区分不同的会话。不同会话间的对话历史相互隔离。当开启全新会话后会随响应返回,后续可通过传入对应的session_id保持多轮对话。字符串长度:40 |
qa_mode | 否 | normal | 思考方式,可以通过传入参数开启不同的问答模式。normal: 使用默认模型进行快速回答; normal-ds-v3: 使用deepseek-v3-0324模型进行快速回答; reasoning: 深度思考,research:专业研究 |
max_chars | 否 | 无 | 回答内容字数限制,仅输入大于0的整数才可生效(注:为保证语义完整,最终AI回答字数可能超过字数限制) |
targets | 否 | 无 | 知识范围,可以通过传入参数限制知识来源的范围,不传则默认为全站知识。仅支持指定同一范围类型(targets.type),最多可传入20个范围对象。 |
targets.type | 否 | 无 | 表示范围类型,可设置为team(K吧) / team_code(K吧code) |
targets.id | 否 | 无 | 表示对应范围类型的id。 |
在请求头设置 x-staff-id: LX001
,LX001 为乐享的员工 ID。
在请求头设置 x-staff-id: system-bot
,请求体的 anonymous_staff_id 设置匿名用户 ID。
只支持对乐享问答知识库中的公开文档进行问答。
{
"code": 0,
"message": "success",
"request_id": "194669439490d679c35db90d56ae6e7a",
"data": {
"content": "腾讯乐享是一站式企业社区",
"answer_source": "internal",
"session_id":"3e22842cxxxxxxxxxxxxxxxxxxx1b602cb706e5",
"reasoning_content": "好的,用户的问题是“乐享是什么”,我需要根据提供的搜索结果来回答。首先,看看知识点1,里面提到乐享是腾讯基于知识管理最佳实践开发的企业云应用,每天有60%的员工使用,沉淀400多篇知识,用于文档查阅、专家咨询和讨论产品方案。这应该是核心定义,需要引用[citation:1]。....\n\n需要整合这些信息,结构上先定义,再功能,接着技术特点,最后应用案例和统计数据。确保每个部分都有对应的引用,避免重复引用同一知识点,同时保持回答的连贯性和全面性。\n",
"additional_content": {
"generated_question": "",
"reference_docs": [
{
"title": "精选案例|腾讯乐享标杆案例库_roketyyang腾讯57926",
"url": "/docs/9d9ce122093611ef8a7f0242ac140007"
}
]
}
}
}
{
"code": 51,
"message": "Query为必填字段",
"request_id": "b0e08f19c6d51f80e376b61df3e2de05",
"data": null
}
{
"code": 51,
"message": "QAMode必须是[normal normal-ds-v3 reasoning]中的一个",
"request_id": "b0e08f19c6d51f80e376b61df3e2de05",
"data": null
}
{
"code": 51,
"message": "MaxChars必须大于0",
"request_id": "eba7d53e-e104-4436-9fb2-d2293385b205",
"data": null
}
基于 server-sent events (opens new window) 实现。
{"completion_id": "2e1d3cb8e74245bb8a9707247e097579","processes": {"message": "开始获取站内资料..."},"delta_content": "","content": "","finish_reason": "","is_stop": false,"answer_source": "","additional_content": null}
{"completion_id": "2e1d3cb8e74245bb8a9707247e097579","processes": {"message": "找到 1 篇相关资料..."},"delta_content": "","content": "","finish_reason": "","is_stop": false,"answer_source": "","additional_content": null}
{"completion_id": "0d786b8c3d374b718531a6824c45a99f","session_id": "","processes": {"stage": "thinking","message": "正在根据资料进行深度思考...","delta_content": "好的","content": "", "detail": null},"delta_content": "","content": "","finish_reason": "","is_stop": false, "answer_source": "","additional_content": null}
{"completion_id":"75b1e8ef074c486a8b1c7886234a7e85","session_id":"3e22842cxxxxxxxxxxxxxxxxxxx1b602cb706e5","processes": {"message":""},"delta_content":"","content":"腾讯乐享是一站式企业社区","finish_reason":"stop","is_stop":true,"answer_source": "internal","additional_content":{"generated_question":"","reference_docs":[{"title":"腾讯乐享介绍","url":"/docs/9d9ce122093611ef8a7f0242ac140007"}]}}
参数出错时,会返回非流式响应
completion_id:任务id
session_id: 会话id
processes
delta_content:内容块
content:完整答案内容
finish_reason:回答结束原因
is_stop:回答完成状态
answer_source:faq表示使用FAQ回答,internal表示使用站内知识回答,internal-team表示使用指定K吧知识回答
additional_content
请求方式:GET(HTTPS)
请求地址:https://lxapi.lexiangla.com/cgi-bin/v1/ai-faqs?limit=20&page=1
参数说明:
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
limit | 是 | 20 | 分页下FAQ的个数 |
page | 是 | 1 | 分页 |
返回结果:
200 OK 状态码
{
"data": [
{
"id": f53470346a8f11ef9cd30242c0a8d018,
"attributes": {
"category_names": ["全部分类", "一级分类1", "二级分类1", "三级分类1"],
"question": "什么是FAQ?",
"similar_questions": "[\"FAQ是什么?\", \"啥是FAQ?\"]",
"answer": "FAQ 是Frequently Asked Questions 的缩写,译为“常见问题”。通过整理常见问答对,可以帮助用户快速查找对应信息。",
"keywords": "[\"FAQ\", \"问答对\"]",
"add_type": "batch",
"created_at": "2024-09-09 16:41:01",
"updated_at": "2024-09-09 16:41:01"
}
},
{
"id": f53412346a8f11ef9cd30242c0a8d018,
"attributes": {
"category_names": ["全部分类", "一级分类2", "二级分类2"],
"question": "什么是腾讯乐享?",
"similar_questions": "[\"腾讯乐享是什么?\", \"啥是腾讯乐享?\"]",
"answer": "腾讯乐享是一个助力企业的学习平台",
"keywords": "[\"乐享\", \"腾讯\"]",
"add_type": "single",
"created_at": "2024-09-09 16:41:01",
"updated_at": "2024-09-09 16:41:01"
}
}
],
"links": {
"first": "http://lxapi.lx.net/cgi-bin/v1/ai-faqs?limit=20&page=1",
"last": "http://lxapi.lx.net/cgi-bin/v1/ai-faqs?limit=20&page=221",
"prev": "http://lxapi.lx.net/cgi-bin/v1/ai-faqs?limit=20&page=1",
"next": "http://lxapi.lx.net/cgi-bin/v1/ai-faqs?limit=20&page=3"
},
"meta": {
"current_page": 2,
"from": 21,
"last_page": 221,
"path": "http://lxapi.lx.net/cgi-bin/v1/ai-faqs",
"per_page": 20,
"to": 40,
"total": 4404
}
}
参数说明:
参数 | 说明 |
---|---|
current_page | 当前分页 |
id | FAQ唯一标识 |
category_names | FAQ所属分类路径(从根分类到所处分类) |
question | FAQ问题 |
answer | FAQ答案 |
similar_questions | FAQ相似问 |
keywords | FAQ关键词 |
add_type | FAQ的添加方式(single手动;batch批量;generate抽取生成) |
created_at | FAQ创建日期 |
updated_at | FAQ更新日期 |
请求方式:GET(HTTPS)
请求地址:https://lxapi.lexiangla.com/cgi-bin/v1/ai-histories?limit=20&page=1
参数说明:
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
limit | 是 | 20 | 单个分页下AI历史记录的条数 |
page | 是 | 1 | 分页 |
started_at | 否 | 无 | 开始日期 |
ended_at | 否 | 无 | 结束日期 |
返回结果:
200 OK 状态码
{
"data": [
{
"type": "ai_history"
"id": 1,
"attributes": {
"created_at": "2025-04-17 20:02:13",
"question": "是什么",
"generated_question": "FAQ是什么",
"answer": "[{\"question\":\"什么是FAQ啊?\",\"answer\":\"FAQ是Frequently Asked Question11\"}]",
"question_type": "qa",
"answer_source": "faq",
"qa_mode": "normal",
"answerable": "-",
"staff_organization": "研发部",
}
},
{
"type": "ai_history"
"id": 2,
"attributes": {
"created_at": "2025-04-17 14:46:01",
"question": "有什么美食",
"generated_question": "苏州市有什么美食",
"answer": " 苏州拥有丰富多样的美食,以下是一些代表性的苏州美食:\n\n### 一、苏帮菜\n1. **松鼠鳜鱼**:这道菜以鳜鱼为主料,经过巧妙刀工处理后炸至金黄酥脆,再浇上糖醋汁,造型宛如松鼠,外酥里嫩,甜酸适口。\n2. **响油鳝糊**:选用太湖流域的新鲜野生鳝鱼,经过焯烫、煸炒、烧制等步骤,最后浇上热油,鳝肉鲜嫩爽滑,口感醇厚。\n3. **太湖三白**:包括白鱼、银鱼和白虾。白鱼清蒸后鲜嫩爽滑,银鱼可炒蛋或做羹,白虾常以白灼方式烹饪,味道鲜甜。\n\n### 二、特色小吃\n1. **生煎包**:面皮蓬松柔软,馅料以新鲜猪肉为主,煎制后底部酥脆,汤汁四溢,鲜香可口。\n2. **梅花糕**:外形宛如盛开的梅花,口感松软香甜,豆沙馅的甜蜜与果仁、红枣的丰富口感相互交织。\n3. **苏式月饼**:有甜月饼和咸月饼之分,甜月饼馅料多样,咸月饼以鲜肉为馅,外皮酥脆,内馅鲜嫩多汁。\n\n### 三、其他美食\n1. **苏绣**:虽然不是食物,但苏州的糕点如桂花糖芋艿、梅花糕等也颇具特色,口感细腻,甜而不腻。\n2. **蟹粉豆腐**:选用阳澄湖大闸蟹的蟹粉,与嫩豆腐一起烹制,蟹香浓郁,豆腐滑嫩,口感丰富。\n\n苏州的美食不仅种类繁多,而且注重食材的新鲜和烹饪的精细,每一道菜都蕴含着苏州人对美食的极致追求与热爱。",
"question_type": "qa",
"answer_source": "doc",
"qa_mode": "reasoning",
"answerable": true
}
}
],
"links": {
"first": "http://lxapi.lx.net/cgi-bin/v1/ai-histories?limit=20&started_at=2025-04-17+12%3A00%3A00&ended_at=2025-04-17+20%3A59%3A59&page=1",
"last": "http://lxapi.lx.net/cgi-bin/v1/ai-histories?limit=20&started_at=2025-04-17+12%3A00%3A00&ended_at=2025-04-17+20%3A59%3A59&page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "http://lxapi.lx.net/cgi-bin/v1/ai-histories",
"per_page": 20,
"to": 2,
"total": 2
}
}
400 Bad Request 状态码
{
"errors": [
{
"detail": "起始时间不能大于结束时间"
}
]
}
{
"errors": [
{
"detail": "{\"limit\":[\"limit 必须在 1 和 200 之间.\"],\"page\":[\"page 的最小长度为 1 .\"]}"
}
]
}
{
"errors": [
{
"detail": "{\"limit\":[\"不能为空\"],\"page\":[\"不能为空\"]}"
}
]
}
参数说明:
参数 | 说明 |
---|---|
id | AI历史问答记录标识 |
created_at | 提问时间 |
question | 原始问题 |
generated_question | 改写问题 |
answer | 答案 |
question_type | 提问方式。search: 搜索触发; qa: 对话问答; openapi: API调用 |
answer_source | 知识范围。internal: AI-站内知识; external: AI-联网搜索; doc: AI-指定文档; faq: FAQ; internal-space: AI-站内知识-知识库; internal-team: AI-站内知识-团队空间 |
qa_mode | 思考方式。normal: 快速回答; normal-ds-v3: 快速回答-deepseek-v3-0324; reasoning: 深度思考; research: 专业研究 |
answerable | 是否拒答。true: 非拒答; false: 拒答; -: 该回答不支持判断拒答 |
staff_organization | 提问用户部门 |
请求方式:GET(HTTPS)
请求地址:https://lxapi.lexiangla.com/cgi-bin/v1/ai-feedbacks?limit=20&page=1
参数说明:
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
limit | 是 | 20 | 单个分页下AI反馈记录的条数 |
page | 是 | 1 | 分页 |
started_at | 否 | 无 | 开始日期 |
ended_at | 否 | 无 | 结束日期 |
feedback_type | 否 | 无 | 反馈类型。1: 赞; 2: 踩 |
返回结果:
200 OK 状态码
{
"data": [
{
"type": "ai_feedback"
"id": 1,
"attributes": {
"feedback_type": "踩",
"feedback_item": "misunderstanding_context",
"supplementary": "数据错误",
"user_input": "成都市有多大",
"ai_output": "成都面积 3797.79平方千米<span id=\"ai-qa-ref\" data-completion-id=\"eaec56e9957a4063b94dbf17ee910b45\" data-ref-doc=\"1\" data-ref-chunks=\"1\">1</span>。",
"answer_source": "internal",
"qa_mode": "normal",
"answerable": true,
"staff_name": "李四",
"staff_organization": "研发部",
"created_at": "2025-04-15 14:13:05"
}
},
{
"type": "ai_feedback"
"id": 2,
"attributes": {
"feedback_type": "赞",
"feedback_item": "accurate_content|completed_content",
"supplementary": "说明正确",
"user_input": "万里长江第一桥是什么",
"ai_output": "万里长江第一桥是指武汉长江大桥<span id=\"ai-qa-ref\" data-completion-id=\"9b61a705b99e473c8a6667c3608d6ec0\" data-ref-doc=\"1\" data-ref-chunks=\"1,2,3\">1</span><span id=\"ai-qa-ref\" data-completion-id=\"9b61a705b99e473c8a6667c3608d6ec0\" data-ref-doc=\"2\" data-ref-chunks=\"4\">2</span><span id=\"ai-qa-ref\" data-completion-id=\"9b61a705b99e473c8a6667c3608d6ec0\" data-ref-doc=\"3\" data-ref-chunks=\"5,6\">3</span>。",
"answer_source": "doc",
"qa_mode": "reasoning",
"answerable": true,
"staff_name": "张三",
"staff_organization": "研发部",
"created_at": "2025-04-17 11:34:15"
}
}
],
"links": {
"first": "http://lxapi.lx.net/cgi-bin/v1/ai-feedbacks?limit=20&page=1",
"last": "http://lxapi.lx.net/cgi-bin/v1/ai-feedbacks?limit=20&page=2",
"prev": "http://lxapi.lx.net/cgi-bin/v1/ai-feedbacks?limit=20&page=1",
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "http://lxapi.lx.net/cgi-bin/v1/ai-feedbacks",
"per_page": 20,
"to": 2,
"total": 2
}
}
400 Bad Request 状态码
{
"errors": [
{
"detail": "起始时间不能大于结束时间"
}
]
}
{
"errors": [
{
"detail": "{\"limit\":[\"limit 必须在 1 和 200 之间.\"],\"page\":[\"page 的最小长度为 1 .\"],\"feedback_type\":[\"选定的 feedback type 是无效的.\"]}"
}
]
}
{
"errors": [
{
"detail": "{\"limit\":[\"不能为空\"],\"page\":[\"不能为空\"]}"
}
]
}
参数说明:
参数 | 说明 |
---|---|
id | AI问答反馈标识 |
feedback_type | 反馈类型 |
feedback_item | 反馈选项,多个选项使用竖线分隔。详见下方反馈选项枚举值说明 |
supplementary | 补充说明 |
user_input | 用户输入 |
ai_output | 模型输出 |
answer_source | 知识范围。internal: AI-站内知识; external: AI-联网搜索; doc: AI-指定文档; faq: FAQ; internal-space: AI-站内知识-知识库; internal-team: AI-站内知识-团队空间 |
qa_mode | 思考方式。normal: 快速回答; normal-ds-v3: 快速回答-deepseek-v3-0324; reasoning: 深度思考; research: 专业研究 |
answerable | 是否拒答。true: 非拒答; false: 拒答; -: 该回答不支持判断拒答 |
staff_name | 反馈人 |
created_at | 反馈时间 |
staff_organization | 提问用户部门 |
反馈类型 | 反馈选项-key | 反馈选项-value |
---|---|---|
踩 | no_matched_context | 未匹配相关内容 |
outdated_content | 内容老旧 | |
wrong_content | 内容错误 | |
illusion_context | 回答幻觉 | |
misunderstanding_context | 上下文理解错误 | |
wrong_link_image | 链接/图片错误 | |
other_problems | 其他 | |
赞 | accurate_content | 内容准确 |
completed_content | 全面完整 | |
formated_content | 格式规范 |
POST https://lxapi.lexiangla.com/cgi-bin/v1/ai/search
Content-Type: application/json
{
"query": "乐享是什么?",
"anonymous_staff_id": "anonymous_staff_id00",
"targets": [
{
"type": "team",
"id": "74d76195adxxxxxxd49239d56e44f"
},
{
"type": "team",
"id": "12a0fcf8781011f099de2688xxxxxxb"
}
],
"top_n": 1
}
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
query | 是 | 无 | 用户最新输入问题,最长 128 字符 |
anonymous_staff_id | 否 | 无 | 匿名用户 ID,由业务调用方生成,字符串长度范围:[16, 32] |
targets | 否 | 无 | 知识范围,可以通过传入参数限制知识来源的范围,仅支持指定单一知识范围,不传则默认为全站知识。仅支持指定同一范围类型(targets.type),最多可传入20个范围对象。 |
targets.type | 否 | 无 | 表示范围类型,可设置为space(知识库)/team(团队空间) |
targets.id | 否 | 无 | 指定对应范围类型的 id |
top_n | 是 | 无 | 指定输出 rerank 后排名前几的文档 |
在请求头设置 x-staff-id: LX001
,LX001 为乐享的员工 ID。
在请求头设置 x-staff-id: system-bot
,请求体的 anonymous_staff_id 设置匿名用户 ID。
只支持对乐享问答知识库中的公开文档进行问答。
{
"code": 0,
"message": "success",
"request_id": "10f012cd-xxxxb-42b0-bc46-a33a2c779f2a",
"data": {
"list": [
{
"content": "xxxxx",
"title": "0108-腾讯乐享AI助手",
"url": "https://lexiangla.com/docs/ea740dea2efb11f0af7b368fe1d069a3"
}
]
}
}
{
"code": 51,
"message": "Query为必填字段",
"request_id": "c79bfce1-8977-4855-b5ad-f3f45de7457a",
"data": null
}
{
"code": 51,
"message": "AnonymousStaffID长度必须至少为16个字符",
"request_id": "9fce5173-1e70-44fb-a78f-a7cec23b5e86",
"data": null
}
{
"code": 51,
"message": "目标类型不支持",
"request_id": "233813bb-2d0b-49db-9816-707c5b8a227c",
"data": null
}
{
"code": 51,
"message": "topn字段输入不合法",
"request_id": "ceccc0d7-2468-4826-9cc7-c44a274030ca",
"data": null
}
{
"code": 51,
"message": "targets字段输入个数超过限制",
"request_id": "fc208f4a-5db2-441b-a83a-677acc11fc6c",
"data": null
}
参数说明:
参数 | 说明 |
---|---|
code | 0 表示成功,非 0 表示失败 |
message | success 表示成功,其他值为失败信息 |
request_id | 请求id |
data.list.contnet | 文档内容 |
data.list.title | 文档标题 |
data.list.url | 文档链接 |