dispatchAssistant("setting", { max_token: Number(e.target.value) })
diff --git a/src/frontend/src/pages/BuildPage/flow/FlowChat/ChatMessages.tsx b/src/frontend/src/pages/BuildPage/flow/FlowChat/ChatMessages.tsx
index 8bd83b114..a95cf364c 100644
--- a/src/frontend/src/pages/BuildPage/flow/FlowChat/ChatMessages.tsx
+++ b/src/frontend/src/pages/BuildPage/flow/FlowChat/ChatMessages.tsx
@@ -119,10 +119,6 @@ export default function ChatMessages({ mark = false, logo, useName, guideWord, l
return
;
case 'node_run':
return
;
- // case 'file':
- // return
;
- // case 'runLog':
- // return
;
default:
return
Unknown message type
;
}
diff --git a/src/frontend/src/pages/BuildPage/flow/FlowChat/messageStore.ts b/src/frontend/src/pages/BuildPage/flow/FlowChat/messageStore.ts
index 531bdd8b1..9b26eeee4 100644
--- a/src/frontend/src/pages/BuildPage/flow/FlowChat/messageStore.ts
+++ b/src/frontend/src/pages/BuildPage/flow/FlowChat/messageStore.ts
@@ -54,7 +54,7 @@ const handleHistoryMsg = (data: any[]): ChatMessageType[] => {
.replace(/\t/g, '\\t') // 转义制表符
.replace(/'/g, '"'); // 将单引号替换为双引号
- return data.filter(item => ['answer', 'question', 'processing', 'system', 'report', 'tool', 'knowledge', 'divider', 'flow'].includes(item.category)).map(item => {
+ return data.filter(item => ["question", "output_input_msg", "output_choose_msg", "stream_msg", "output_msg", "guide_question", "guide_word", "user_input", "node_run"].includes(item.category)).map(item => {
let { message, files, is_bot, intermediate_steps, category, ...other } = item
try {
message = message && message[0] === '{' ? JSON.parse(message) : message || ''
@@ -170,6 +170,7 @@ export const useMessageStore = create
((set, get) => ({
})
},
async loadHistoryMsg(flowid, chatId, { lastMsg }) {
+ console.log('1234 :>> ', 1234);
const res = await getChatHistory(flowid, chatId, 30, 0)
const msgs = handleHistoryMsg(res)
const hisMessages = msgs.reverse()
diff --git a/src/frontend/src/pages/BuildPage/flow/FlowNode/Parameter.tsx b/src/frontend/src/pages/BuildPage/flow/FlowNode/Parameter.tsx
index 86381f217..6e9230d12 100644
--- a/src/frontend/src/pages/BuildPage/flow/FlowNode/Parameter.tsx
+++ b/src/frontend/src/pages/BuildPage/flow/FlowNode/Parameter.tsx
@@ -67,6 +67,8 @@ export default function Parameter({ nodeId, item, onOutPutChange, onStatusChange
return
case 'bisheng_model':
return
+ case 'agent_model':
+ return
case 'slide':
return
case 'slide_switch':
diff --git a/src/frontend/src/pages/BuildPage/flow/FlowNode/component/KnowledgeSelectItem.tsx b/src/frontend/src/pages/BuildPage/flow/FlowNode/component/KnowledgeSelectItem.tsx
index 4cb4744d3..379033f7b 100644
--- a/src/frontend/src/pages/BuildPage/flow/FlowNode/component/KnowledgeSelectItem.tsx
+++ b/src/frontend/src/pages/BuildPage/flow/FlowNode/component/KnowledgeSelectItem.tsx
@@ -26,8 +26,8 @@ type KnowledgeTypeValues = `${KnowledgeType}`;
export default function KnowledgeSelectItem({ data, onChange, onValidate }) {
const { flow } = useFlowStore()
- const currentTabRef = useRef(data.value.tab)
- const [tabType, setTabType] = useState(data.value.tab)
+ const currentTabRef = useRef(data.value.type)
+ const [tabType, setTabType] = useState(data.value.type)
const [value, setValue] = useState(() => data.value.value.map(el => {
return { label: el.label, value: el.key }
}))
diff --git a/src/frontend/src/pages/BuildPage/flow/FlowNode/component/ModelItem.tsx b/src/frontend/src/pages/BuildPage/flow/FlowNode/component/ModelItem.tsx
index 860ff989e..fbf901db9 100644
--- a/src/frontend/src/pages/BuildPage/flow/FlowNode/component/ModelItem.tsx
+++ b/src/frontend/src/pages/BuildPage/flow/FlowNode/component/ModelItem.tsx
@@ -1,13 +1,13 @@
import { Label } from "@/components/bs-ui/label";
import Cascader from "@/components/bs-ui/select/cascader";
-import { getModelListApi } from "@/controllers/API/finetune";
+import { getAssistantModelList, getModelListApi } from "@/controllers/API/finetune";
import { useEffect, useMemo, useState } from "react";
-export default function ModelItem({ data, onChange, onValidate }) {
+export default function ModelItem({ agent = false, data, onChange, onValidate }) {
const [options, setOptions] = useState([])
useEffect(() => {
- getModelListApi().then(res => {
+ (agent ? getAssistantModelList() : getModelListApi()).then(res => {
let llmOptions = []
let embeddings = []
res.forEach(server => {
diff --git a/src/frontend/src/pages/BuildPage/flow/FlowNode/component/VarInput.tsx b/src/frontend/src/pages/BuildPage/flow/FlowNode/component/VarInput.tsx
index 6b7010fcf..69a9fd6de 100644
--- a/src/frontend/src/pages/BuildPage/flow/FlowNode/component/VarInput.tsx
+++ b/src/frontend/src/pages/BuildPage/flow/FlowNode/component/VarInput.tsx
@@ -2,9 +2,10 @@ import { Button } from "@/components/bs-ui/button";
import { Label } from "@/components/bs-ui/label";
import { isVarInFlow } from "@/util/flowUtils";
import { UploadCloud, Variable } from "lucide-react";
-import { useEffect, useRef } from "react";
+import { useEffect, useRef, useState } from "react";
import useFlowStore from "../../flowStore";
import SelectVar from "./SelectVar";
+import { RbDragIcon } from "@/components/bs-icons/rbDrag";
// 解析富文本内容为保存格式
function parseToValue(input, flowNode) {
@@ -36,56 +37,67 @@ function parseToValue(input, flowNode) {
}
-export default function VarInput({ nodeId, itemKey, placeholder = '', flowNode, value, error = false, children = null, onUpload = undefined, onChange, onVarEvent = undefined }) {
+export default function VarInput({
+ nodeId,
+ itemKey,
+ placeholder = '',
+ flowNode,
+ value,
+ error = false,
+ children = null,
+ onUpload = undefined,
+ onChange,
+ onVarEvent = undefined,
+}) {
const { textareaRef, handleFocus, handleBlur } = usePlaceholder(placeholder);
const valueRef = useRef(value || '');
const selectVarRef = useRef(null);
- const { flow } = useFlowStore()
+ const { flow } = useFlowStore();
// 校验变量是否可用
const validateVarAvailble = () => {
const value = valueRef.current;
- const [html, error] = parseToHTML(value || '', true)
- textareaRef.current.innerHTML = html
- return error
- }
- useEffect(() => {
- onVarEvent && onVarEvent(validateVarAvailble)
- return () => onVarEvent && onVarEvent(() => { })
- }, [flowNode])
+ const [html, error] = parseToHTML(value || '', true);
+ textareaRef.current.innerHTML = html;
+ return error;
+ };
+ useEffect(() => {
+ onVarEvent && onVarEvent(validateVarAvailble);
+ return () => onVarEvent && onVarEvent(() => { });
+ }, [flowNode]);
const handleInput = () => {
- const value = parseToValue(textareaRef.current.innerHTML, flowNode)
+ const value = parseToValue(textareaRef.current.innerHTML, flowNode);
// console.log('textarea value :>> ', value);
valueRef.current = value;
onChange(value);
- }
+ };
function parseToHTML(input, validate = false) {
- let error = ''
+ let error = '';
const html = input
.replace(/{{#(.*?)#}}/g, (a, part) => {
if (validate) {
- error = isVarInFlow(nodeId, flow.nodes, part, flowNode.varZh?.[part])
+ error = isVarInFlow(nodeId, flow.nodes, part, flowNode.varZh?.[part]);
}
const msgZh = flowNode.varZh?.[part] || part;
- return `${msgZh}`
+ return `${msgZh}`;
})
.replace(/\n/g, '
');
- return [html, error]
+ return [html, error];
}
useEffect(() => {
// console.log('value :>> ', value);
textareaRef.current.innerHTML = parseToHTML(value || '')[0];
- handleBlur()
- }, [])
+ handleBlur();
+ }, []);
// 在光标位置插入内容
function handleInsertVariable(item, _var) {
- handleFocus()
+ handleFocus();
const selection = window.getSelection();
let range = selection.getRangeAt(0);
@@ -100,17 +112,17 @@ export default function VarInput({ nodeId, itemKey, placeholder = '', flowNode,
}
// 文本框内容
- const key = `${item.id}.${_var.value}`
- const label = `${item.name}/${_var.label}`
+ const key = `${item.id}.${_var.value}`;
+ const label = `${item.name}/${_var.label}`;
if (flowNode.varZh) {
- flowNode.varZh[key] = label
+ flowNode.varZh[key] = label;
} else {
flowNode.varZh = {
- [key]: label
- }
+ [key]: label,
+ };
}
- const html = `${label}`
+ const html = `${label}`;
const fragment = range.createContextualFragment(html);
const lastChild = fragment.lastChild; // 提前保存引用
@@ -127,46 +139,99 @@ export default function VarInput({ nodeId, itemKey, placeholder = '', flowNode,
console.warn('No valid child nodes to insert.');
}
- handleInput()
+ handleInput();
}
const handlePaste = (e) => {
// fomat text
- e.preventDefault(); // 阻止默认粘贴行为
- const text = e.clipboardData.getData('text'); // 从剪贴板中获取纯文本内容
+ e.preventDefault(); // 阻止默认粘贴行为
+ const text = e.clipboardData.getData('text'); // 从剪贴板中获取纯文本内容
document.execCommand('insertText', false, text);
- }
+ };
+ // resize
+ const { height, handleMouseDown } = useResize(textareaRef, 80, 40);
- return
-
textareaRef.current.focus()}>
-
-
-
-
-
- {onUpload &&
}
+ return (
+
+
textareaRef.current.focus()}>
+
+
+
+
+
+ {onUpload && (
+
+ )}
+
+
{
+ // 唤起插入变量
+ if (e.key === '{') {
+ selectVarRef.current.open();
+ e.preventDefault();
+ }
+ }}
+ className="nowheel bisheng-richtext px-3 py-2 whitespace-pre-line min-h-[80px] max-h-64 overflow-y-auto overflow-x-hidden border-none outline-none bg-search-input rounded-md dark:text-gray-50 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
+ >
+ {children}
+
-
{
- // 唤起插入变量
- if (e.key === '{') {
- selectVarRef.current.open()
- e.preventDefault();
- }
- }}
- className="nowheel bisheng-richtext px-3 py-2 whitespace-pre-line min-h-[80px] max-h-24 overflow-y-auto overflow-x-hidden border-none outline-none bg-search-input rounded-md dark:text-gray-50 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
- >
- {children}
-
+ );
+}
+
+const useResize = (textareaRef, initialHeight = 80, minHeight = 40) => {
+ const [height, setHeight] = useState(initialHeight); // 初始高度
+
+ // 处理拖拽调整高度
+ const handleDrag = (e) => {
+ e.preventDefault();
+ const newHeight = e.clientY - textareaRef.current.getBoundingClientRect().top;
+ if (newHeight > minHeight) {
+ setHeight(newHeight); // 更新高度
+ }
+ };
+
+ const handleMouseUp = () => {
+ document.removeEventListener('mousemove', handleDrag); // 停止拖拽
+ document.removeEventListener('mouseup', handleMouseUp);
+ };
+
+ const handleMouseDown = (e) => {
+ document.addEventListener('mousemove', handleDrag); // 开始拖拽
+ document.addEventListener('mouseup', handleMouseUp);
+ };
+
+ useEffect(() => {
+ // 在组件卸载时清理事件监听器
+ return () => {
+ document.removeEventListener('mousemove', handleDrag);
+ document.removeEventListener('mouseup', handleMouseUp);
+ };
+ }, []);
+
+ return {
+ height,
+ textareaRef,
+ handleMouseDown
+ };
};
diff --git a/src/frontend/src/pages/BuildPage/flow/Sidebar.tsx b/src/frontend/src/pages/BuildPage/flow/Sidebar.tsx
index f028954cd..d3c7a77be 100644
--- a/src/frontend/src/pages/BuildPage/flow/Sidebar.tsx
+++ b/src/frontend/src/pages/BuildPage/flow/Sidebar.tsx
@@ -127,7 +127,7 @@ export default function Sidebar({ dropdown = false, onInitStartNode = (node: any
{/* tool */}
-
+
{toolTemps.map((temp, index) =>
diff --git a/src/frontend/src/pages/BuildPage/skills/editSkill/Header.tsx b/src/frontend/src/pages/BuildPage/skills/editSkill/Header.tsx
index a24b1504f..4f4b56f35 100644
--- a/src/frontend/src/pages/BuildPage/skills/editSkill/Header.tsx
+++ b/src/frontend/src/pages/BuildPage/skills/editSkill/Header.tsx
@@ -25,7 +25,7 @@ import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import TipPng from "@/assets/tip.jpg";
-export default function Header({ flow }) {
+export default function Header({ flow, onTabChange }) {
const navgate = useNavigate()
const { t } = useTranslation()
const { message } = useToast()
@@ -105,6 +105,7 @@ export default function Header({ flow }) {
}))
}
+ const [tabType, setTabType] = useState('edit')
return
{
loading &&
@@ -131,6 +132,18 @@ export default function Header({ flow }) {
{t('skills.simplify')}
+ {/* api */}
+
+
{ setTabType('edit'); onTabChange('edit') }}
+ >{t('api.skillOrchestration')}
+
{ setTabType('api'); onTabChange('api') }}
+ >{t('api.externalPublishing')}
+
+
{
version &&
{/* 删除确认 */}