Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes on cd after attaching images to message #262

Open
ErikBjare opened this issue Nov 20, 2024 · 0 comments
Open

Crashes on cd after attaching images to message #262

ErikBjare opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ErikBjare
Copy link
Owner

ErikBjare commented Nov 20, 2024

Paths should either be stored as absolute paths, or be resolved relative to the workspace root and not the current directory.

File /fast/erb/Programming/gptme/gptme/message.py:113, in Message._content_files_list(self, provider)
    105 content.append(
    106     {
    107         "type": "text",
    108         "text": f"![{f.name}]({f.name}):",
    109     }
    110 )
    112 # read file
--> 113 data_bytes = f.read_bytes()
    114 data = base64.b64encode(data_bytes).decode("utf-8")
    116 # check that the file is not too large
    117 # anthropic limit is 5MB, seems to measure the base64-encoded size instead of raw bytes
    118 # TODO: use compression to reduce file size
    119 # print(f"{len(data)=}")

File /usr/lib/python3.11/pathlib.py:1050, in Path.read_bytes(self)
   1046 def read_bytes(self):
   1047     """
   1048     Open the file in bytes mode, read it, and close the file.
   1049     """
-> 1050     with self.open(mode='rb') as f:
   1051         return f.read()

File /usr/lib/python3.11/pathlib.py:1044, in Path.open(self, mode, buffering, encoding, errors, newline)
   1042 if "b" not in mode:
   1043     encoding = io.text_encoding(encoding)
-> 1044 return io.open(self, mode, buffering, encoding, errors, newline)

FileNotFoundError: [Errno 2] No such file or directory: 'media/profile-pic-draft1.jpg'
@ErikBjare ErikBjare added the bug Something isn't working label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant