shitton
This commit is contained in:
@@ -4,7 +4,6 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import {AiTool} from "../tool-types";
|
||||
import {Environment} from "../../common/environment";
|
||||
import {randomUUID} from "node:crypto";
|
||||
import {toolsLogger} from "./tool-logger";
|
||||
|
||||
const logger = toolsLogger.child("python-interpreter");
|
||||
@@ -306,7 +305,8 @@ async function executePythonCode(
|
||||
const maxOutputChars = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT_CHARS;
|
||||
|
||||
// const tempDir = path.join(Environment.DATA_PATH, "cache", "python", "python-temp-" + randomUUID());
|
||||
const tempDir = path.join(Environment.FILE_TOOLS_ROOT_DIR ?? ".", "ollama-python-temp-" + randomUUID());
|
||||
// const tempDir = path.join(Environment.FILE_TOOLS_ROOT_DIR ?? ".", "ollama-python-temp-" + randomUUID());
|
||||
const tempDir = path.join(Environment.FILE_TOOLS_ROOT_DIR ?? ".", "");
|
||||
const inputDir = path.join(tempDir, PYTHON_INPUTS_DIR_NAME);
|
||||
const outputDir = path.join(tempDir, PYTHON_OUTPUTS_DIR_NAME);
|
||||
const attachmentsPath = path.join(tempDir, PYTHON_ATTACHMENTS_FILE_NAME);
|
||||
@@ -350,7 +350,12 @@ async function executePythonCode(
|
||||
},
|
||||
});
|
||||
|
||||
logger.debug("process.done", {duration: logger.duration(startedAt), exitCode: result.exitCode, timedOut: result.timedOut, outputTruncated: result.outputTruncated});
|
||||
logger.debug("process.done", {
|
||||
duration: logger.duration(startedAt),
|
||||
exitCode: result.exitCode,
|
||||
timedOut: result.timedOut,
|
||||
outputTruncated: result.outputTruncated
|
||||
});
|
||||
|
||||
if (result.timedOut) {
|
||||
logger.warn("process.timeout", {duration: logger.duration(startedAt)});
|
||||
@@ -369,7 +374,11 @@ async function executePythonCode(
|
||||
}
|
||||
|
||||
if (result.outputTruncated) {
|
||||
logger.warn("process.output_truncated", {duration: logger.duration(startedAt), stdoutChars: result.stdout.length, stderrChars: result.stderr.length});
|
||||
logger.warn("process.output_truncated", {
|
||||
duration: logger.duration(startedAt),
|
||||
stdoutChars: result.stdout.length,
|
||||
stderrChars: result.stderr.length
|
||||
});
|
||||
|
||||
return {
|
||||
ok: false,
|
||||
|
||||
Reference in New Issue
Block a user