Shaunwei / RealChar

🎙️🤖Create, Customize and Talk to your AI Character/Companion in Realtime (All in One Codebase!). Have a natural seamless conversation with AI everywhere (mobile, web and terminal) using LLM OpenAI GPT3.5/4, Anthropic Claude2, Chroma Vector DB, Whisper Speech2Text, ElevenLabs Text2Speech🎙️🤖
https://RealChar.ai/
MIT License
5.96k stars 729 forks source link

When I run the project, the server does not respond. #452

Closed Kevin-free closed 1 year ago

Kevin-free commented 1 year ago

I use the local unmodified code, or update the code to the latest code of 81a70eacdb13d5f1400414e90ad668e74f6269b7 in the main branch, and just modify the OPENAI_API_KEY in .env. I used the transit platform key before and it worked. Now change it to the official key, and the key is definitely available. But after starting, the server did not respond. Do I need to set anything in OpenAI? Hope to get help on how to troubleshoot and solve it!

Specific information is as follows。

Backend Server Log:

> python cli.py run-uvicorn
Running uvicorn server...
2023-09-13 20:48:16,674 - __init__ - catalog_manager.py - INFO - Overwriting existing data in the chroma.
2023-09-13 20:48:18,499 - load_characters_from_community - catalog_manager.py - INFO - Loaded data for character: Unreal Speech
Created a chunk of size 627, which is longer than the specified 500
...
2023-09-13 20:48:38,582 - load_characters - catalog_manager.py - INFO - Loaded data for character: Steve Jobs
2023-09-13 20:48:38,583 - load_characters - catalog_manager.py - INFO - Loaded 15 characters: IDs ['unreal_speech', 'mark_zuckerberg', 'helen_inhabitants_zone', 'raiden_shogun_and_ei_avatar', 'the_cat', 'ion_stoica', 'arnold_schwarzenegger', 'keanu_reeves', 'the_dolphin', 'elon_musk', 'loki', 'raiden_shogun_and_ei', 'sam_altman', 'bruce_wayne', 'steve_jobs']
2023-09-13 20:48:38,583 - __init__ - catalog_manager.py - INFO - Persisting data in the chroma.
2023-09-13 20:48:38,583 - __init__ - catalog_manager.py - INFO - Total document load: 550
2023-09-13 20:48:38,584 - load_character_from_sql_database - catalog_manager.py - INFO - Started loading characters from SQL database
2023-09-13 20:48:38,587 - __init__ - elevenlabs.py - INFO - Initializing [ElevenLabs Text To Speech] voices...
2023-09-13 20:48:38,589 - load_character_from_sql_database - catalog_manager.py - INFO - Loaded 0 characters from sql database
2023-09-13 20:48:39,530 - __init__ - whisper.py - INFO - Loading [Local Whisper] model: [base](cpu) ...
[2023-09-13 20:48:40.597] [ctranslate2] [thread 61477] [warning] The compute type inferred from the saved model is float16, but the target device or backend do not support efficient float16 computation. The model weights have been automatically converted to use the float32 compute type instead.
INFO:     Started server process [14094]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
2023-09-13 20:49:08,595 - load_character_from_sql_database - catalog_manager.py - INFO - Started loading characters from SQL database
2023-09-13 20:49:08,596 - load_character_from_sql_database - catalog_manager.py - INFO - Loaded 0 characters from sql database
INFO:     127.0.0.1:57092 - "GET /characters HTTP/1.1" 200 OK
INFO:     ('127.0.0.1', 57193) - "WebSocket /ws/025c449625ad453f804a2458744eef9c?llm_model=gpt-3.5-turbo-16k&platform=web&use_search=false&use_quivr=false&use_multion=false&character_id=elon_musk&language=en-US&token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjE5MGFkMTE4YTk0MGFkYzlmMmY1Mzc2YjM1MjkyZmVkZThjMmQwZWUiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoidGFvIGtldmluIiwicGljdHVyZSI6Imh0dHBzOi8vbGgzLmdvb2dsZXVzZXJjb250ZW50LmNvbS9hL0FBY0hUdGRwRWMxSVFpbzEybTNpSFFBcy1JVEd2aHkwUEFISFRfd0dxZTBFZTN5VVRnPXM5Ni1jIiwiaXNzIjoiaHR0cHM6Ly9zZWN1cmV0b2tlbi5nb29nbGUuY29tL2Fzc2lzdGx5LWt1YmVybmV0ZXMiLCJhdWQiOiJhc3Npc3RseS1rdWJlcm5ldGVzIiwiYXV0aF90aW1lIjoxNjkzNDY2ODQyLCJ1c2VyX2lkIjoiTFliUld1RVdFOVR1MHRPemJnekpjQjBjbDJtMiIsInN1YiI6IkxZYlJXdUVXRTlUdTB0T3piZ3pKY0IwY2wybTIiLCJpYXQiOjE2OTQ2MDg4MDcsImV4cCI6MTY5NDYxMjQwNywiZW1haWwiOiJ0YW9rZXZpbjEwMjRAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZ29vZ2xlLmNvbSI6WyIxMDg4NjQ1NDAwNzk4NTg1MTY4ODQiXSwiZW1haWwiOlsidGFva2V2aW4xMDI0QGdtYWlsLmNvbSJdfSwic2lnbl9pbl9wcm92aWRlciI6Imdvb2dsZS5jb20ifX0.XpecMZFjvNT208Lg1RAxvo99N7wnY6I8NEwkXATUV5tf_ZGu9LlUVySNNWXzQ8aPpEvOLycKAHKwa0rZT7rLHRSSZmoxq6ijRqLvSz-KrxFwYzMcU7ZiArz5JX8De4qMNE5N7w0BfTets1pJyC0qaRujQwqRdhw0nmUDCF80BdoEcUNFJZN5MnrHvsHrAsXKv_V9zFGJMYIN1RYyQrTjWu-FPS2PDVV8g1mgExa5tzzgdMk9uPbp3YnqIxvx752JSsxq_iKEHzDgEqnAeZ4h2g039NQDqP-q6lRhpnQscXrw0WcqCbdF-_kkIHCc52xCsfTV9cqmXOLMolx9i4eUzg" [accepted]
INFO:     connection open
2023-09-13 20:49:33,200 - handle_receive - websocket_routes.py - INFO - User #025c449625ad453f804a2458744eef9c:web connected to server with session_id 025c449625ad453f804a2458744eef9c
2023-09-13 20:49:33,200 - handle_receive - websocket_routes.py - INFO - User #025c449625ad453f804a2458744eef9c selected character: Elon Musk
2023-09-13 20:49:38,602 - load_character_from_sql_database - catalog_manager.py - INFO - Started loading characters from SQL database
2023-09-13 20:49:38,603 - load_character_from_sql_database - catalog_manager.py - INFO - Loaded 0 characters from sql database
2023-09-13 20:49:42,177 - _generate_context - openai_llm.py - INFO - Found 0 documents

After a long time, the server log occasionally appears:

Retrying langchain.chat_models.openai.acompletion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised APIConnectionError: **Error communicating with OpenAI.**

Executing the following command times out:

> curl https://api.openai.com/v1/audio/transcriptions \
  -H "Authorization: Bearer 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" \
  -H "Content-Type: multipart/form-data" \
  -F model="whisper-1" \
  -F file="/Users/kevin/1-GR个人/16-XMDM项目代码/161-WDXM我的项目/1618-RealChar/realtime_ai_character/audio/training_data/raiden/1.mp3"
curl: (28) Failed to connect to api.openai.com port 443 after 75270 ms: Operation timed out

Terminal Client Log:

> python cli.py
1: gpt-3.5-turbo-16k 
2: gpt-4 
3: claude-2 
4: meta-llama/Llama-2-7b-chat-hf 
5: meta-llama/Llama-2-13b-chat-hf 
6: meta-llama/Llama-2-70b-chat-hf 
Select llm model:1
Client #2ebe23f307a84e4481de4ac05e10605f connected to server
Select your character by entering the corresponding number:
1 - Elon Musk
2 - Loki
3 - Raiden Shogun And Ei
4 - Sam Altman
5 - Bruce Wayne
6 - Steve Jobs

Select character: 1
Select mode (1: audio, 2: text): 2
You: Hi, my friend, what brings you here today?
You: Traceback (most recent call last):
  File "/Users/kevin/1-GR个人/16-XMDM项目代码/161-WDXM我的项目/1618-RealChar/client/cli.py", line 220, in <module>
    asyncio.run(main(url))
  File "/Users/kevin/miniconda3/envs/realchar-env/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/kevin/miniconda3/envs/realchar-env/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/kevin/1-GR个人/16-XMDM项目代码/161-WDXM我的项目/1618-RealChar/client/cli.py", line 211, in main
    await task
  File "/Users/kevin/1-GR个人/16-XMDM项目代码/161-WDXM我的项目/1618-RealChar/client/cli.py", line 204, in start_client
    await asyncio.gather(receive_task, send_task)
  File "/Users/kevin/1-GR个人/16-XMDM项目代码/161-WDXM我的项目/1618-RealChar/client/cli.py", line 149, in receive_message
    audio = AudioSegment.from_mp3(audio_data)
  File "/Users/kevin/miniconda3/envs/realchar-env/lib/python3.10/site-packages/pydub/audio_segment.py", line 796, in from_mp3
    return cls.from_file(file, 'mp3', parameters=parameters)
  File "/Users/kevin/miniconda3/envs/realchar-env/lib/python3.10/site-packages/pydub/audio_segment.py", line 728, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
  File "/Users/kevin/miniconda3/envs/realchar-env/lib/python3.10/site-packages/pydub/utils.py", line 279, in mediainfo_json
    info = json.loads(output)
  File "/Users/kevin/miniconda3/envs/realchar-env/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/Users/kevin/miniconda3/envs/realchar-env/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/kevin/miniconda3/envs/realchar-env/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

When running client/web, there is an error in the console:

react-jsx-dev-runtime.development.js:87 Warning: Each child in a list should have a unique "key" prop.
react-dom.development.js:86 Warning: Unsupported style property stroke-width. Did you mean strokeWidth?
image
su-heyang commented 11 months ago

Hi friend, how did you handle this problem? I also encountered it.