Well2333 / nonebot-plugin-bilichat

一个通过 OpenAI 来对b站视频进行总结的多功能 B站解析插件
GNU Affero General Public License v3.0
235 stars 11 forks source link

代理配置是填什么格式 #44

Closed QwindF closed 1 year ago

QwindF commented 1 year ago

机子是国内的,打算使用代理,但是代理配置一填写就报错 要加http://或其他什么吗 报错日志:

06-05 21:12:27 [ERROR] nonebot | Failed to import "nonebot_plugin_bilichat"
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\anyio\_core\_sockets.py", line 186, in connect_tcp
    addr_obj = ip_address(remote_host)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\ipaddress.py", line 54, in ip_address
    raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
ValueError: 'openaipublic.blob.core.windows.net' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\backends\asyncio.py", line 111, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\anyio\_core\_sockets.py", line 189, in connect_tcp
    gai_res = await getaddrinfo(
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\_exceptions.py", line 10, in map_exceptions
    yield
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\backends\asyncio.py", line 110, in connect_tcp
    with anyio.fail_after(timeout):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\anyio\_core\_tasks.py", line 118, in __exit__
    raise TimeoutError
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_transports\default.py", line 60, in map_httpcore_exceptions
    yield
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_transports\default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\_async\connection_pool.py", line 253, in handle_async_request
    raise exc
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\_async\connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\_async\connection.py", line 86, in handle_async_request
    raise exc
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\_async\connection.py", line 63, in handle_async_request
    stream = await self._connect(request)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\_async\connection.py", line 111, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\backends\auto.py", line 29, in connect_tcp
    return await self._backend.connect_tcp(
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\backends\asyncio.py", line 109, in connect_tcp
    with map_exceptions(exc_map):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc)
httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "E:\IDEAyes\BOT\nonebot2\bot.py", line 38, in <module>
    nonebot.load_plugin("nonebot_plugin_bilichat")
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\nonebot\plugin\load.py", line 37, in load_plugin
    return manager.load_plugin(module_path)
> File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin
    module = importlib.import_module(name)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\nonebot\plugin\manager.py", line 240, in exec_module
    super().exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\nonebot_plugin_bilichat\__init__.py", line 49, in <module>
    from .summary import summarization
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\nonebot_plugin_bilichat\summary\__init__.py", line 12, in <module>
    from .openai_summarise import openai_summarization
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\nonebot_plugin_bilichat\summary\openai_summarise.py", line 10, in <module>
    from .openai import get_small_size_transcripts, get_summarise_prompt, openai_req
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\nonebot_plugin_bilichat\summary\openai.py", line 15, in <module>
    tiktoken_enc = asyncio.run(tiktoken_async.encoding_for_model(plugin_config.bilichat_openai_model))
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\tiktoken_async\model.py", line 67, in encoding_for_model
    return await get_encoding(model_encoding_name)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\tiktoken_async\registry.py", line 67, in get_encoding
    enc = Encoding(**await constructor())
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\tiktoken_async_ext\openai_public.py", line 64, in cl100k_base
    mergeable_ranks = await load_tiktoken_bpe(
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\tiktoken_async\load.py", line 118, in load_tiktoken_bpe
    contents = await read_file_cached(tiktoken_bpe_file)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\tiktoken_async\load.py", line 48, in read_file_cached
    contents = await read_file(blobpath)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\tiktoken_async\load.py", line 25, in read_file
    resp = await client.get(blobpath)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_client.py", line 1757, in get
    return await self.request(
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_client.py", line 1620, in send
    response = await self._send_handling_auth(
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_client.py", line 1648, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_client.py", line 1685, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_client.py", line 1722, in _send_single_request
    response = await transport.handle_async_request(request)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_transports\default.py", line 352, in handle_async_request
    with map_httpcore_exceptions():
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "E:\IDEAyes\BOT\nonebot2\venv\lib\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectTimeout
QwindF commented 1 year ago

配置添加这栏就报错bilichat_openai_proxy = "http://127.0.0.1:7891"

Well2333 commented 1 year ago

这个和 bilichat_openai_proxy 没有任何关系,这是在下载token计算模型的时候超时报错了,由于源仓库不支持传入代理地址我也无能为力,重试几次就好了,实在不行就开个全局代理吧