Commit 759fb3e4 by Archer Committed by GitHub

fix: plugin detail (#7224)

parent 1562b4b7
......@@ -68,7 +68,7 @@ docker compose up -d
| ![Demo](./.github/imgs/intro3.png) | ![Demo](./.github/imgs/intro4.png) |
`1` 应用编排能力
- [x] 规划 Agent 模式
- [x] Agent Skill 编排
- [x] 对话工作流、插件工作流,包含基础的 RPA 节点。
- [x] 用户交互
- [x] 双向 MCP
......@@ -89,13 +89,13 @@ docker compose up -d
- [x] 支持 txt,md,html,pdf,docx,pptx,csv,xlsx (有需要更多可 PR file loader),支持 url 读取、CSV 批量导入
- [x] 混合检索 & 重排
- [x] API 知识库
- [ ] RAG 模块热插拔
- [ ]
`4` OpenAPI 接口
- [x] completions 接口 (chat 模式对齐 GPT 接口)
- [x] 知识库 CRUD
- [x] 对话 CRUD
- [x] 自动化 OpenAPI 接口
`4` 插件能力
- [x] 系统工具热更新
- [ ] RAG 模块热热更新
- [ ] Agent-loop 热更新
- [ ] AI 实时生成插件
`5` 运营能力
- [x] 免登录分享窗口
......@@ -103,12 +103,6 @@ docker compose up -d
- [x] 统一查阅对话记录,并对数据进行标注
- [x] 应用运营日志
`6` 其他
- [x] 可视化模型配置。
- [x] 支持语音输入和输出 (可配置语音输入语音回答)
- [x] 模糊输入提示
- [x] 模板市场
<a href="#readme">
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
</a>
......@@ -116,7 +110,7 @@ docker compose up -d
## 💪 我们的项目 & 链接
- [快速开始本地开发](https://doc.fastgpt.io/self-host/dev/)
- [OpenAPI 文档](https://doc.fastgpt.io/openapi/intro)
- [OpenAPI 文档](https://cloud.fastgpt.io/apidoc/systemopenapi)
- [FastGPT-plugin](https://github.com/labring/fastgpt-plugin)
- [AI Proxy: 模型聚合负载均衡服务](https://github.com/labring/aiproxy)
- [Sealos:快速部署集群应用](https://github.com/labring/sealos)
......@@ -129,7 +123,6 @@ docker compose up -d
- [AI Proxy:大模型聚合服务](https://sealos.run/aiproxy/?k=fastgpt-github/)
- [SiliconCloud (硅基流动) —— 开源模型在线体验平台](https://cloud.siliconflow.cn/i/TR9Ym0c4)
- [PPIO 派欧云:一键调用高性价比的开源模型 API 和 GPU 容器](https://ppinfra.com/user/register?invited_by=VITYVU&utm_source=github_fastgpt)
<a href="#readme">
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
......
......@@ -68,7 +68,7 @@ If you encounter any issues, you can [view the complete Docker deployment tutori
| ![Demo](./.github/imgs/intro3.png) | ![Demo](./.github/imgs/intro4.png) |
`1` Application Orchestration
- [x] Planning Agent mode.
- [x] Agent Skill orchestration.
- [x] Dialogue workflow, plugin workflow, including basic RPA nodes.
- [x] User interaction
- [x] Bidirectional MCP
......@@ -89,13 +89,13 @@ If you encounter any issues, you can [view the complete Docker deployment tutori
- [x] Support for txt, md, html, pdf, docx, pptx, csv, xlsx (more can be PR'd), support for URL reading & CSV batch import
- [x] Hybrid retrieval & reranking
- [x] API knowledge base
- [ ] RAG module hot-swapping
- [ ]
`4` OpenAPI Interface
- [x] Completions interface (aligned with GPT chat mode)
- [x] Knowledge base CRUD
- [x] Dialogue CRUD
- [x] Automated OpenAPI interface
`4` Plugin Capabilities
- [x] System tool hot updates
- [ ] RAG module hot updates
- [ ] Agent-loop hot updates
- [ ] Real-time AI-generated plugins
`5` Operations Features
- [x] Login-free sharing window
......@@ -103,12 +103,6 @@ If you encounter any issues, you can [view the complete Docker deployment tutori
- [x] Unified dialogue record review with data annotation
- [x] Application operation logs
`6` Others
- [x] Visual model configuration.
- [x] Voice input and output support (configurable)
- [x] Fuzzy input hints
- [x] Template marketplace
<a href="#readme">
<img src="https://img.shields.io/badge/-Back_to_Top-7d09f1.svg" alt="#" align="right">
</a>
......@@ -116,7 +110,7 @@ If you encounter any issues, you can [view the complete Docker deployment tutori
## 💪 Our Projects & Links
- [Quick Start Local Development](https://doc.fastgpt.io/self-host/dev/)
- [OpenAPI Documentation](https://doc.fastgpt.io/openapi/intro)
- [OpenAPI Documentation](https://cloud.fastgpt.io/apidoc/systemopenapi)
- [FastGPT-plugin](https://github.com/labring/fastgpt-plugin)
- [AI Proxy: Model Aggregation Load Balancing Service](https://github.com/labring/aiproxy)
- [Sealos: Quick Cluster Application Deployment](https://github.com/labring/sealos)
......@@ -129,7 +123,6 @@ If you encounter any issues, you can [view the complete Docker deployment tutori
- [AI Proxy: Large Model Aggregation Service](https://sealos.run/aiproxy/?k=fastgpt-github/)
- [SiliconCloud - Open Source Model Online Experience Platform](https://cloud.siliconflow.cn/i/TR9Ym0c4)
- [PPIO: One-click Call to Cost-effective Open Source Model API and GPU Containers](https://ppinfra.com/user/register?invited_by=VITYVU&utm_source=github_fastgpt)
<a href="#readme">
<img src="https://img.shields.io/badge/-Back_to_Top-7d09f1.svg" alt="#" align="right">
......
......@@ -68,7 +68,7 @@ Jika Anda menghadapi masalah, Anda dapat [melihat tutorial penyebaran Docker len
| ![Demo](./.github/imgs/intro3.png) | ![Demo](./.github/imgs/intro4.png) |
`1` Kemampuan Orkestrasi Aplikasi
- [x] Mode Agent Perencanaan.
- [x] Orkestrasi Agent Skill.
- [x] Workflow percakapan, workflow plugin, termasuk node RPA dasar.
- [x] Interaksi pengguna
- [x] MCP dua arah
......@@ -89,13 +89,13 @@ Jika Anda menghadapi masalah, Anda dapat [melihat tutorial penyebaran Docker len
- [x] Dukungan txt, md, html, pdf, docx, pptx, csv, xlsx (lebih banyak dapat di-PR), dukungan pembacaan URL dan impor batch CSV
- [x] Pencarian hibrida & reranking
- [x] Basis pengetahuan API
- [ ] Hot-swapping modul RAG
- [ ]
`4` Antarmuka OpenAPI
- [x] Antarmuka completions (sesuai dengan mode chat GPT)
- [x] CRUD basis pengetahuan
- [x] CRUD percakapan
- [x] Antarmuka OpenAPI otomatis
`4` Kemampuan Plugin
- [x] Hot update tool sistem
- [ ] Hot update modul RAG
- [ ] Hot update Agent-loop
- [ ] Plugin yang dibuat AI secara real time
`5` Kemampuan Operasi
- [x] Jendela berbagi tanpa login
......@@ -103,12 +103,6 @@ Jika Anda menghadapi masalah, Anda dapat [melihat tutorial penyebaran Docker len
- [x] Tinjauan catatan percakapan terpadu dengan anotasi data
- [x] Log operasi aplikasi
`6` Lainnya
- [x] Konfigurasi model visual.
- [x] Dukungan input dan output suara (dapat dikonfigurasi)
- [x] Petunjuk input fuzzy
- [x] Pasar template
<a href="#readme">
<img src="https://img.shields.io/badge/-Kembali_ke_Atas-7d09f1.svg" alt="#" align="right">
</a>
......@@ -116,7 +110,7 @@ Jika Anda menghadapi masalah, Anda dapat [melihat tutorial penyebaran Docker len
## 💪 Proyek & Tautan Kami
- [Mulai Cepat Pengembangan Lokal](https://doc.fastgpt.io/self-host/dev/)
- [Dokumentasi OpenAPI](https://doc.fastgpt.io/openapi/intro)
- [Dokumentasi OpenAPI](https://cloud.fastgpt.io/apidoc/systemopenapi)
- [FastGPT-plugin](https://github.com/labring/fastgpt-plugin)
- [AI Proxy: Layanan Load Balancing Agregasi Model](https://github.com/labring/aiproxy)
- [Sealos: Penerapan Cepat Aplikasi Klaster](https://github.com/labring/sealos)
......@@ -129,7 +123,6 @@ Jika Anda menghadapi masalah, Anda dapat [melihat tutorial penyebaran Docker len
- [AI Proxy: Layanan Agregasi Model Besar](https://sealos.run/aiproxy/?k=fastgpt-github/)
- [SiliconCloud - Platform Pengalaman Online Model Open Source](https://cloud.siliconflow.cn/i/TR9Ym0c4)
- [PPIO: Panggilan Satu Klik ke API Model Open Source Hemat Biaya dan GPU Container](https://ppinfra.com/user/register?invited_by=VITYVU&utm_source=github_fastgpt)
<a href="#readme">
<img src="https://img.shields.io/badge/-Kembali_ke_Atas-7d09f1.svg" alt="#" align="right">
......
......@@ -68,7 +68,7 @@ docker compose up -d
| ![Demo](./.github/imgs/intro3.png) | ![Demo](./.github/imgs/intro4.png) |
`1` アプリケーションオーケストレーション
- [x] プランニング Agent モード
- [x] Agent Skill オーケストレーション
- [x] 対話ワークフロー、プラグインワークフロー、基本的な RPA ノードを含む
- [x] ユーザーインタラクション
- [x] 双方向 MCP
......@@ -89,13 +89,13 @@ docker compose up -d
- [x] txt, md, html, pdf, docx, pptx, csv, xlsx に対応(PR で追加可能)、URL 読み取りと CSV 一括インポートに対応
- [x] ハイブリッド検索 & リランキング
- [x] API ナレッジベース
- [ ] RAG モジュールのホットスワップ
- [ ]
`4` OpenAPI インターフェース
- [x] completions インターフェース(GPT チャットモードに準拠)
- [x] ナレッジベース CRUD
- [x] 対話 CRUD
- [x] 自動化 OpenAPI インターフェース
`4` プラグイン機能
- [x] システムツールのホットアップデート
- [ ] RAG モジュールのホットアップデート
- [ ] Agent-loop のホットアップデート
- [ ] AI によるプラグインのリアルタイム生成
`5` 運用機能
- [x] ログイン不要の共有ウィンドウ
......@@ -103,12 +103,6 @@ docker compose up -d
- [x] 統一された対話記録の閲覧とデータアノテーション
- [x] アプリケーション運用ログ
`6` その他
- [x] ビジュアルモデル設定
- [x] 音声入出力対応(設定可能)
- [x] あいまい入力ヒント
- [x] テンプレートマーケット
<a href="#readme">
<img src="https://img.shields.io/badge/-トップに戻る-7d09f1.svg" alt="#" align="right">
</a>
......@@ -116,7 +110,7 @@ docker compose up -d
## 💪 プロジェクトとリンク
- [クイックスタート ローカル開発](https://doc.fastgpt.io/self-host/dev/)
- [OpenAPI ドキュメント](https://doc.fastgpt.io/openapi/intro)
- [OpenAPI ドキュメント](https://cloud.fastgpt.io/apidoc/systemopenapi)
- [FastGPT-plugin](https://github.com/labring/fastgpt-plugin)
- [AI Proxy: モデル集約ロードバランシングサービス](https://github.com/labring/aiproxy)
- [Sealos: クラスタアプリケーションの迅速なデプロイ](https://github.com/labring/sealos)
......@@ -129,7 +123,6 @@ docker compose up -d
- [AI Proxy: 大規模モデル集約サービス](https://sealos.run/aiproxy/?k=fastgpt-github/)
- [SiliconCloud - オープンソースモデルオンライン体験プラットフォーム](https://cloud.siliconflow.cn/i/TR9Ym0c4)
- [PPIO: コスパの高いオープンソースモデル API と GPU コンテナをワンクリックで利用](https://ppinfra.com/user/register?invited_by=VITYVU&utm_source=github_fastgpt)
<a href="#readme">
<img src="https://img.shields.io/badge/-トップに戻る-7d09f1.svg" alt="#" align="right">
......
......@@ -68,7 +68,7 @@ docker compose up -d
| ![Demo](./.github/imgs/intro3.png) | ![Demo](./.github/imgs/intro4.png) |
`1` ความสามารถในการจัดระเบียบแอปพลิเคชัน
- [x] โหมด Agent วางแผน
- [x] การจัดระเบียบ Agent Skill
- [x] Workflow สนทนา, workflow ปลั๊กอิน, รวมถึงโหนด RPA พื้นฐาน
- [x] การโต้ตอบกับผู้ใช้
- [x] MCP สองทิศทาง
......@@ -89,13 +89,13 @@ docker compose up -d
- [x] รองรับ txt, md, html, pdf, docx, pptx, csv, xlsx (เพิ่มเติมได้โดย PR), รองรับการอ่าน URL และการนำเข้า CSV จำนวนมาก
- [x] การค้นหาแบบผสมและการจัดอันดับใหม่
- [x] ฐานความรู้ API
- [ ] การสลับโมดูล RAG แบบร้อน
- [ ]
`4` อินเทอร์เฟซ OpenAPI
- [x] อินเทอร์เฟซ completions (สอดคล้องกับโหมดแชท GPT)
- [x] CRUD ฐานความรู้
- [x] CRUD การสนทนา
- [x] อินเทอร์เฟซ OpenAPI อัตโนมัติ
`4` ความสามารถของปลั๊กอิน
- [x] การอัปเดต tool ระบบแบบ hot update
- [ ] การอัปเดตโมดูล RAG แบบ hot update
- [ ] การอัปเดต Agent-loop แบบ hot update
- [ ] ปลั๊กอินที่ AI สร้างแบบเรียลไทม์
`5` ความสามารถในการดำเนินงาน
- [x] หน้าต่างแชร์โดยไม่ต้องเข้าสู่ระบบ
......@@ -103,12 +103,6 @@ docker compose up -d
- [x] การตรวจสอบบันทึกการสนทนาแบบรวมพร้อมการใส่คำอธิบายข้อมูล
- [x] บันทึกการดำเนินงานแอปพลิเคชัน
`6` อื่นๆ
- [x] การกำหนดค่าโมเดลแบบภาพ
- [x] รองรับการป้อนเสียงและเอาต์พุต (กำหนดค่าได้)
- [x] คำแนะนำการป้อนข้อมูลแบบคลุมเครือ
- [x] ตลาดเทมเพลต
<a href="#readme">
<img src="https://img.shields.io/badge/-กลับด้านบน-7d09f1.svg" alt="#" align="right">
</a>
......@@ -116,7 +110,7 @@ docker compose up -d
## 💪 โปรเจกต์และลิงก์ของเรา
- [เริ่มต้นพัฒนาในเครื่อง](https://doc.fastgpt.io/self-host/dev/)
- [เอกสาร OpenAPI](https://doc.fastgpt.io/openapi/intro)
- [เอกสาร OpenAPI](https://cloud.fastgpt.io/apidoc/systemopenapi)
- [FastGPT-plugin](https://github.com/labring/fastgpt-plugin)
- [AI Proxy: บริการ Load Balancing การรวมโมเดล](https://github.com/labring/aiproxy)
- [Sealos: การติดตั้งแอปพลิเคชันคลัสเตอร์อย่างรวดเร็ว](https://github.com/labring/sealos)
......@@ -129,7 +123,6 @@ docker compose up -d
- [AI Proxy: บริการรวมโมเดลขนาดใหญ่](https://sealos.run/aiproxy/?k=fastgpt-github/)
- [SiliconCloud - แพลตฟอร์มประสบการณ์โมเดล Open Source ออนไลน์](https://cloud.siliconflow.cn/i/TR9Ym0c4)
- [PPIO: เรียกใช้ API โมเดล Open Source ราคาประหยัดและ GPU Container](https://ppinfra.com/user/register?invited_by=VITYVU&utm_source=github_fastgpt)
<a href="#readme">
<img src="https://img.shields.io/badge/-กลับด้านบน-7d09f1.svg" alt="#" align="right">
......
......@@ -68,7 +68,7 @@ Nếu bạn gặp vấn đề, bạn có thể [xem hướng dẫn triển khai
| ![Demo](./.github/imgs/intro3.png) | ![Demo](./.github/imgs/intro4.png) |
`1` Khả Năng Điều Phối Ứng Dụng
- [x] Chế độ Agent lập kế hoạch.
- [x] Điều phối Agent Skill.
- [x] Workflow hội thoại, workflow plugin, bao gồm các node RPA cơ bản.
- [x] Tương tác người dùng
- [x] MCP hai chiều
......@@ -89,13 +89,13 @@ Nếu bạn gặp vấn đề, bạn có thể [xem hướng dẫn triển khai
- [x] Hỗ trợ txt, md, html, pdf, docx, pptx, csv, xlsx (thêm qua PR), hỗ trợ đọc URL và nhập hàng loạt CSV
- [x] Tìm kiếm kết hợp & xếp hạng lại
- [x] Cơ sở kiến thức API
- [ ] Hot-swapping module RAG
- [ ]
`4` Giao Diện OpenAPI
- [x] Giao diện completions (tương thích với chế độ chat GPT)
- [x] CRUD cơ sở kiến thức
- [x] CRUD hội thoại
- [x] Giao diện OpenAPI tự động
`4` Khả Năng Plugin
- [x] Hot update tool hệ thống
- [ ] Hot update module RAG
- [ ] Hot update Agent-loop
- [ ] Plugin do AI tạo theo thời gian thực
`5` Khả Năng Vận Hành
- [x] Chia sẻ không cần đăng nhập
......@@ -103,12 +103,6 @@ Nếu bạn gặp vấn đề, bạn có thể [xem hướng dẫn triển khai
- [x] Xem lại nhật ký hội thoại tập trung với chú thích dữ liệu
- [x] Nhật ký vận hành ứng dụng
`6` Khác
- [x] Cấu hình mô hình trực quan.
- [x] Hỗ trợ nhập liệu và xuất giọng nói (có thể cấu hình)
- [x] Gợi ý nhập liệu mờ
- [x] Chợ template
<a href="#readme">
<img src="https://img.shields.io/badge/-Về_Đầu_Trang-7d09f1.svg" alt="#" align="right">
</a>
......@@ -116,7 +110,7 @@ Nếu bạn gặp vấn đề, bạn có thể [xem hướng dẫn triển khai
## 💪 Dự Án & Liên Kết Của Chúng Tôi
- [Bắt Đầu Phát Triển Địa Phương](https://doc.fastgpt.io/self-host/dev/)
- [Tài Liệu OpenAPI](https://doc.fastgpt.io/openapi/intro)
- [Tài Liệu OpenAPI](https://cloud.fastgpt.io/apidoc/systemopenapi)
- [FastGPT-plugin](https://github.com/labring/fastgpt-plugin)
- [AI Proxy: Dịch Vụ Cân Bằng Tải Tổng Hợp Mô Hình](https://github.com/labring/aiproxy)
- [Sealos: Triển Khai Nhanh Ứng Dụng Cụm](https://github.com/labring/sealos)
......@@ -129,7 +123,6 @@ Nếu bạn gặp vấn đề, bạn có thể [xem hướng dẫn triển khai
- [AI Proxy: Dịch Vụ Tổng Hợp Mô Hình Lớn](https://sealos.run/aiproxy/?k=fastgpt-github/)
- [SiliconCloud - Nền Tảng Trải Nghiệm Mô Hình Nguồn Mở Trực Tuyến](https://cloud.siliconflow.cn/i/TR9Ym0c4)
- [PPIO: Gọi API Mô Hình Nguồn Mở Tiết Kiệm và GPU Container](https://ppinfra.com/user/register?invited_by=VITYVU&utm_source=github_fastgpt)
<a href="#readme">
<img src="https://img.shields.io/badge/-Về_Đầu_Trang-7d09f1.svg" alt="#" align="right">
......
......@@ -9,20 +9,25 @@ import { useTranslation } from 'next-i18next';
import ComplianceTip from '@/components/common/ComplianceTip/index';
import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext';
import type { AIChatItemValueItemType } from '@fastgpt/global/core/chat/type';
import { ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
const RenderOutput = () => {
const { t } = useTranslation();
const histories = useContextSelector(ChatRecordContext, (v) => v.chatRecords);
const isChatting = useContextSelector(PluginRunContext, (v) => v.isChatting);
const aiRecord = useMemo(
() => [...histories].reverse().find((item) => item.obj === ChatRoleEnum.AI),
[histories]
);
const pluginOutputs = useMemo(() => {
const pluginOutputs = histories?.[1]?.responseData?.find(
const pluginOutputs = aiRecord?.responseData?.find(
(item) => item.moduleType === FlowNodeTypeEnum.pluginOutput
)?.pluginOutput;
return JSON.stringify(pluginOutputs, null, 2);
}, [histories]);
}, [aiRecord]);
return (
<>
......@@ -31,13 +36,13 @@ const RenderOutput = () => {
<Box color={'myGray.900'} fontWeight={'bold'}>
{t('chat:stream_output')}
</Box>
{histories.length > 0 && histories[1]?.value.length > 0 ? (
{aiRecord && aiRecord.value.length > 0 ? (
<Box mt={2}>
{histories[1].value.map((value, i) => {
const key = `${histories[1].dataId}-ai-${i}`;
{aiRecord.value.map((value, i) => {
const key = `${aiRecord.dataId}-ai-${i}`;
return (
<AIResponseBox
chatItemDataId={histories[1].dataId}
chatItemDataId={aiRecord.dataId}
key={key}
value={value as AIChatItemValueItemType}
isLastResponseValue={true}
......@@ -53,9 +58,7 @@ const RenderOutput = () => {
<Box border={'base'} mt={4} rounded={'md'} bg={'myGray.25'}>
<Box p={4} color={'myGray.900'} fontWeight={'bold'}>
<Box>{t('chat:plugins_output')}</Box>
{histories.length > 0 && histories[1].responseData ? (
<Markdown source={`~~~json\n${pluginOutputs}`} />
) : null}
{aiRecord?.responseData ? <Markdown source={`~~~json\n${pluginOutputs}`} /> : null}
</Box>
</Box>
<ComplianceTip type={'chat'} />
......
import { ResponseBox } from '../../../components/WholeResponseModal';
import React from 'react';
import React, { useMemo } from 'react';
import { useContextSelector } from 'use-context-selector';
import { PluginRunContext } from '../context';
import { Box } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext';
import { ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
const RenderResponseDetail = () => {
const { t } = useTranslation();
const chatRecords = useContextSelector(ChatRecordContext, (v) => v.chatRecords);
const isChatting = useContextSelector(PluginRunContext, (v) => v.isChatting);
const responseData = chatRecords?.[1]?.responseData || [];
const aiRecord = useMemo(
() => [...chatRecords].reverse().find((item) => item.obj === ChatRoleEnum.AI),
[chatRecords]
);
const responseData = aiRecord?.responseData || [];
return isChatting ? (
<>{t('chat:in_progress')}</>
) : (
<Box flex={'1 0 0'} h={'100%'} overflow={'auto'}>
<ResponseBox useMobile={true} response={responseData} dataId={chatRecords?.[1]?.dataId} />
{responseData.length > 0 ? (
<ResponseBox useMobile={true} response={responseData} dataId={aiRecord?.dataId} />
) : (
<EmptyTip text={t('chat:response.no_workflow_response')} />
)}
</Box>
);
};
......
......@@ -7,6 +7,7 @@ import { useContextSelector } from 'use-context-selector';
import RenderOutput from './components/RenderOutput';
import RenderResponseDetail from './components/RenderResponseDetail';
import { ChatItemContext } from '@/web/core/chat/context/chatItemContext';
import { Box } from '@chakra-ui/react';
const PluginRunBox = (props: PluginRunBoxProps) => {
const tab = useContextSelector(ChatItemContext, (v) => v.pluginRunTab);
......@@ -14,9 +15,11 @@ const PluginRunBox = (props: PluginRunBoxProps) => {
return (
<PluginRunContextProvider {...props}>
{formatTab === PluginRunBoxTabEnum.input && <RenderInput />}
{formatTab === PluginRunBoxTabEnum.output && <RenderOutput />}
{formatTab === PluginRunBoxTabEnum.detail && <RenderResponseDetail />}
<Box h={'100%'} minH={0} display={'flex'} flexDirection={'column'}>
{formatTab === PluginRunBoxTabEnum.input && <RenderInput />}
{formatTab === PluginRunBoxTabEnum.output && <RenderOutput />}
{formatTab === PluginRunBoxTabEnum.detail && <RenderResponseDetail />}
</Box>
</PluginRunContextProvider>
);
};
......
import React, { useCallback, useMemo, useRef, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Box, Flex, useDisclosure } from '@chakra-ui/react';
import { useSize } from 'ahooks';
import dynamic from 'next/dynamic';
......@@ -8,10 +8,7 @@ import Avatar from '@fastgpt/web/components/common/Avatar';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { useSystem } from '@fastgpt/web/hooks/useSystem';
import { useSafeTranslation } from '@fastgpt/web/hooks/useSafeTranslation';
import {
WHOLE_RESPONSE_SIDE_TAB_PANEL_PADDING,
WholeResponseSideTab
} from './SideTab';
import { WHOLE_RESPONSE_SIDE_TAB_PANEL_PADDING, WholeResponseSideTab } from './SideTab';
import { WholeResponseContent } from './WholeResponseContent';
import { flattenResponse, getSideTabItems, getSideTabMaxDepth } from './responseData';
......@@ -48,8 +45,20 @@ export const ResponseBox = React.memo(function ResponseBox({
flattedResponse[0]?.id ?? flattedResponse[0]?.nodeId ?? ''
);
useEffect(() => {
if (flattedResponse.length === 0) {
setCurrentNodeId('');
return;
}
if (flattedResponse.some((item) => item.id === currentNodeId)) return;
setCurrentNodeId(flattedResponse[0].id ?? flattedResponse[0].nodeId ?? '');
}, [currentNodeId, flattedResponse]);
const activeModule = useMemo(
() => flattedResponse.find((item) => item.id === currentNodeId) as ChatHistoryItemResType,
() =>
(flattedResponse.find((item) => item.id === currentNodeId) ||
flattedResponse[0]) as ChatHistoryItemResType,
[currentNodeId, flattedResponse]
);
......@@ -106,7 +115,7 @@ export const ResponseBox = React.memo(function ResponseBox({
</Box>
</Flex>
) : (
<Box h={'100%'} overflow={'auto'}>
<Box h={'100%'} minH={0} overflow={'hidden'}>
{!isOpenMobileModal && (
<WholeResponseSideTab
response={sliderResponseList}
......@@ -119,7 +128,7 @@ export const ResponseBox = React.memo(function ResponseBox({
/>
)}
{isOpenMobileModal && (
<Flex flexDirection={'column'} h={'100%'}>
<Flex flexDirection={'column'} h={'100%'} minH={0}>
<Flex
align={'center'}
justifyContent={'center'}
......@@ -161,11 +170,11 @@ export const ResponseBox = React.memo(function ResponseBox({
{t(activeModule.moduleName as any, activeModule.moduleNameArgs)}
</Box>
</Flex>
<Box ref={contentPanelRef} flex={'1 0 0'} minH={0} overflow={'hidden'}>
<Box ref={contentPanelRef} flex={'1 1 0'} minH={0} overflowY={'auto'}>
<WholeResponseContent
dataId={dataId}
activeModule={activeModule}
hideTabs={hideTabs}
hideTabs={true}
contentHeight={contentPanelSize?.height}
onOpenRequestIdDetail={handleOpenRequestIdDetail}
/>
......
......@@ -191,9 +191,9 @@ const DetailLogsModal = ({
{/* Chat container */}
<Flex flex={'1 0 0'} h={0} flexDirection={'column'}>
<Flex flex={'1 0 0'} h={0}>
<Box flex={'1 0 0'} h={'100%'} overflow={'auto'}>
<Box flex={'1 0 0'} h={'100%'} minH={0} overflow={isPlugin ? 'hidden' : 'auto'}>
{isPlugin ? (
<Box px={5} py={2}>
<Box px={5} py={2} h={'100%'} minH={0} display={'flex'} flexDirection={'column'}>
<PluginRunBox appId={appId} chatId={chatId} />
</Box>
) : (
......@@ -240,32 +240,33 @@ const DetailLogsModal = ({
)}
</Flex>
{/* Feedback filter bar - commented out, moved to Render component */}
<Flex
bg="white"
mx={6}
py={6}
h={'85px'}
minH={'85px'}
flexShrink={0}
borderTop="1px solid"
borderColor="myGray.200"
>
<DetailLogsModalFeedbackTypeFilter
feedbackType={feedbackType}
setFeedbackType={setFeedbackType}
unreadOnly={unreadOnly}
setUnreadOnly={setUnreadOnly}
appId={appId}
chatId={chatId}
currentRecordId={feedbackRecordId}
onRecordChange={handleRecordChange}
menuButtonProps={{
color: 'myGray.700',
_active: {}
}}
/>
</Flex>
{!isPlugin && (
<Flex
bg="white"
mx={6}
py={6}
h={'85px'}
minH={'85px'}
flexShrink={0}
borderTop="1px solid"
borderColor="myGray.200"
>
<DetailLogsModalFeedbackTypeFilter
feedbackType={feedbackType}
setFeedbackType={setFeedbackType}
unreadOnly={unreadOnly}
setUnreadOnly={setUnreadOnly}
appId={appId}
chatId={chatId}
currentRecordId={feedbackRecordId}
onRecordChange={handleRecordChange}
menuButtonProps={{
color: 'myGray.700',
_active: {}
}}
/>
</Flex>
)}
</Flex>
</MyBox>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment