anyidea / chatgpt-dingtalk-bot

Integrate browser-based ChatGPT with dingtalk chatbot.
MIT License
42 stars 1 forks source link

安装api分支,当启动应用的时候出现错误 #12

Closed yandaty closed 1 year ago

yandaty commented 1 year ago

Description

安装api分支,当启动应用的时候出现错误 poetry run uvicorn chatbot.main:app --host 0.0.0.0 --port 8090 --proxy-headers

What I Did

root@ip-172-31-6-140://home/ubuntu/chatgpt-dingtalk-bot# poetry run uvicorn chatbot.main:app --host 0.0.0.0 --port 8090 --proxy-headers
Traceback (most recent call last):
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/bin/uvicorn", line 8, in <module>
    sys.exit(main())
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/uvicorn/main.py", line 404, in main
    run(
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/uvicorn/main.py", line 569, in run
    server.run()
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/uvicorn/server.py", line 67, in serve
    config.load()
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/uvicorn/config.py", line 477, in load
    self.loaded_app = import_from_string(self.app)
  File "/root/.cache/pypoetry/virtualenvs/chatgpt-dingtalk-bot-VSsfygIQ-py3.8/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/ubuntu/chatgpt-dingtalk-bot/./chatbot/main.py", line 10, in <module>
    from .dingtalk import DingtalkCorpAPI
  File "/home/ubuntu/chatgpt-dingtalk-bot/./chatbot/dingtalk.py", line 8, in <module>
    class DingtalkCorpAPI:
  File "/home/ubuntu/chatgpt-dingtalk-bot/./chatbot/dingtalk.py", line 51, in DingtalkCorpAPI
    user_ids: list[str],
TypeError: 'type' object is not subscriptable
anyidea commented 1 year ago

Python版本太低,建议升级到3.9以上