Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
53fe3631
authored
Mar 09, 2026
by
Ryo
Committed by
GitHub
Mar 09, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: api dataset filename fallback (#6527)
parent
8eb841cc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
packages/service/core/dataset/apiDataset/custom/api.ts
+23
-3
packages/service/core/dataset/collection/utils.ts
+1
-1
No files found.
packages/service/core/dataset/apiDataset/custom/api.ts
View file @
53fe3631
...
@@ -92,6 +92,26 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
...
@@ -92,6 +92,26 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
.
catch
((
err
)
=>
responseError
(
err
));
.
catch
((
err
)
=>
responseError
(
err
));
};
};
const
getPreviewUrlFilename
=
(
previewUrl
:
string
)
=>
{
const
parseFilename
=
(
pathname
:
string
)
=>
{
const
filename
=
pathname
.
split
(
'/'
).
pop
()
||
''
;
if
(
!
filename
)
return
''
;
try
{
return
decodeURIComponent
(
filename
);
}
catch
{
return
filename
;
}
};
try
{
return
parseFilename
(
new
URL
(
previewUrl
).
pathname
);
}
catch
{
return
parseFilename
(
previewUrl
.
split
(
'?'
)[
0
].
split
(
'#'
)[
0
]);
}
};
const
listFiles
=
async
({
const
listFiles
=
async
({
searchKey
,
searchKey
,
parentId
parentId
...
@@ -163,7 +183,7 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
...
@@ -163,7 +183,7 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
});
});
if
(
rawTextBuffer
)
{
if
(
rawTextBuffer
)
{
return
{
return
{
title
,
title
:
title
||
rawTextBuffer
.
filename
||
getPreviewUrlFilename
(
previewUrl
)
,
rawText
:
rawTextBuffer
.
text
rawText
:
rawTextBuffer
.
text
};
};
}
}
...
@@ -178,7 +198,7 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
...
@@ -178,7 +198,7 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
getFormatText
:
true
getFormatText
:
true
});
});
const
sourceName
=
title
||
getNanoid
();
const
sourceName
=
title
||
get
PreviewUrlFilename
(
previewUrl
)
||
get
Nanoid
();
getS3RawTextSource
().
addRawTextBuffer
({
getS3RawTextSource
().
addRawTextBuffer
({
sourceId
:
previewUrl
,
sourceId
:
previewUrl
,
...
@@ -188,7 +208,7 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
...
@@ -188,7 +208,7 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
});
});
return
{
return
{
title
,
title
:
title
||
sourceName
,
rawText
rawText
};
};
}
}
...
...
packages/service/core/dataset/collection/utils.ts
View file @
53fe3631
...
@@ -202,7 +202,7 @@ export const syncCollection = async (collection: CollectionWithDatasetType) => {
...
@@ -202,7 +202,7 @@ export const syncCollection = async (collection: CollectionWithDatasetType) => {
});
});
return
DatasetCollectionSyncResultEnum
.
success
;
return
DatasetCollectionSyncResultEnum
.
success
;
}
else
if
(
collection
.
name
!==
title
)
{
}
else
if
(
title
&&
collection
.
name
!==
title
)
{
await
MongoDatasetCollection
.
updateOne
({
_id
:
collection
.
_id
},
{
$set
:
{
name
:
title
}
});
await
MongoDatasetCollection
.
updateOne
({
_id
:
collection
.
_id
},
{
$set
:
{
name
:
title
}
});
return
DatasetCollectionSyncResultEnum
.
success
;
return
DatasetCollectionSyncResultEnum
.
success
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment