feat: Support for Chat Flow & Agent Support for binding a single chat flow (#765)

Co-authored-by: Yu Yang <72337138+tomasyu985@users.noreply.github.com>
Co-authored-by: zengxiaohui <csu.zengxiaohui@gmail.com>
Co-authored-by: lijunwen.gigoo <lijunwen.gigoo@bytedance.com>
Co-authored-by: lvxinyu.1117 <lvxinyu.1117@bytedance.com>
Co-authored-by: liuyunchao.0510 <liuyunchao.0510@bytedance.com>
Co-authored-by: haozhenfei <37089575+haozhenfei@users.noreply.github.com>
Co-authored-by: July <jiangxujin@bytedance.com>
Co-authored-by: tecvan-fe <fanwenjie.fe@bytedance.com>
This commit is contained in:
Zhj
2025-08-28 21:53:32 +08:00
committed by GitHub
parent bbc615a18e
commit d70101c979
503 changed files with 48036 additions and 3427 deletions

View File

@@ -17,6 +17,7 @@
import { useState, useEffect, useRef, Suspense } from 'react';
import { nanoid } from 'nanoid';
import { debounce } from 'lodash-es';
import cls from 'classnames';
import { connect, mapProps } from '@formily/react';
import type { Editor } from '@coze-common/md-editor-adapter';
@@ -56,23 +57,25 @@ const InnerFullInputAdapter: React.FC<FullInputProps> = ({
const businessKeyRef = useRef(nanoid());
const innerValueRef = useRef<string | undefined>();
const handleChange = (v: string) => {
if (!editorRef.current) {
return;
}
/**
* deltas => md
*/
const content = editorRef.current.getContent();
const { markdown } = delta2md(content.deltas[0], content.deltas);
/**
* Changes may come from user input or initialization, do a diff to ensure performance
*/
if (markdown !== innerValueRef.current) {
innerValueRef.current = markdown;
onChange(markdown);
}
};
const handleChange = useRef(
debounce((v: string) => {
if (!editorRef.current) {
return;
}
/**
* deltas => md
*/
const content = editorRef.current.getContent();
const { markdown } = delta2md(content.deltas[0], content.deltas);
/**
* Changes may come from user input or initialization, do a diff to ensure performance
*/
if (markdown !== innerValueRef.current) {
innerValueRef.current = markdown;
onChange(markdown);
}
}, 500),
).current;
useEffect(() => {
if (value !== innerValueRef.current) {
@@ -84,6 +87,13 @@ const InnerFullInputAdapter: React.FC<FullInputProps> = ({
}
}, [value]);
useEffect(
() => () => {
handleChange.cancel();
},
[handleChange],
);
return (
<Suspense fallback={null}>
<LazyEditorFullInputInner