Code Monkey home page Code Monkey logo

Comments (7)

TheExplainthis avatar TheExplainthis commented on June 14, 2024 1

針對圖一,因為 /callback 沒有 GET 的 Method,所以直接打會錯誤唷!
針對圖二,截圖的下半部還有更多的錯誤訊息嗎?

from chatgpt-line-bot.

jim030784 avatar jim030784 commented on June 14, 2024

2
當我在line傳訊息則會出現這樣的狀況,
感謝回應。

from chatgpt-line-bot.

maxchen2k avatar maxchen2k commented on June 14, 2024

172.31.128.1 - - [06/Mar/2023 15:39:51] "POST /callback HTTP/1.1" 200 -
[2023-03-06 15:39:51,911] ERROR in app: Exception on /callback [POST]
Traceback (most recent call last):
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "main.py", line 38, in callback
handler.handle(body, signature)
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/webhook.py", line 259, in handle
self.__invoke_func(func, event, payload)
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/webhook.py", line 271, in __invoke_func
func(event)
File "main.py", line 60, in handle_text_message
line_bot_api.reply_message(
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/api.py", line 113, in reply_message
self._post(
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/api.py", line 1860, in _post
self.__check_error(response)
File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/api.py", line 1896, in __check_error
raise LineBotApiError(
linebot.exceptions.LineBotApiError: LineBotApiError: status_code=400, request_id=3d6769f8-8427-494c-a636-d35d03a81765, error_response={"details": [], "message": "Invalid reply token"}, headers={'Content-Type': 'application/json', 'Server': 'envoy', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-line-request-id': '3d6769f8-8427-494c-a636-d35d03a81765', 'x-xss-protection': '1; mode=block', 'Content-Length': '33', 'Expires': 'Mon, 06 Mar 2023 15:39:51 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Pragma': 'no-cache', 'Date': 'Mon, 06 Mar 2023 15:39:51 GMT', 'Connection': 'close'}

from chatgpt-line-bot.

jim030784 avatar jim030784 commented on June 14, 2024

圖一的部分,我在line develop有加上callback,但有時會出現這樣的訊息耶...
另外附圖
1

from chatgpt-line-bot.

TheExplainthis avatar TheExplainthis commented on June 14, 2024

172.31.128.1 - - [06/Mar/2023 15:39:51] "POST /callback HTTP/1.1" 200 - [2023-03-06 15:39:51,911] ERROR in app: Exception on /callback [POST] Traceback (most recent call last): File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/flask/app.py", line 2528, in wsgi_app response = self.full_dispatch_request() File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request rv = self.dispatch_request() File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "main.py", line 38, in callback handler.handle(body, signature) File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/webhook.py", line 259, in handle self.__invoke_func(func, event, payload) File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/webhook.py", line 271, in __invoke_func func(event) File "main.py", line 60, in handle_text_message line_bot_api.reply_message( File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/api.py", line 113, in reply_message self._post( File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/api.py", line 1860, in _post self.__check_error(response) File "/home/runner/ChatGPT-Line-Bot/venv/lib/python3.10/site-packages/linebot/api.py", line 1896, in __check_error raise LineBotApiError( linebot.exceptions.LineBotApiError: LineBotApiError: status_code=400, request_id=3d6769f8-8427-494c-a636-d35d03a81765, error_response={"details": [], "message": "Invalid reply token"}, headers={'Content-Type': 'application/json', 'Server': 'envoy', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-line-request-id': '3d6769f8-8427-494c-a636-d35d03a81765', 'x-xss-protection': '1; mode=block', 'Content-Length': '33', 'Expires': 'Mon, 06 Mar 2023 15:39:51 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Pragma': 'no-cache', 'Date': 'Mon, 06 Mar 2023 15:39:51 GMT', 'Connection': 'close'}

可以嘗試看看這個人的解法
line/line-bot-sdk-python#37

from chatgpt-line-bot.

TheExplainthis avatar TheExplainthis commented on June 14, 2024

圖一的部分,我在line develop有加上callback,但有時會出現這樣的訊息耶... 另外附圖 1

針對這個問題,可以試著更新 openai 的版本

pip install --upgrade openai

from chatgpt-line-bot.

FishBowl00003 avatar FishBowl00003 commented on June 14, 2024

圖一的部分,我在line develop有加上callback,但有時會出現這樣的訊息耶... 另外附圖 1

針對這個問題,可以試著更新 openai 的版本

pip install --upgrade openai

還是一樣會跳錯誤
2023-03-08 11:29:31 INFO chatgpt_logger -> U93df74dfee2e3e161b88159cf6813: 哈哈
U93df74dfee2e3e161b88159cf6813
[2023-03-08 11:29:32,262] ERROR in app: Exception on /callback [POST]
Traceback (most recent call last):
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "main.py", line 38, in callback
handler.handle(body, signature)
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/linebot/webhook.py", line 259, in handle
self.__invoke_func(func, event, payload)
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/linebot/webhook.py", line 271, in __invoke_func
func(event)
File "main.py", line 57, in handle_text_message
response = chatgpt.get_response(user_id, text)
File "/home/runner/ChatGPT-Line-Bot-1/src/chatgpt.py", line 12, in get_response
response = self.model.chat_completion(self.memory.get(user_id))
File "/home/runner/ChatGPT-Line-Bot-1/src/models.py", line 20, in chat_completion
response = openai.ChatCompletion.create(
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/openai/api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/openai/api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "/home/runner/ChatGPT-Line-Bot-1/venv/lib/python3.10/site-packages/openai/api_requestor.py", line 679, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: Invalid URL (POST /v1/chat/completions)
172.31.128.1 - - [08/Mar/2023 11:29:32] "POST /callback HTTP/1.1" 500 -
pip install --upgrade openai
172.31.128.1 - - [08/Mar/2023 11:30:11] "GET / HTTP/1.1" 200 -
172.31.128.1 - - [08/Mar/2023 11:30:22] "POST /callback HTTP/1.1" 200 -

from chatgpt-line-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.