mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-10 21:39:33 +00:00
Native data AI application framework based on AWEL+AGENT (#1152)
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: lcx01800250 <lcx01800250@alibaba-inc.com> Co-authored-by: licunxing <864255598@qq.com> Co-authored-by: Aralhi <xiaoping0501@gmail.com> Co-authored-by: xuyuan23 <643854343@qq.com> Co-authored-by: aries_ckt <916701291@qq.com> Co-authored-by: hzh97 <2976151305@qq.com>
This commit is contained in:
@@ -76,7 +76,11 @@ const ChatContainer = () => {
|
||||
data: { ...data, chat_mode: scene || 'chat_normal', model_name: model, user_input: content },
|
||||
chatId,
|
||||
onMessage: (message) => {
|
||||
tempHistory[index].context = message;
|
||||
if (data?.incremental) {
|
||||
tempHistory[index].context += message;
|
||||
} else {
|
||||
tempHistory[index].context = message;
|
||||
}
|
||||
setHistory([...tempHistory]);
|
||||
},
|
||||
onDone: () => {
|
||||
|
@@ -19,7 +19,7 @@ interface Props {
|
||||
};
|
||||
};
|
||||
isChartChat?: boolean;
|
||||
onLinkClick: () => void;
|
||||
onLinkClick?: () => void;
|
||||
}
|
||||
|
||||
type MarkdownComponent = Parameters<typeof ReactMarkdown>['0']['components'];
|
||||
|
@@ -31,6 +31,7 @@ const Completion = ({ messages, onSubmit }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
const flowSelectParam = (searchParams && searchParams.get('select_param')) ?? '';
|
||||
const spaceNameOriginal = (searchParams && searchParams.get('spaceNameOriginal')) ?? '';
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@@ -41,6 +42,7 @@ const Completion = ({ messages, onSubmit }: Props) => {
|
||||
|
||||
const scrollableRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// const incremental = useMemo(() => scene === 'chat_flow', [scene]);
|
||||
const isChartChat = useMemo(() => scene === 'chat_dashboard', [scene]);
|
||||
|
||||
const summary = useSummary();
|
||||
@@ -51,10 +53,12 @@ const Completion = ({ messages, onSubmit }: Props) => {
|
||||
return agent;
|
||||
case 'chat_excel':
|
||||
return currentDialogue?.select_param;
|
||||
case 'chat_flow':
|
||||
return flowSelectParam;
|
||||
default:
|
||||
return spaceNameOriginal || dbParam;
|
||||
}
|
||||
}, [scene, agent, currentDialogue, dbParam, spaceNameOriginal]);
|
||||
}, [scene, agent, currentDialogue, dbParam, spaceNameOriginal, flowSelectParam]);
|
||||
|
||||
const handleChat = async (content: string) => {
|
||||
if (isLoading || !content.trim()) return;
|
||||
@@ -66,6 +70,7 @@ const Completion = ({ messages, onSubmit }: Props) => {
|
||||
setIsLoading(true);
|
||||
await onSubmit(content, {
|
||||
select_param: selectParam ?? '',
|
||||
// incremental,
|
||||
});
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
|
@@ -19,7 +19,7 @@ function AgentSelector() {
|
||||
className="w-60"
|
||||
value={agent}
|
||||
placeholder={t('Select_Plugins')}
|
||||
options={data.map((item) => ({ label: item.gpts_describe, value: item.gpts_name }))}
|
||||
options={data.map((item) => ({ label: item.app_name, value: item.app_code }))}
|
||||
allowClear
|
||||
onChange={(val) => {
|
||||
setAgent?.(val);
|
||||
|
Reference in New Issue
Block a user