mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 03:10:08 +08:00
feat: implement getFilePath method in FileManager and update KnowledgeContent to use it
- Added getFilePath method in FileManager to construct file paths based on file ID and extension. - Updated KnowledgeContent to utilize the new getFilePath method for opening file paths, improving code clarity and maintainability.
This commit is contained in:
parent
4838a02785
commit
e0774e49cc
@ -328,7 +328,7 @@ const KnowledgeContent: FC<KnowledgeContentProps> = ({ selectedBase }) => {
|
||||
key={item.id}
|
||||
fileInfo={{
|
||||
name: (
|
||||
<ClickableSpan onClick={() => window.api.file.openPath(file.path)}>
|
||||
<ClickableSpan onClick={() => window.api.file.openPath(FileManager.getFilePath(file))}>
|
||||
<Ellipsis>
|
||||
<Tooltip title={file.origin_name}>{file.origin_name}</Tooltip>
|
||||
</Ellipsis>
|
||||
|
||||
@ -70,6 +70,11 @@ class FileManager {
|
||||
return file
|
||||
}
|
||||
|
||||
static getFilePath(file: FileType) {
|
||||
const filesPath = store.getState().runtime.filesPath
|
||||
return filesPath + '/' + file.id + file.ext
|
||||
}
|
||||
|
||||
static async deleteFile(id: string, force: boolean = false): Promise<void> {
|
||||
const file = await this.getFile(id)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user