Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix:/export支持绝对路径

openJiuwen-bot8913b1212b57
diff --git a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/export.ts b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/export.ts
index c2338620bd..1e22e88da4 100644
--- a/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/export.ts
+++ b/jiuwenswarm/channels/tui/frontend/src/core/commands/builtins/export.ts
@@ -1,5 +1,5 @@
import { writeFileSync } from "node:fs";
-import { join } from "node:path";
+import { resolve } from "node:path";
import { copyToClipboard } from "../clipboard.js";
import { addError, addInfo } from "../helpers.js";
import { CommandKind, type SlashCommand } from "../types.js";
@@ -136,7 +136,7 @@ export function createExportCommand(): SlashCommand {
if (arg) {
const filename = arg.endsWith(".txt") ? arg : arg.replace(/\.[^.]+$/, "") + ".txt";
const workspaceDir = ctx.getWorkspaceDir() || process.cwd();
- const filepath = join(workspaceDir, filename);
+ const filepath = resolve(workspaceDir, filename);
try {
writeFileSync(filepath, content, { encoding: "utf-8" });
@@ -156,7 +156,7 @@ export function createExportCommand(): SlashCommand {
? `${timestamp}-${sanitized}.txt`
: `conversation-${timestamp}.txt`;
const workspaceDir = ctx.getWorkspaceDir() || process.cwd();
- const defaultFilepath = join(workspaceDir, defaultFilename);
+ const defaultFilepath = resolve(workspaceDir, defaultFilename);
// Step 1: select export method
try {
@@ -234,7 +234,7 @@ export function createExportCommand(): SlashCommand {
chosenFilename = chosenFilename.endsWith(".txt")
? chosenFilename
: chosenFilename.replace(/\.[^.]+$/, "") + ".txt";
- const chosenFilepath = join(workspaceDir, chosenFilename);
+ const chosenFilepath = resolve(workspaceDir, chosenFilename);
try {
writeFileSync(chosenFilepath, content, { encoding: "utf-8" });