@lobehub/chat 1.84.16 → 1.84.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/apps/desktop/src/main/controllers/LocalFileCtr.ts +121 -20
- package/changelog/v1.json +18 -0
- package/package.json +2 -1
- package/packages/electron-client-ipc/src/events/localFile.ts +2 -0
- package/packages/electron-client-ipc/src/types/localFile.ts +16 -0
- package/src/features/Conversation/components/MarkdownElements/LocalFile/Render/index.tsx +2 -1
- package/src/features/{Conversation/components/MarkdownElements/LocalFile/Render → LocalFile}/LocalFile.tsx +8 -10
- package/src/features/LocalFile/LocalFolder.tsx +65 -0
- package/src/features/LocalFile/index.tsx +2 -0
- package/src/libs/agent-runtime/utils/openaiCompatibleFactory/index.ts +9 -3
- package/src/libs/agent-runtime/utils/streams/qwen.test.ts +8 -4
- package/src/libs/agent-runtime/utils/streams/qwen.ts +3 -1
- package/src/libs/agent-runtime/utils/streams/spark.test.ts +6 -2
- package/src/libs/agent-runtime/utils/streams/spark.ts +3 -1
- package/src/services/electron/localFileService.ts +5 -0
- package/src/store/chat/slices/builtinTool/actions/__tests__/localFile.test.ts +211 -0
- package/src/store/chat/slices/builtinTool/actions/localFile.ts +27 -3
- package/src/store/electron/selectors/desktopState.ts +7 -0
- package/src/store/electron/selectors/index.ts +1 -0
- package/src/tools/local-files/Render/ListFiles/index.tsx +2 -45
- package/src/tools/local-files/Render/RenameLocalFile/index.tsx +5 -6
- package/src/tools/local-files/Render/RunCommand/index.tsx +35 -0
- package/src/tools/local-files/Render/WriteFile/index.tsx +32 -0
- package/src/tools/local-files/Render/index.tsx +2 -0
- package/src/tools/local-files/index.ts +20 -21
- package/src/tools/local-files/systemRole.ts +7 -13
@@ -1,4 +1,4 @@
|
|
1
|
-
export const systemPrompt = `You have a Local
|
1
|
+
export const systemPrompt = `You have a Local System tool with capabilities to interact with the user's local file system. You can list directories, read file contents, search for files, move, and rename files/directories.
|
2
2
|
|
3
3
|
<user_context>
|
4
4
|
Here are some known locations and system details on the user's system. User is using the Operating System: {{platform}}({{arch}}). Use these paths when the user refers to these common locations by name (e.g., "my desktop", "downloads folder").
|
@@ -12,26 +12,20 @@ Here are some known locations and system details on the user's system. User is u
|
|
12
12
|
- App Data: {{userDataPath}} (Use this primarily for plugin-related data or configurations if needed, less for general user files)
|
13
13
|
</user_context>
|
14
14
|
|
15
|
+
<core_capabilities>
|
15
16
|
You have access to a set of tools to interact with the user's local file system:
|
16
17
|
|
17
18
|
1. **listLocalFiles**: Lists files and directories in a specified path.
|
18
19
|
2. **readLocalFile**: Reads the content of a specified file, optionally within a line range.
|
19
|
-
3. **
|
20
|
-
4. **
|
21
|
-
5. **
|
22
|
-
|
23
|
-
<core_capabilities>
|
24
|
-
1. List files and folders in a directory (listFiles)
|
25
|
-
2. Read the content of a specific file (readFile)
|
26
|
-
3. Search for files based on a query and various filter options (searchFiles)
|
27
|
-
4. Rename a file or folder within its current directory (renameFile)
|
28
|
-
5. Move a file or folder to a new location, potentially renaming it (moveFile)
|
29
|
-
6. Write content to a specific file (writeFile) - // TODO: Implement later
|
20
|
+
3. **writeFile**: Write content to a specific file, only support plain text file like \`.text\` or \`.md\`
|
21
|
+
4. **searchLocalFiles**: Searches for files based on keywords and other criteria. Use this tool to find files if the user is unsure about the exact path.
|
22
|
+
5. **renameLocalFile**: Renames a single file or directory in its current location.
|
23
|
+
6. **moveLocalFiles**: Moves multiple files or directories. Can be used for renaming during the move.
|
30
24
|
</core_capabilities>
|
31
25
|
|
32
26
|
<workflow>
|
33
27
|
1. Understand the user's request regarding local files (listing, reading, searching, renaming, moving, writing).
|
34
|
-
2. Select the appropriate tool (listFiles, readFile, searchFiles, renameFile,
|
28
|
+
2. Select the appropriate tool (listFiles, readFile, searchFiles, renameFile, moveLocalFiles, writeFile).
|
35
29
|
3. Execute the file operation. **If the user mentions a common location (like Desktop, Documents, Downloads, etc.) without providing a full path, use the corresponding path from the <user_context> section.**
|
36
30
|
4. Present the results (directory listing, file content, search results) or confirmation of the rename or move operation.
|
37
31
|
</workflow>
|