This commit is contained in:
guo zebin
2026-04-10 17:34:39 +08:00
parent d767f58e2c
commit 4e4682c190
2 changed files with 48 additions and 7 deletions
+32
View File
@@ -0,0 +1,32 @@
# Fay 课程知识库
本目录存放 Fay 的课程知识包(`.zip` 格式),由「课程知识库」MCP server(`mcp_servers/fay_player_knowledge/`)加载,供 Fay 在对话中检索引用。
## 课程包来源
所有课程包均可在 **[https://player.fay-agent.com](https://player.fay-agent.com)** 在线创建或浏览,主要功能:
- 🌐 **浏览 / 创建** 课程知识包
- ▶️ **在线播放** 课程内容
- 🎬 **导出视频** 一键将课程包生成讲解视频
- 📄 **导出 Markdown 文档** 将课程内容转为 md 文档
- 🆓 **完全开源** 项目地址:[https://gitee.com/xszyou/fay-player](https://gitee.com/xszyou/fay-player)
下载得到的 `.zip` 放入本目录,即可被 Fay 引用。
## 当前包含的课程
| 课程包 | 简介 |
| --- | --- |
| Fay介绍(面向开发者).zip | Fay 数字人框架的整体架构与开发者上手指南 |
| Fay多用户对话消息分发逻辑.zip | 多用户场景下消息分发与会话隔离机制 |
| Fay的think标签处理逻辑.zip | `<think>` 标签从产生到记忆归档的全链路 |
| Fay的prestart标签处理逻辑.zip | `<prestart>` 标签的注册、调度与双通道注入 |
| OfficeEcho-course.zip | OfficeEcho 示例课程 |
## 使用方式
1. 在 [https://player.fay-agent.com](https://player.fay-agent.com) 创建或下载课程包;
2.`.zip` 文件放入本目录;
3. 启动 Fay 后,「课程知识库」MCP server 会自动加载并向 Fay 暴露 `search` / `get_section` 工具;
4. 与 Fay 对话时即可让它检索这些知识。
+16 -7
View File
@@ -32,13 +32,13 @@ _configure_console_streams()
def test_gpt(prompt, username="张三", observation="", no_reply=False):
url = 'http://192.168.1.18:1234/v1/chat/completions' # 替换为您的接口地址
url = 'http://127.0.0.1:5000/v1/chat/completions' # 替换为您的接口地址
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer sk-lm-W3h0kb9s:wjTMT85AtBtW4VFLnmyG', # 如果您的接口需要身份验证
}
data = {
'model': 'qwen/qwen3.5-9b', #model为llm时,会直接透传到上游的llm输出,fay不作任何处理、记录
'model': 'llm', #model为llm时,会直接透传到上游的llm输出,fay不作任何处理、记录
'messages': [
{'role': username, 'content': prompt}
],
@@ -75,11 +75,20 @@ def test_gpt(prompt, username="张三", observation="", no_reply=False):
data = json.loads(line)
# 从数据中提取生成的内容
choices = data.get('choices')
if choices:
delta = choices[0].get('delta', {})
content = delta.get('content', '')
if content:
_print_stream_content(content)
if choices:
delta = choices[0].get('delta', {})
content = delta.get('content', '')
tool_calls = delta.get('tool_calls')
function_call = delta.get('function_call')
finish_reason = choices[0].get('finish_reason')
if content:
_print_stream_content(content)
if tool_calls:
print("\n[tool_calls] " + json.dumps(tool_calls, ensure_ascii=False), end="", flush=True)
if function_call:
print("\n[function_call] " + json.dumps(function_call, ensure_ascii=False), end="", flush=True)
if finish_reason and finish_reason != "stop":
print(f"\n[finish_reason] {finish_reason}", end="", flush=True)
except json.JSONDecodeError:
print(f"\n无法解析的 JSON 数据:{line}")
else: