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

Response body is empty #11

Open
joelself opened this issue Jul 1, 2024 · 8 comments
Open

Response body is empty #11

joelself opened this issue Jul 1, 2024 · 8 comments

Comments

@joelself
Copy link

joelself commented Jul 1, 2024

I installed the requirements, started the server and tried POSTing to it. Some examples:

{
    "prompt": "Write a function in python called print_hello_world thet prints the words Hello World.",
    "language": "python"
}
{
    "prompt": "def say_hello_world():\n print",
    "language": "python"
}

Both came back as 200 OK, but the Body was empty. I'll try and debug it once I figure out how to debug it.

@jaylene-zhang
Copy link

I also had the similar problem. When I try to print out the response from request there is nothing in it. Also, when I open the link I got the following error response. Have you found out where the problem is ?
Screen Shot 2024-07-05 at 4 52 04 PM

@j0bekt01
Copy link

I also had the similar problem. When I try to print out the response from request there is nothing in it. Also, when I open the link I got the following error response. Have you found out where the problem is ? Screen Shot 2024-07-05 at 4 52 04 PM

As the error indicates you are using an unsupported GET method, use POST instead.

@Lorh-o
Copy link

Lorh-o commented Jul 19, 2024

Did you guys manage to get a python script working that can communicate with it? I can't seem to read the response

@jaylene-zhang
Copy link

Did you guys manage to get a python script working that can communicate with it? I can't seem to read the response

no :(

@j0bekt01
Copy link

I got it to work. I'll post the code on Monday, it's on my work computer.

@aivarannamaa
Copy link

@j0bekt01, can you share your code?

@j0bekt01
Copy link

I used it to fix bad code, so adjust your prompt accordingly.

def send_copilot_request(expression):

    url = "http://localhost:8080/api"
    prompt = f"#/fix {expression}\n\n"

    while True:
        payload = {
            "prompt": prompt
        }

        response = requests.post(url, json=payload)
        code = response.content.decode('utf-8')
        
        if code == "\n\n":
            break
        
        prompt += code

    return prompt

send_copilot_request(exp)

@sumairrasi
Copy link

Did you guys manage to get a python script working that can communicate with it? I can't seem to read the response

Can you post the full code, it would be really helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants