mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 00:46:52 +08:00
Feat: Make the agent dialog window exposed to the outside world fill in the begin form #3221 (#9124)
### What problem does this PR solve? Feat: Make the agent dialog window exposed to the outside world fill in the begin form #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -176,6 +176,7 @@ export function useSetUploadResponseData() {
|
||||
export const useSendAgentMessage = (
|
||||
url?: string,
|
||||
addEventList?: (data: IEventList, messageId: string) => void,
|
||||
beginParams?: any[],
|
||||
) => {
|
||||
const { id: agentId } = useParams();
|
||||
const { handleInputChange, value, setValue } = useHandleMessageInputChange();
|
||||
@ -226,7 +227,9 @@ export const useSendAgentMessage = (
|
||||
|
||||
params.query = message.content;
|
||||
// params.message_id = message.id;
|
||||
params.inputs = transferInputsArrayToObject(query); // begin operator inputs
|
||||
params.inputs = transferInputsArrayToObject(
|
||||
beginParams ? beginParams : query,
|
||||
); // begin operator inputs
|
||||
|
||||
params.files = uploadResponseList;
|
||||
|
||||
@ -248,13 +251,14 @@ export const useSendAgentMessage = (
|
||||
},
|
||||
[
|
||||
agentId,
|
||||
sessionId,
|
||||
send,
|
||||
clearUploadResponseList,
|
||||
inputs,
|
||||
beginParams,
|
||||
uploadResponseList,
|
||||
sessionId,
|
||||
setValue,
|
||||
removeLatestMessage,
|
||||
clearUploadResponseList,
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
@ -487,6 +487,16 @@ export const initialExeSqlValues = {
|
||||
port: 3306,
|
||||
password: '',
|
||||
max_records: 1024,
|
||||
outputs: {
|
||||
formalized_content: {
|
||||
value: '',
|
||||
type: 'string',
|
||||
},
|
||||
json: {
|
||||
value: [],
|
||||
type: 'Array<Object>',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const initialSwitchValues = {
|
||||
|
||||
@ -20,10 +20,14 @@ import { useFormValues } from '../../hooks/use-form-values';
|
||||
import { useWatchFormChange } from '../../hooks/use-watch-form-change';
|
||||
import { INextOperatorForm } from '../../interface';
|
||||
import { ExeSQLOptions } from '../../options';
|
||||
import { buildOutputList } from '../../utils/build-output-list';
|
||||
import { FormWrapper } from '../components/form-wrapper';
|
||||
import { Output } from '../components/output';
|
||||
import { QueryVariable } from '../components/query-variable';
|
||||
import { FormSchema, useSubmitForm } from './use-submit-form';
|
||||
|
||||
const outputList = buildOutputList(initialExeSqlValues.outputs);
|
||||
|
||||
export function ExeSQLFormWidgets({ loading }: { loading: boolean }) {
|
||||
const form = useFormContext();
|
||||
const { t } = useTranslate('flow');
|
||||
@ -153,6 +157,9 @@ function ExeSQLForm({ node }: INextOperatorForm) {
|
||||
<QueryVariable name="sql"></QueryVariable>
|
||||
<ExeSQLFormWidgets loading={loading}></ExeSQLFormWidgets>
|
||||
</FormWrapper>
|
||||
<div className="p-5">
|
||||
<Output list={outputList}></Output>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ import {
|
||||
import { SharedFrom } from '@/constants/chat';
|
||||
import { useSetModalState } from '@/hooks/common-hooks';
|
||||
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
||||
import { useFetchUserInfo } from '@/hooks/user-setting-hooks';
|
||||
import { ReactFlowProvider } from '@xyflow/react';
|
||||
import {
|
||||
ChevronDown,
|
||||
@ -37,10 +36,7 @@ import AgentCanvas from './canvas';
|
||||
import EmbedDialog from './embed-dialog';
|
||||
import { useHandleExportOrImportJsonFile } from './hooks/use-export-json';
|
||||
import { useFetchDataOnMount } from './hooks/use-fetch-data';
|
||||
import {
|
||||
useGetBeginNodeDataInputs,
|
||||
useGetBeginNodeDataQueryIsSafe,
|
||||
} from './hooks/use-get-begin-query';
|
||||
import { useGetBeginNodeDataInputs } from './hooks/use-get-begin-query';
|
||||
import {
|
||||
useSaveGraph,
|
||||
useSaveGraphBeforeOpeningDebugDrawer,
|
||||
@ -69,7 +65,6 @@ export default function Agent() {
|
||||
showModal: showChatDrawer,
|
||||
} = useSetModalState();
|
||||
const { t } = useTranslation();
|
||||
const { data: userInfo } = useFetchUserInfo();
|
||||
|
||||
// const openDocument = useOpenDocument();
|
||||
const {
|
||||
@ -99,7 +94,6 @@ export default function Agent() {
|
||||
const { showEmbedModal, hideEmbedModal, embedVisible, beta } =
|
||||
useShowEmbedModal();
|
||||
const { navigateToAgentLogs } = useNavigatePage();
|
||||
const isBeginNodeDataQuerySafe = useGetBeginNodeDataQueryIsSafe();
|
||||
|
||||
return (
|
||||
<section className="h-full">
|
||||
@ -165,13 +159,7 @@ export default function Agent() {
|
||||
{location.hostname !== 'demo.ragflow.io' && (
|
||||
<>
|
||||
<DropdownMenuSeparator />
|
||||
<AgentDropdownMenuItem
|
||||
onClick={showEmbedModal}
|
||||
disabled={
|
||||
!isBeginNodeDataQuerySafe ||
|
||||
userInfo.nickname !== agentDetail.nickname
|
||||
}
|
||||
>
|
||||
<AgentDropdownMenuItem onClick={showEmbedModal}>
|
||||
<ScreenShare />
|
||||
{t('common.embedIntoSite')}
|
||||
</AgentDropdownMenuItem>
|
||||
|
||||
Reference in New Issue
Block a user