mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-12 14:11:07 +00:00
fix: navigation when opening output file from chat ( #255)
This commit is contained in:
parent
cf003632c8
commit
fecaf6f481
1 changed files with 19 additions and 2 deletions
|
|
@ -180,6 +180,7 @@ export default function Folder({ data }: { data?: Agent }) {
|
|||
.invoke("open-file", file.type, file.path, isShowSourceCode)
|
||||
.then((res) => {
|
||||
setSelectedFile({ ...file, content: res });
|
||||
chatStore.setSelectedFile(chatStore.activeTaskId as string, file);
|
||||
setLoading(false);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
|
@ -279,12 +280,12 @@ export default function Folder({ data }: { data?: Agent }) {
|
|||
]);
|
||||
|
||||
const hasFetchedRemote = useRef(false);
|
||||
|
||||
|
||||
// Reset hasFetchedRemote when activeTaskId changes
|
||||
useEffect(() => {
|
||||
hasFetchedRemote.current = false;
|
||||
}, [chatStore.activeTaskId]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const setFileList = async () => {
|
||||
let res = null;
|
||||
|
|
@ -344,6 +345,22 @@ export default function Folder({ data }: { data?: Agent }) {
|
|||
};
|
||||
setFileList();
|
||||
}, [chatStore.tasks[chatStore.activeTaskId as string]?.taskAssigning]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('123123')
|
||||
const chatStoreSelectedFile =
|
||||
chatStore.tasks[chatStore.activeTaskId as string]?.selectedFile;
|
||||
if (chatStoreSelectedFile) {
|
||||
const file = fileGroups[0].files.find(
|
||||
(item: any) => item.name === chatStoreSelectedFile.name
|
||||
);
|
||||
console.log("file", file);
|
||||
if (file) {
|
||||
selecetdFileChange(file as FileInfo, isShowSourceCode);
|
||||
}
|
||||
}
|
||||
}, [chatStore.tasks[chatStore.activeTaskId as string]?.selectedFile?.path]);
|
||||
|
||||
const handleBack = () => {
|
||||
chatStore.setActiveWorkSpace(chatStore.activeTaskId as string, "workflow");
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue