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

[Bug]: GET request for files using wrong path in autogenstudio #1296

Closed
tjb4578 opened this issue Jan 17, 2024 · 5 comments
Closed

[Bug]: GET request for files using wrong path in autogenstudio #1296

tjb4578 opened this issue Jan 17, 2024 · 5 comments
Labels
proj-studio Related to AutoGen Studio.

Comments

@tjb4578
Copy link

tjb4578 commented Jan 17, 2024

Describe the bug

After executing the sine wave example, the sine_wave.png file does not display. I then tried my own custom example and the same thing happened. The terminal shows that the GET request for the file ended in a 404.

INFO:     127.0.0.1:53348 - "GET /api/files/user/user/198fb9b77fb10d10bae092eea5789295/sine_wave.png HTTP/1.1" 404 Not Found

Here is the actual path to the file:

\files\user\198fb9b77fb10d10bae092eea5789295\sine_wave.png

I'm not sure where the second user is coming from in the GET request. It looks like it might be a concatenation issue. I'm running this on Windows 11 with Mistral Instruct 7B running on LM Studio. I tweaked the default system message slightly to remove the TERMINATE command, as this was causing autogen to terminate before the task was completed successfully. Not sure if that would have any bearing on this though.

Steps to reproduce

No response

Expected Behavior

The GET request should use the correct URI and return a 200.

Screenshots and logs

Screenshot 2024-01-16 222236

Additional Information

Autogen version: 0.0.27a0
Operating System: Windows 11
Python Version: 3.10.6

@a-w-b
Copy link

a-w-b commented Jan 17, 2024

Same on Windows 10 with standard installation using anaconda, no change of the default setup, just tried the same use case with exactly the same result as reported by tjb4578.

Additional Information

autogenstudio 0.0.27a0
Windows 10
conda 23.7.4 with python 3.11.7

@victordibia
Copy link
Collaborator

victordibia commented Jan 17, 2024

Hi all,

Thanks for triaging this.

Like you mention, I believe this is a windows-related issue where some code that works correctly on linux resolves incorrectly on windows.
Specifically, this function is what determines the url of files that have been updated when autogenstudio runs (this list of files are sent to the front end to be rendered). There is change that the it resolves incorrectly on windows.

I'll take a look later today and report on what I find.

@Starskimmer
Copy link

Starskimmer commented Jan 17, 2024

(Hopefully someone finds this useful) I managed to patch this by simply making a soft symbolic link loop to correct the behaver. (didn't feel like compiling a fix from source so a no-code solution is as follows)
launch an administration CMD
mklink /D "YOURPYTHONFOLDER(E.G. Anaconda\envs\YOUR ENVIROMENT e.g. (ag)\Lib\site-packages\autogenstudio\web\files\user\user" "YOURPYTHONFOLDER(E.G. Anaconda\envs\YOUR ENVIROMENT e.g. (ag)\Lib\site-packages\autogenstudio\web\files\user"
this creates a simple loop where the /user/user folder points to the /user/ folder. ^_^

Incidentally I would recommend solving the OS path issues by implementing the 'pathlib' library. for example Windows uses "" instead of "/" which can be a major issue on cross platform use but pathlib just deals with that.

from what i can see the point of failure in the function is line 184 :: uid = dest_dir.split("/")[-1]
just replace with
dest_dir_as_path = pathlib.Path(dest_dir)
uid = dest_dir_as_path.parent.name
and remember to import the library at the top
import pathlib

References:
pathlib - https://www.freecodecamp.org/news/how-to-use-pathlib-module-in-python/#:~:text=Each%20operating%20system%20has%20different,systems%20to%20expand%20your%20code.
symbolic links - https://www.howtogeek.com/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/

victordibia added a commit that referenced this issue Jan 18, 2024
@victordibia
Copy link
Collaborator

@Starskimmer ,

Thanks for the note. I think you are right.
Adding a fix .
Will get my paws on a windows machine at some point and test this out.

@victordibia
Copy link
Collaborator

This has been addressed and tested to work on windows.
Closing out for now. Feel free to reopen if still seeing a related issue.

@victordibia victordibia added proj-studio Related to AutoGen Studio. and removed ui/deploy labels Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proj-studio Related to AutoGen Studio.
Projects
None yet
Development

No branches or pull requests

5 participants