mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-01 09:49:03 +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}
|
key={item.id}
|
||||||
fileInfo={{
|
fileInfo={{
|
||||||
name: (
|
name: (
|
||||||
<ClickableSpan onClick={() => window.api.file.openPath(file.path)}>
|
<ClickableSpan onClick={() => window.api.file.openPath(FileManager.getFilePath(file))}>
|
||||||
<Ellipsis>
|
<Ellipsis>
|
||||||
<Tooltip title={file.origin_name}>{file.origin_name}</Tooltip>
|
<Tooltip title={file.origin_name}>{file.origin_name}</Tooltip>
|
||||||
</Ellipsis>
|
</Ellipsis>
|
||||||
|
|||||||
@ -70,6 +70,11 @@ class FileManager {
|
|||||||
return file
|
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> {
|
static async deleteFile(id: string, force: boolean = false): Promise<void> {
|
||||||
const file = await this.getFile(id)
|
const file = await this.getFile(id)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user