Fix and consolidate command workspace resolution

This commit is contained in:
Reinier van der Leer
2023-04-16 18:52:22 +02:00
committed by Pi
parent 35175fc19b
commit 11620cc571
5 changed files with 59 additions and 53 deletions

View File

@@ -2,15 +2,13 @@ import requests
import json
from autogpt.config import Config
from autogpt.commands.file_operations import safe_join
from autogpt.workspace import path_in_workspace
cfg = Config()
working_directory = "auto_gpt_workspace"
def read_audio_from_file(audio_path):
audio_path = safe_join(working_directory, audio_path)
audio_path = path_in_workspace(audio_path)
with open(audio_path, "rb") as audio_file:
audio = audio_file.read()
return read_audio(audio)