williamfzc / chat-gpt-ppt

Use ChatGPT (or other backends) to generate PPT automatically, all in one single file.
MIT License
881 stars 88 forks source link

Invalid header value #5

Closed mpbunch closed 1 year ago

mpbunch commented 1 year ago

Installed chat-gpt-ppt:

    pip install -e chat-gpt-ppt

Added the token.txt and data.txt file to the example folder. Placed the session_token within the token.txt file.

Run the following command:

    cgp token.txt data.txt

The following error was returned:

    raise ValueError('Invalid header value %r' % (values[i],))
    ValueError: Invalid header value b'__Secure-next-auth.session-token=eyJhb...

So, I then tried to update the revChatGPT to 0.2.1.

Run the same command:

    cgp token.txt data.txt

The following error is returned:

    Spawning browser...
    Browser spawned.
    Found Cloudflare Cookie!
    [...]
    tls_client.exceptions.TLSClientExeption: failed to do request: Get "https://chat.openai.com/api/auth/session": invalid HTTP header value "__Secure-next-auth.session-token=eyJhb...pBg\n; cf_clearance=tjcHJfmHgb7v9Ck46UhFHPub1jqRE5trcSDcVvfw77o-1674258058-0-1-24b796c0.804eba2d.a179b327-160" for 
header "Cookie"

What am I missing? Any help is appreciated.

williamfzc commented 1 year ago

Hi,

I have seen your PRs and thanks for your notice. I have upgraded the CharGpt version but I do not have a session token for test.

https://github.com/williamfzc/chat-gpt-ppt/commit/1d3c0abbf1047ed3e83b88f992a01f0ffe52de27

You can try this version.

williamfzc commented 1 year ago

This project has been rewritten with golang. This problem no longer exists.

iglivetest commented 1 year ago

This problem exists on golang too .

panic: Post "https://api.openai.com/v1/chat/completions": net/http: invalid header field value for "Authorization"

goroutine 1 [running]: main.panicIfErr(...) /data/data/com.termux/files/home/chat-gpt-ppt/cmd/cgp/main.go:42 main.main() /data/data/com.termux/files/home/chat-gpt-ppt/cmd/cgp/main.go:37 +0x324

williamfzc commented 1 year ago

Did you set a correct token (OpenAI official APIKEY) in token.txt?

williamfzc commented 1 year ago

This problem exists on golang too .

panic: Post "https://api.openai.com/v1/chat/completions": net/http: invalid header field value for "Authorization"

goroutine 1 [running]: main.panicIfErr(...) /data/data/com.termux/files/home/chat-gpt-ppt/cmd/cgp/main.go:42 main.main() /data/data/com.termux/files/home/chat-gpt-ppt/cmd/cgp/main.go:37 +0x324

Oh I see. Maybe there are some extra white spaces or empty lines in your token.txt. I have added some descriptions in README, thanks.

https://github.com/williamfzc/chat-gpt-ppt#usage