mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-10 15:56:03 +00:00
Compare commits
5 Commits
v4.0.0-bet
...
v4.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd68760c75 | ||
|
|
13d36412dd | ||
|
|
f2e1ae432c | ||
|
|
0f30f1dcbd | ||
|
|
d070737ef7 |
@@ -46,7 +46,7 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
- name: Package Output
|
- name: Package Output
|
||||||
run: |
|
run: |
|
||||||
cp -r /tmp/langbot_build_web/web/dist ./web
|
cp -r /tmp/langbot_build_web/web/out ./web
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -9,10 +9,8 @@
|
|||||||
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
|
|
||||||
<a href="https://langbot.app">项目主页</a> |
|
<a href="https://langbot.app">项目主页</a> |
|
||||||
<a href="https://docs.langbot.app/insight/intro.html">功能介绍</a> |
|
<a href="https://docs.langbot.app/zh/insight/guide.html">部署文档</a> |
|
||||||
<a href="https://docs.langbot.app/insight/guide.html">部署文档</a> |
|
<a href="https://docs.langbot.app/zh/plugin/plugin-intro.html">插件介绍</a> |
|
||||||
<a href="https://docs.langbot.app/usage/faq.html">常见问题</a> |
|
|
||||||
<a href="https://docs.langbot.app/plugin/plugin-intro.html">插件介绍</a> |
|
|
||||||
<a href="https://github.com/RockChinQ/LangBot/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6">提交插件</a>
|
<a href="https://github.com/RockChinQ/LangBot/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6">提交插件</a>
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
@@ -39,22 +37,22 @@
|
|||||||
|
|
||||||
- 💬 大模型对话、Agent:支持多种大模型,适配群聊和私聊;具有多轮对话、工具调用、多模态能力,并深度适配 [Dify](https://dify.ai)。目前支持 QQ、QQ频道、企业微信、个人微信、飞书、Discord、Telegram 等平台。
|
- 💬 大模型对话、Agent:支持多种大模型,适配群聊和私聊;具有多轮对话、工具调用、多模态能力,并深度适配 [Dify](https://dify.ai)。目前支持 QQ、QQ频道、企业微信、个人微信、飞书、Discord、Telegram 等平台。
|
||||||
- 🛠️ 高稳定性、功能完备:原生支持访问控制、限速、敏感词过滤等机制;配置简单,支持多种部署方式。
|
- 🛠️ 高稳定性、功能完备:原生支持访问控制、限速、敏感词过滤等机制;配置简单,支持多种部署方式。
|
||||||
- 🧩 插件扩展、活跃社区:支持事件驱动、组件扩展等插件机制;适配 Anthropic [MCP 协议](https://modelcontextprotocol.io/);目前已有数十个[插件](https://docs.langbot.app/plugin/plugin-intro.html)
|
- 🧩 插件扩展、活跃社区:支持事件驱动、组件扩展等插件机制;适配 Anthropic [MCP 协议](https://modelcontextprotocol.io/);目前已有数百个插件。
|
||||||
- 😻 [New] Web 管理面板:支持通过浏览器管理 LangBot 实例,具体支持功能,查看[文档](https://docs.langbot.app/webui/intro.html)
|
- 😻 Web 管理面板:支持通过浏览器管理 LangBot 实例,不再需要手动编写配置文件。
|
||||||
|
|
||||||
## 📦 开始使用
|
## 📦 开始使用
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
>
|
>
|
||||||
> 在您开始任何方式部署之前,请务必阅读[新手指引](https://docs.langbot.app/insight/guide.html)。
|
> 在您开始任何方式部署之前,请务必阅读[新手指引](https://docs.langbot.app/zh/insight/guide.html)。
|
||||||
|
|
||||||
#### Docker Compose 部署
|
#### Docker Compose 部署
|
||||||
|
|
||||||
适合熟悉 Docker 的用户,查看文档[Docker 部署](https://docs.langbot.app/deploy/langbot/docker.html)。
|
适合熟悉 Docker 的用户,查看文档[Docker 部署](https://docs.langbot.app/zh/deploy/langbot/docker.html)。
|
||||||
|
|
||||||
#### 宝塔面板部署
|
#### 宝塔面板部署
|
||||||
|
|
||||||
已上架宝塔面板,若您已安装宝塔面板,可以根据[文档](https://docs.langbot.app/deploy/langbot/one-click/bt.html)使用。
|
已上架宝塔面板,若您已安装宝塔面板,可以根据[文档](https://docs.langbot.app/zh/deploy/langbot/one-click/bt.html)使用。
|
||||||
|
|
||||||
#### Zeabur 云部署
|
#### Zeabur 云部署
|
||||||
|
|
||||||
@@ -68,7 +66,7 @@
|
|||||||
|
|
||||||
#### 手动部署
|
#### 手动部署
|
||||||
|
|
||||||
直接使用发行版运行,查看文档[手动部署](https://docs.langbot.app/deploy/langbot/manual.html)。
|
直接使用发行版运行,查看文档[手动部署](https://docs.langbot.app/zh/deploy/langbot/manual.html)。
|
||||||
|
|
||||||
## 📸 效果展示
|
## 📸 效果展示
|
||||||
|
|
||||||
|
|||||||
18
README_EN.md
18
README_EN.md
@@ -8,10 +8,8 @@
|
|||||||
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
|
|
||||||
<a href="https://langbot.app">Home</a> |
|
<a href="https://langbot.app">Home</a> |
|
||||||
<a href="https://docs.langbot.app/insight/intro.html">Features</a> |
|
<a href="https://docs.langbot.app/zh/insight/guide.html">Deployment</a> |
|
||||||
<a href="https://docs.langbot.app/insight/guide.html">Deployment</a> |
|
<a href="https://docs.langbot.app/zh/plugin/plugin-intro.html">Plugin</a> |
|
||||||
<a href="https://docs.langbot.app/usage/faq.html">FAQ</a> |
|
|
||||||
<a href="https://docs.langbot.app/plugin/plugin-intro.html">Plugin</a> |
|
|
||||||
<a href="https://github.com/RockChinQ/LangBot/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6">Submit Plugin</a>
|
<a href="https://github.com/RockChinQ/LangBot/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6">Submit Plugin</a>
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
@@ -36,24 +34,24 @@
|
|||||||
|
|
||||||
- 💬 Chat with LLM / Agent: Supports multiple LLMs, adapt to group chats and private chats; Supports multi-round conversations, tool calls, and multi-modal capabilities. Deeply integrates with [Dify](https://dify.ai). Currently supports QQ, QQ Channel, WeCom, personal WeChat, Lark, DingTalk, Discord, Telegram, etc.
|
- 💬 Chat with LLM / Agent: Supports multiple LLMs, adapt to group chats and private chats; Supports multi-round conversations, tool calls, and multi-modal capabilities. Deeply integrates with [Dify](https://dify.ai). Currently supports QQ, QQ Channel, WeCom, personal WeChat, Lark, DingTalk, Discord, Telegram, etc.
|
||||||
- 🛠️ High Stability, Feature-rich: Native access control, rate limiting, sensitive word filtering, etc. mechanisms; Easy to use, supports multiple deployment methods.
|
- 🛠️ High Stability, Feature-rich: Native access control, rate limiting, sensitive word filtering, etc. mechanisms; Easy to use, supports multiple deployment methods.
|
||||||
- 🧩 Plugin Extension, Active Community: Support event-driven, component extension, etc. plugin mechanisms; Integrate Anthropic [MCP protocol](https://modelcontextprotocol.io/); Currently has dozens of [plugins](https://docs.langbot.app/plugin/plugin-intro.html)
|
- 🧩 Plugin Extension, Active Community: Support event-driven, component extension, etc. plugin mechanisms; Integrate Anthropic [MCP protocol](https://modelcontextprotocol.io/); Currently has hundreds of plugins.
|
||||||
- 😻 [New] Web UI: Support management LangBot instance through the browser, for details, see [documentation](https://docs.langbot.app/webui/intro.html)
|
- 😻 [New] Web UI: Support management LangBot instance through the browser. No need to manually write configuration files.
|
||||||
|
|
||||||
## 📦 Getting Started
|
## 📦 Getting Started
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
>
|
>
|
||||||
> - Before you start deploying in any way, please read the [New User Guide](https://docs.langbot.app/insight/guide.html).
|
> - Before you start deploying in any way, please read the [New User Guide](https://docs.langbot.app/zh/insight/guide.html).
|
||||||
> - All documentation is in Chinese, we will provide i18n version in the near future.
|
> - All documentation is in Chinese, we will provide i18n version in the near future.
|
||||||
> - Read [the auto-generated wiki on DeepWiki](https://deepwiki.com/RockChinQ/LangBot).
|
> - Read [the auto-generated wiki on DeepWiki](https://deepwiki.com/RockChinQ/LangBot).
|
||||||
|
|
||||||
#### Docker Compose Deployment
|
#### Docker Compose Deployment
|
||||||
|
|
||||||
Suitable for users familiar with Docker, see the [Docker Deployment](https://docs.langbot.app/deploy/langbot/docker.html) documentation.
|
Suitable for users familiar with Docker, see the [Docker Deployment](https://docs.langbot.app/zh/deploy/langbot/docker.html) documentation.
|
||||||
|
|
||||||
#### One-click Deployment on BTPanel
|
#### One-click Deployment on BTPanel
|
||||||
|
|
||||||
LangBot has been listed on the BTPanel, if you have installed the BTPanel, you can use the [document](https://docs.langbot.app/deploy/langbot/one-click/bt.html) to use it.
|
LangBot has been listed on the BTPanel, if you have installed the BTPanel, you can use the [document](https://docs.langbot.app/zh/deploy/langbot/one-click/bt.html) to use it.
|
||||||
|
|
||||||
#### Zeabur Cloud Deployment
|
#### Zeabur Cloud Deployment
|
||||||
|
|
||||||
@@ -67,7 +65,7 @@ Community contributed Zeabur template.
|
|||||||
|
|
||||||
#### Other Deployment Methods
|
#### Other Deployment Methods
|
||||||
|
|
||||||
Directly use the released version to run, see the [Manual Deployment](https://docs.langbot.app/deploy/langbot/manual.html) documentation.
|
Directly use the released version to run, see the [Manual Deployment](https://docs.langbot.app/zh/deploy/langbot/manual.html) documentation.
|
||||||
|
|
||||||
## 📸 Demo
|
## 📸 Demo
|
||||||
|
|
||||||
|
|||||||
18
README_JP.md
18
README_JP.md
@@ -8,10 +8,8 @@
|
|||||||
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
<a href="https://trendshift.io/repositories/12901" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12901" alt="RockChinQ%2FLangBot | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
|
|
||||||
<a href="https://langbot.app">ホーム</a> |
|
<a href="https://langbot.app">ホーム</a> |
|
||||||
<a href="https://docs.langbot.app/insight/intro.html">機能</a> |
|
<a href="https://docs.langbot.app/zh/insight/guide.html">デプロイ</a> |
|
||||||
<a href="https://docs.langbot.app/insight/guide.html">デプロイ</a> |
|
<a href="https://docs.langbot.app/zh/plugin/plugin-intro.html">プラグイン</a> |
|
||||||
<a href="https://docs.langbot.app/usage/faq.html">FAQ</a> |
|
|
||||||
<a href="https://docs.langbot.app/plugin/plugin-intro.html">プラグイン</a> |
|
|
||||||
<a href="https://github.com/RockChinQ/LangBot/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6">プラグインの提出</a>
|
<a href="https://github.com/RockChinQ/LangBot/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6">プラグインの提出</a>
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
@@ -35,24 +33,24 @@
|
|||||||
|
|
||||||
- 💬 LLM / エージェントとのチャット: 複数のLLMをサポートし、グループチャットとプライベートチャットに対応。マルチラウンドの会話、ツールの呼び出し、マルチモーダル機能をサポート。 [Dify](https://dify.ai) と深く統合。現在、QQ、QQ チャンネル、WeChat、個人 WeChat、Lark、DingTalk、Discord、Telegram など、複数のプラットフォームをサポートしています。
|
- 💬 LLM / エージェントとのチャット: 複数のLLMをサポートし、グループチャットとプライベートチャットに対応。マルチラウンドの会話、ツールの呼び出し、マルチモーダル機能をサポート。 [Dify](https://dify.ai) と深く統合。現在、QQ、QQ チャンネル、WeChat、個人 WeChat、Lark、DingTalk、Discord、Telegram など、複数のプラットフォームをサポートしています。
|
||||||
- 🛠️ 高い安定性、豊富な機能: ネイティブのアクセス制御、レート制限、敏感な単語のフィルタリングなどのメカニズムをサポート。使いやすく、複数のデプロイ方法をサポート。
|
- 🛠️ 高い安定性、豊富な機能: ネイティブのアクセス制御、レート制限、敏感な単語のフィルタリングなどのメカニズムをサポート。使いやすく、複数のデプロイ方法をサポート。
|
||||||
- 🧩 プラグイン拡張、活発なコミュニティ: イベント駆動、コンポーネント拡張などのプラグインメカニズムをサポート。適配 Anthropic [MCP プロトコル](https://modelcontextprotocol.io/);豊富なエコシステム、現在数十の[プラグイン](https://docs.langbot.app/plugin/plugin-intro.html)が存在。
|
- 🧩 プラグイン拡張、活発なコミュニティ: イベント駆動、コンポーネント拡張などのプラグインメカニズムをサポート。適配 Anthropic [MCP プロトコル](https://modelcontextprotocol.io/);豊富なエコシステム、現在数百のプラグインが存在。
|
||||||
- 😻 [新機能] Web UI: ブラウザを通じてLangBotインスタンスを管理することをサポート。詳細は[ドキュメント](https://docs.langbot.app/webui/intro.html)を参照。
|
- 😻 Web UI: ブラウザを通じてLangBotインスタンスを管理することをサポート。
|
||||||
|
|
||||||
## 📦 始め方
|
## 📦 始め方
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
>
|
>
|
||||||
> - どのデプロイ方法を始める前に、必ず[新規ユーザーガイド](https://docs.langbot.app/insight/guide.html)をお読みください。
|
> - どのデプロイ方法を始める前に、必ず[新規ユーザーガイド](https://docs.langbot.app/zh/insight/guide.html)をお読みください。
|
||||||
> - すべてのドキュメントは中国語で提供されています。近い将来、i18nバージョンを提供する予定です。
|
> - すべてのドキュメントは中国語で提供されています。近い将来、i18nバージョンを提供する予定です。
|
||||||
> - Read [the auto-generated wiki on DeepWiki](https://deepwiki.com/RockChinQ/LangBot)。
|
> - Read [the auto-generated wiki on DeepWiki](https://deepwiki.com/RockChinQ/LangBot)。
|
||||||
|
|
||||||
#### Docker Compose デプロイ
|
#### Docker Compose デプロイ
|
||||||
|
|
||||||
Dockerに慣れているユーザーに適しています。[Dockerデプロイ](https://docs.langbot.app/deploy/langbot/docker.html)のドキュメントを参照してください。
|
Dockerに慣れているユーザーに適しています。[Dockerデプロイ](https://docs.langbot.app/zh/deploy/langbot/docker.html)のドキュメントを参照してください。
|
||||||
|
|
||||||
#### BTPanelでのワンクリックデプロイ
|
#### BTPanelでのワンクリックデプロイ
|
||||||
|
|
||||||
LangBotはBTPanelにリストされています。BTPanelをインストールしている場合は、[ドキュメント](https://docs.langbot.app/deploy/langbot/one-click/bt.html)を使用して使用できます。
|
LangBotはBTPanelにリストされています。BTPanelをインストールしている場合は、[ドキュメント](https://docs.langbot.app/zh/deploy/langbot/one-click/bt.html)を使用して使用できます。
|
||||||
|
|
||||||
#### Zeaburクラウドデプロイ
|
#### Zeaburクラウドデプロイ
|
||||||
|
|
||||||
@@ -66,7 +64,7 @@ LangBotはBTPanelにリストされています。BTPanelをインストール
|
|||||||
|
|
||||||
#### その他のデプロイ方法
|
#### その他のデプロイ方法
|
||||||
|
|
||||||
リリースバージョンを直接使用して実行します。[手動デプロイ](https://docs.langbot.app/deploy/langbot/manual.html)のドキュメントを参照してください。
|
リリースバージョンを直接使用して実行します。[手動デプロイ](https://docs.langbot.app/zh/deploy/langbot/manual.html)のドキュメントを参照してください。
|
||||||
|
|
||||||
## 📸 デモ
|
## 📸 デモ
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class Conversation(pydantic.BaseModel):
|
|||||||
|
|
||||||
update_time: typing.Optional[datetime.datetime] = pydantic.Field(default_factory=datetime.datetime.now)
|
update_time: typing.Optional[datetime.datetime] = pydantic.Field(default_factory=datetime.datetime.now)
|
||||||
|
|
||||||
use_llm_model: requester.RuntimeLLMModel
|
use_llm_model: typing.Optional[requester.RuntimeLLMModel] = None
|
||||||
|
|
||||||
use_funcs: typing.Optional[list[tools_entities.LLMFunction]]
|
use_funcs: typing.Optional[list[tools_entities.LLMFunction]]
|
||||||
|
|
||||||
|
|||||||
@@ -30,36 +30,48 @@ class PreProcessor(stage.PipelineStage):
|
|||||||
stage_inst_name: str,
|
stage_inst_name: str,
|
||||||
) -> entities.StageProcessResult:
|
) -> entities.StageProcessResult:
|
||||||
"""处理"""
|
"""处理"""
|
||||||
|
selected_runner = query.pipeline_config['ai']['runner']['runner']
|
||||||
|
|
||||||
session = await self.ap.sess_mgr.get_session(query)
|
session = await self.ap.sess_mgr.get_session(query)
|
||||||
|
|
||||||
conversation = await self.ap.sess_mgr.get_conversation(
|
# 非 local-agent 时,llm_model 为 None
|
||||||
query, session, query.pipeline_config['ai']['local-agent']['prompt']
|
llm_model = (
|
||||||
|
await self.ap.model_mgr.get_model_by_uuid(query.pipeline_config['ai']['local-agent']['model'])
|
||||||
|
if selected_runner == 'local-agent'
|
||||||
|
else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
conversation = await self.ap.sess_mgr.get_conversation(
|
||||||
|
query,
|
||||||
|
session,
|
||||||
|
query.pipeline_config['ai']['local-agent']['prompt'],
|
||||||
|
)
|
||||||
|
|
||||||
|
conversation.use_llm_model = llm_model
|
||||||
|
|
||||||
# 设置query
|
# 设置query
|
||||||
query.session = session
|
query.session = session
|
||||||
query.prompt = conversation.prompt.copy()
|
query.prompt = conversation.prompt.copy()
|
||||||
query.messages = conversation.messages.copy()
|
query.messages = conversation.messages.copy()
|
||||||
|
|
||||||
query.use_llm_model = conversation.use_llm_model
|
query.use_llm_model = llm_model
|
||||||
|
|
||||||
query.use_funcs = (
|
if selected_runner == 'local-agent':
|
||||||
conversation.use_funcs if query.use_llm_model.model_entity.abilities.__contains__('tool_call') else None
|
query.use_funcs = (
|
||||||
)
|
conversation.use_funcs if query.use_llm_model.model_entity.abilities.__contains__('tool_call') else None
|
||||||
|
)
|
||||||
|
|
||||||
query.variables = {
|
query.variables = {
|
||||||
'session_id': f'{query.session.launcher_type.value}_{query.session.launcher_id}',
|
'session_id': f'{query.session.launcher_type.value}_{query.session.launcher_id}',
|
||||||
'conversation_id': conversation.uuid,
|
'conversation_id': conversation.uuid,
|
||||||
'msg_create_time': int(query.message_event.time)
|
'msg_create_time': (
|
||||||
if query.message_event.time
|
int(query.message_event.time) if query.message_event.time else int(datetime.datetime.now().timestamp())
|
||||||
else int(datetime.datetime.now().timestamp()),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if this model supports vision, if not, remove all images
|
# Check if this model supports vision, if not, remove all images
|
||||||
# TODO this checking should be performed in runner, and in this stage, the image should be reserved
|
# TODO this checking should be performed in runner, and in this stage, the image should be reserved
|
||||||
if query.pipeline_config['ai']['runner'][
|
if selected_runner == 'local-agent' and not query.use_llm_model.model_entity.abilities.__contains__('vision'):
|
||||||
'runner'
|
|
||||||
] == 'local-agent' and not query.use_llm_model.model_entity.abilities.__contains__('vision'):
|
|
||||||
for msg in query.messages:
|
for msg in query.messages:
|
||||||
if isinstance(msg.content, list):
|
if isinstance(msg.content, list):
|
||||||
for me in msg.content:
|
for me in msg.content:
|
||||||
@@ -75,9 +87,9 @@ class PreProcessor(stage.PipelineStage):
|
|||||||
content_list.append(llm_entities.ContentElement.from_text(me.text))
|
content_list.append(llm_entities.ContentElement.from_text(me.text))
|
||||||
plain_text += me.text
|
plain_text += me.text
|
||||||
elif isinstance(me, platform_message.Image):
|
elif isinstance(me, platform_message.Image):
|
||||||
if query.pipeline_config['ai']['runner'][
|
if selected_runner != 'local-agent' or query.use_llm_model.model_entity.abilities.__contains__(
|
||||||
'runner'
|
'vision'
|
||||||
] != 'local-agent' or query.use_llm_model.model_entity.abilities.__contains__('vision'):
|
):
|
||||||
if me.base64 is not None:
|
if me.base64 is not None:
|
||||||
content_list.append(llm_entities.ContentElement.from_image_base64(me.base64))
|
content_list.append(llm_entities.ContentElement.from_image_base64(me.base64))
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class ModelManager:
|
|||||||
for model in self.model_list:
|
for model in self.model_list:
|
||||||
if model.name == name:
|
if model.name == name:
|
||||||
return model
|
return model
|
||||||
raise ValueError(f'无法确定模型 {name} 的信息,请在元数据中配置')
|
raise ValueError(f'无法确定模型 {name} 的信息')
|
||||||
|
|
||||||
async def get_model_by_uuid(self, uuid: str) -> entities.LLMModelInfo:
|
async def get_model_by_uuid(self, uuid: str) -> entities.LLMModelInfo:
|
||||||
"""通过uuid获取模型"""
|
"""通过uuid获取模型"""
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class DifyServiceAPIRunner(runner.RequestRunner):
|
|||||||
user=f'{query.session.launcher_type.value}_{query.session.launcher_id}',
|
user=f'{query.session.launcher_type.value}_{query.session.launcher_id}',
|
||||||
conversation_id=cov_id,
|
conversation_id=cov_id,
|
||||||
files=files,
|
files=files,
|
||||||
timeout=self.pipeline_config['ai']['dify-service-api']['timeout'],
|
timeout=120,
|
||||||
):
|
):
|
||||||
self.ap.logger.debug('dify-chat-chunk: ' + str(chunk))
|
self.ap.logger.debug('dify-chat-chunk: ' + str(chunk))
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ class DifyServiceAPIRunner(runner.RequestRunner):
|
|||||||
response_mode='streaming',
|
response_mode='streaming',
|
||||||
conversation_id=cov_id,
|
conversation_id=cov_id,
|
||||||
files=files,
|
files=files,
|
||||||
timeout=self.pipeline_config['ai']['dify-service-api']['timeout'],
|
timeout=120,
|
||||||
):
|
):
|
||||||
self.ap.logger.debug('dify-agent-chunk: ' + str(chunk))
|
self.ap.logger.debug('dify-agent-chunk: ' + str(chunk))
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ class DifyServiceAPIRunner(runner.RequestRunner):
|
|||||||
inputs=inputs,
|
inputs=inputs,
|
||||||
user=f'{query.session.launcher_type.value}_{query.session.launcher_id}',
|
user=f'{query.session.launcher_type.value}_{query.session.launcher_id}',
|
||||||
files=files,
|
files=files,
|
||||||
timeout=self.pipeline_config['ai']['dify-service-api']['timeout'],
|
timeout=120,
|
||||||
):
|
):
|
||||||
self.ap.logger.debug('dify-workflow-chunk: ' + str(chunk))
|
self.ap.logger.debug('dify-workflow-chunk: ' + str(chunk))
|
||||||
if chunk['event'] in ignored_events:
|
if chunk['event'] in ignored_events:
|
||||||
|
|||||||
@@ -62,9 +62,6 @@ class SessionManager:
|
|||||||
conversation = core_entities.Conversation(
|
conversation = core_entities.Conversation(
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
messages=[],
|
messages=[],
|
||||||
use_llm_model=await self.ap.model_mgr.get_model_by_uuid(
|
|
||||||
query.pipeline_config['ai']['local-agent']['model']
|
|
||||||
),
|
|
||||||
use_funcs=await self.ap.tool_mgr.get_all_functions(
|
use_funcs=await self.ap.tool_mgr.get_all_functions(
|
||||||
plugin_enabled=True,
|
plugin_enabled=True,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user