Вот мой код:
```py

# app.py

import json
from flask import Flask, render_template, request
from flask_socketio import SocketIO, emit
import httpx
from openai import OpenAI
import eventlet
import webview
from database import ChatDatabase

eventlet.monkey_patch()

app = Flask(__name__)
app.config['SECRET_KEY'] = 'your_secret_key'
socketio = SocketIO(app, async_mode='eventlet')

# Инициализация базы данных
db = ChatDatabase()

# Инициализация OpenAI API
OPENAI_API_KEY = "<TRUFFLEHOG_REDACTED_OPENAI>"

client = OpenAI(
    api_key=OPENAI_API_KEY,
    http_client=httpx.Client()
)

# Маршруты Flask
@app.route('/')
def index():
    return render_template('index.html')

# Обработчики SocketIO
@socketio.on('connect')
def handle_connect():
    print('Client connected')
    chats = db.get_chats()
    emit('chats_list', {'chats': chats})

@socketio.on('create_chat')
def handle_create_chat(data):
    chat_name = data.get('name', 'Новый чат')
    chat_id = db.create_chat(chat_name)
    emit('chat_created', {'chat_id': chat_id, 'chat_name': chat_name}, broadcast=True)

@socketio.on('get_messages')
def handle_get_messages(data):
    chat_id = data.get('chat_id')
    messages = db.get_messages(chat_id)
    emit('chat_messages', {'messages': messages})

@socketio.on('send_message')
def handle_send_message(data):
    chat_id = data.get('chat_id')
    message_content = data.get('content')
    db.save_message(chat_id, 'user', message_content)
    emit('new_message', {'sender': 'user', 'content': message_content}, room=request.sid)

    # Получение ответа от OpenAI API
    messages = [{'role': 'user', 'content': message_content}]
    response = client.chat.completions.create(
        model="gpt-3.5-turbo",
        messages=messages,
        stream=True
    )

    # Стриминг ответа
    bot_message = ''
    for chunk in response:
        if chunk.choices[0].delta.get('content'):
            content = chunk.choices[0].delta.content
            bot_message += content
            emit('stream_message', {'content': content}, room=request.sid)
            eventlet.sleep(0.01)

    db.save_message(chat_id, 'bot', bot_message)

@socketio.on('regenerate_message')
def handle_regenerate_message(data):
    chat_id = data.get('chat_id')
    message_id = data.get('message_id')
    # Удаляем сообщения из базы данных после указанного
    db.delete_messages_from(chat_id, message_id)
    # Ре-инициализируем чат и получаем новый ответ
    # Здесь нужно добавить код для генерации нового ответа

@socketio.on('delete_chat')
def handle_delete_chat(data):
    chat_id = data.get('chat_id')
    db.delete_chat(chat_id)
    emit('chat_deleted', {'chat_id': chat_id}, broadcast=True)

if __name__ == '__main__':
    window = webview.create_window('Chatbot', 'http://localhost:5000', width=800, height=600)
    def start_server():
        socketio.run(app, port=5000)
    import threading
    server = threading.Thread(target=start_server)
    server.daemon = True
    server.start()
    webview.start()

```
Ошибка:
```
Traceback (most recent call last):
  File "D:\PycharmProjects\D1_1\app.py", line 13, in <module>
    eventlet.monkey_patch()
  File "D:\PycharmProjects\D1_1\.venv\lib\site-packages\eventlet\patcher.py", line 280, in monkey_patch
    _green_existing_locks()
  File "D:\PycharmProjects\D1_1\.venv\lib\site-packages\eventlet\patcher.py", line 409, in _green_existing_locks
    if isinstance(obj, rlock_type):
  File "D:\PycharmProjects\D1_1\.venv\lib\site-packages\openai\_utils\_proxy.py", line 49, in __class__
    proxied = self.__get_proxied__()
  File "D:\PycharmProjects\D1_1\.venv\lib\site-packages\openai\_utils\_proxy.py", line 55, in __get_proxied__
    return self.__load__()
  File "D:\PycharmProjects\D1_1\.venv\lib\site-packages\openai\_module_client.py", line 12, in __load__
    return _load_client().chat
  File "D:\PycharmProjects\D1_1\.venv\lib\site-packages\openai\__init__.py", line 327, in _load_client
    _client = _ModuleClient(
  File "D:\PycharmProjects\D1_1\.venv\lib\site-packages\openai\_client.py", line 105, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
```
Ошибка где-то глубоко