Skip to content
Draft
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
543 commits
Select commit Hold shift + click to select a range
c63cfd3
Update files.py
chelaxian Apr 5, 2025
2e2fc12
Update images.py
chelaxian Apr 5, 2025
4eb872b
Update text.py
chelaxian Apr 5, 2025
9208cd2
Update README.md
chelaxian Apr 5, 2025
bd8e2f6
Update README.md
chelaxian Apr 5, 2025
ab48903
Create __init__.py
chelaxian Apr 5, 2025
d5d899d
Create __init__.py:
chelaxian Apr 5, 2025
6077b55
Update app.py
chelaxian Apr 5, 2025
b148c25
Rename __init__.py: to __init__.py
chelaxian Apr 5, 2025
ded2053
Create INFO.md
chelaxian Apr 5, 2025
80d65b9
Update INFO.md
chelaxian Apr 5, 2025
a4efa63
Update INFO.md
chelaxian Apr 5, 2025
25f3d8e
Update INFO.md
chelaxian Apr 5, 2025
5d08de6
Update common.py
chelaxian Apr 5, 2025
fdab48f
Update constants.py
chelaxian Apr 5, 2025
23501cb
Update memcached.py
chelaxian Apr 5, 2025
e3c9944
Update audio.py
chelaxian Apr 5, 2025
95e1999
Update files.py
chelaxian Apr 5, 2025
0dcab4f
Update images.py
chelaxian Apr 5, 2025
785b760
Update text.py
chelaxian Apr 5, 2025
553065c
Update INFO.md
chelaxian Apr 5, 2025
baa0bde
Update INFO.md
chelaxian Apr 5, 2025
399823c
Update app.py
chelaxian Apr 5, 2025
25ff5b5
Update memcached.py
chelaxian Apr 5, 2025
627c276
Update common.py
chelaxian Apr 5, 2025
14b32b1
Update __init__.py
chelaxian Apr 5, 2025
e804a3c
Update __init__.py
chelaxian Apr 5, 2025
a6e37b6
Update app.py
chelaxian Apr 5, 2025
6c20f74
Update memcached.py
chelaxian Apr 5, 2025
30b7898
Update common.py
chelaxian Apr 5, 2025
787dae3
Update __init__.py
chelaxian Apr 5, 2025
087fa4e
Update __init__.py
chelaxian Apr 5, 2025
5ef4d99
Update app.py
chelaxian Apr 5, 2025
b798a21
Create logger.py
chelaxian Apr 5, 2025
f091ffc
Update app.py
chelaxian Apr 5, 2025
ac37727
Update memcached.py
chelaxian Apr 5, 2025
23538b4
Update common.py
chelaxian Apr 5, 2025
3fee1c0
Update __init__.py
chelaxian Apr 5, 2025
8d00b61
Update __init__.py
chelaxian Apr 5, 2025
278c678
Update __init__.py
chelaxian Apr 6, 2025
409e725
Create imports.py
chelaxian Apr 6, 2025
4f8be70
Update app.py
chelaxian Apr 6, 2025
ad674a8
Update common.py
chelaxian Apr 6, 2025
72fa494
Update constants.py
chelaxian Apr 6, 2025
51fb416
Update logger.py
chelaxian Apr 6, 2025
62fb934
Update memcached.py
chelaxian Apr 6, 2025
646651f
Update app.py
chelaxian Apr 6, 2025
222b1d4
Update __init__.py
chelaxian Apr 6, 2025
1d010ab
Update __init__.py
chelaxian Apr 6, 2025
b167923
Update __init__.py
chelaxian Apr 6, 2025
db392f7
Update audio.py
chelaxian Apr 6, 2025
d110f96
Update files.py
chelaxian Apr 6, 2025
d101ead
Update images.py
chelaxian Apr 6, 2025
a1e2c42
Update text.py
chelaxian Apr 6, 2025
ce2b9fb
Update __init__.py
chelaxian Apr 6, 2025
2514a4d
Update common.py
chelaxian Apr 6, 2025
2bd3b90
Update constants.py
chelaxian Apr 6, 2025
22eddb5
Update imports.py
chelaxian Apr 6, 2025
e96f708
Update logger.py
chelaxian Apr 6, 2025
397209f
Update memcached.py
chelaxian Apr 6, 2025
540db85
Update app.py
chelaxian Apr 6, 2025
7fb1e4d
Update constants.py
chelaxian Apr 6, 2025
aee3f89
Update __init__.py
chelaxian Apr 6, 2025
cc4f53c
Update audio.py
chelaxian Apr 6, 2025
81c5bc1
Update app.py
chelaxian Apr 6, 2025
f66729f
Update __init__.py
chelaxian Apr 6, 2025
e854e72
Update audio.py
chelaxian Apr 6, 2025
00153a8
Update files.py
chelaxian Apr 6, 2025
6eaa063
Update images.py
chelaxian Apr 6, 2025
3e543aa
Update text.py
chelaxian Apr 6, 2025
4fb1ebe
Update text.py
chelaxian Apr 6, 2025
7a36917
Update audio.py
chelaxian Apr 6, 2025
01b8854
Update audio.py
chelaxian Apr 6, 2025
e5c6efd
Update images.py
chelaxian Apr 6, 2025
aaae792
Update audio.py
chelaxian Apr 6, 2025
739b905
Update files.py
chelaxian Apr 6, 2025
3266f09
Update images.py
chelaxian Apr 6, 2025
74a1e63
Update text.py
chelaxian Apr 6, 2025
339afd7
Update constants.py
chelaxian Apr 6, 2025
54e85dd
Update INFO.md
chelaxian Apr 6, 2025
350ab21
Update INFO.md
chelaxian Apr 6, 2025
681dc6b
Update INFO.md
chelaxian Apr 6, 2025
a80c898
Update INFO.md
chelaxian Apr 6, 2025
eeee44b
Update __init__.py
chelaxian Apr 6, 2025
69771c2
Update audio.py
chelaxian Apr 6, 2025
1a5b325
Update files.py
chelaxian Apr 6, 2025
c5b9a43
Update images.py
chelaxian Apr 6, 2025
84da524
Update text.py
chelaxian Apr 6, 2025
4abb1cb
Update __init__.py
chelaxian Apr 6, 2025
3be6442
Update common.py
chelaxian Apr 6, 2025
38d9755
Update constants.py
chelaxian Apr 6, 2025
18f29dd
Update imports.py
chelaxian Apr 6, 2025
dd22a2a
Update logger.py
chelaxian Apr 6, 2025
02e6de8
Update memcached.py
chelaxian Apr 6, 2025
c657ff2
Update app.py
chelaxian Apr 6, 2025
c02c067
Create utils.py
chelaxian Apr 6, 2025
12359c0
Update constants.py
chelaxian Apr 6, 2025
d12f089
Update constants.py
chelaxian Apr 6, 2025
d372e32
Update text.py
chelaxian Apr 6, 2025
5c7a552
Update images.py
chelaxian Apr 6, 2025
d1e106f
Update text.py
chelaxian Apr 6, 2025
f65e5f2
Update images.py
chelaxian Apr 6, 2025
9984a6e
Update text.py
chelaxian Apr 6, 2025
7ffb9b3
Update images.py
chelaxian Apr 6, 2025
2bc7fca
Update text.py
chelaxian Apr 6, 2025
2fc06f4
Update text.py
chelaxian Apr 6, 2025
f048ece
Update constants.py
chelaxian Apr 6, 2025
9fe088d
Update images.py
chelaxian Apr 6, 2025
621e07d
Update text.py
chelaxian Apr 6, 2025
64c7dcf
Update text.py
chelaxian Apr 6, 2025
4e0a304
Update memcached.py
chelaxian Apr 6, 2025
b2ca1d1
Update README.md
chelaxian Apr 6, 2025
d3bbba7
Update and rename INFO.md to CODE_STRUCTURE.md
chelaxian Apr 6, 2025
09cd911
Merge pull request #1 from chelaxian/test
chelaxian Apr 6, 2025
1891af6
Create UPDATE.sh
chelaxian Apr 6, 2025
26c4a27
Update README.md
chelaxian Apr 6, 2025
4b64797
Update README.md
chelaxian Apr 6, 2025
aca4db9
Update docker-compose.yml
chelaxian Apr 6, 2025
add1502
Update UPDATE.sh
chelaxian Apr 6, 2025
ae29b57
Update README.md
chelaxian Apr 7, 2025
e6b64d2
Update README.md
chelaxian Apr 7, 2025
4d61c0d
Update README.md
chelaxian Apr 7, 2025
3f16b21
Create INSTALL.sh
chelaxian Apr 7, 2025
e67a7b6
Create RUN.sh
chelaxian Apr 7, 2025
f736488
Update README.md
chelaxian Apr 7, 2025
0756ba2
Update README.md
chelaxian Apr 7, 2025
3d3deca
Update README.md
chelaxian Apr 7, 2025
bc6bffe
Update README.md
chelaxian Apr 7, 2025
c68f250
Update README.md
chelaxian Apr 7, 2025
683fe38
Update README.md
chelaxian Apr 7, 2025
b38fc7f
Update UPDATE.sh
chelaxian Apr 7, 2025
3d8a851
Update constants.py
chelaxian Apr 7, 2025
ba09ae2
Update images.py
chelaxian Apr 7, 2025
ce2e702
Create STOP.sh
chelaxian Apr 7, 2025
fd46cd6
Update README.md
chelaxian Apr 7, 2025
555cf50
Update __init__.py
chelaxian Apr 7, 2025
b35288d
Update audio.py
chelaxian Apr 7, 2025
267ac1e
Update files.py
chelaxian Apr 7, 2025
5c97c59
Update images.py
chelaxian Apr 7, 2025
1172d34
Update text.py
chelaxian Apr 7, 2025
0ae0a9a
Update and rename utils.py to functions.py
chelaxian Apr 7, 2025
98d5c60
Update README.md
chelaxian Apr 7, 2025
94d4a88
Update functions.py
chelaxian Apr 7, 2025
92131ae
Update text.py
chelaxian Apr 7, 2025
f71a40e
Update text.py
chelaxian Apr 7, 2025
79227d9
Update functions.py
chelaxian Apr 7, 2025
00f7a43
Rename routes/STOP.sh to STOP.sh
chelaxian Apr 7, 2025
f1b4278
Create __init__.py
chelaxian Apr 7, 2025
479b6ce
Create audio_func.py
chelaxian Apr 7, 2025
b9e21b5
Create file_func.py
chelaxian Apr 7, 2025
c41976d
Create img_func.py
chelaxian Apr 7, 2025
5000591
Create shared_func.py
chelaxian Apr 7, 2025
2d7bd3d
Create txt_func.py
chelaxian Apr 7, 2025
7df8f06
Update __init__.py
chelaxian Apr 7, 2025
a23a877
Update CODE_STRUCTURE.md
chelaxian Apr 7, 2025
2390ba8
Update README.md
chelaxian Apr 7, 2025
599b10e
Rename docker-compose.yml to backup/old/docker-compose.yml
chelaxian Apr 7, 2025
6884e5f
Create README_EN.md
chelaxian Apr 7, 2025
2b3a403
Merge pull request #2 from chelaxian/test3
chelaxian Apr 7, 2025
e770516
Create CODE_STRUCTURE_EN.md
chelaxian Apr 7, 2025
bbba760
Update CODE_STRUCTURE_EN.md
chelaxian Apr 7, 2025
58c569e
Update CODE_STRUCTURE.md
chelaxian Apr 7, 2025
a19b04a
Update CODE_STRUCTURE_EN.md
chelaxian Apr 7, 2025
e1431f2
Update CODE_STRUCTURE.md
chelaxian Apr 7, 2025
004131c
Update CODE_STRUCTURE_EN.md
chelaxian Apr 7, 2025
343ffa0
Update UPDATE.sh
chelaxian Apr 7, 2025
c9472bf
Update INSTALL.sh
chelaxian Apr 7, 2025
83452f2
Update text.py
chelaxian Apr 7, 2025
15d5f95
Update txt_func.py
chelaxian Apr 7, 2025
55705d4
Update images.py
chelaxian Apr 7, 2025
90c05a6
Update img_func.py
chelaxian Apr 7, 2025
0a422b9
Merge pull request #3 from chelaxian/test4
chelaxian Apr 7, 2025
1add2b7
Update audio.py
chelaxian Apr 7, 2025
3faaa23
Update audio_func.py
chelaxian Apr 7, 2025
1bf9d87
Update files.py
chelaxian Apr 7, 2025
a331ea4
Update file_func.py
chelaxian Apr 7, 2025
9ee0abd
Update img_func.py
chelaxian Apr 7, 2025
ae27734
Update shared_func.py
chelaxian Apr 7, 2025
6c2e148
Update audio_func.py
chelaxian Apr 7, 2025
3e63b0c
Update README.md
chelaxian Apr 7, 2025
025d9ab
Update README_EN.md
chelaxian Apr 7, 2025
fbe12cb
Update images.py
chelaxian Apr 7, 2025
5426cb4
Update memcached.py
chelaxian Apr 7, 2025
9c4c3c5
Update audio.py
chelaxian Apr 7, 2025
18a4b31
Update __init__.py
chelaxian Apr 7, 2025
fc989fe
Update CODE_STRUCTURE.md
chelaxian Apr 7, 2025
4c52108
Update CODE_STRUCTURE_EN.md
chelaxian Apr 7, 2025
7d4efe2
Update __init__.py
chelaxian Apr 7, 2025
8014bdc
Update __init__.py
chelaxian Apr 7, 2025
fa7f271
Update functions.py
chelaxian Apr 7, 2025
f4ec56c
Update functions.py
chelaxian Apr 7, 2025
7a0de7c
Update __init__.py
chelaxian Apr 7, 2025
8a922d4
Update functions.py
chelaxian Apr 7, 2025
5452489
Update __init__.py
chelaxian Apr 7, 2025
06a5280
Update images.py
chelaxian Apr 7, 2025
71a1250
Update CODE_STRUCTURE_EN.md
chelaxian Apr 7, 2025
b356c12
Update CODE_STRUCTURE.md
chelaxian Apr 7, 2025
70d3ea6
Update images.py
chelaxian Apr 7, 2025
1929f98
Update __init__.py
chelaxian Apr 7, 2025
9f12d83
Update functions.py
chelaxian Apr 7, 2025
471a006
Update text.py
chelaxian Apr 7, 2025
5d0c442
Update audio.py
chelaxian Apr 7, 2025
78e16cc
Update images.py
chelaxian Apr 7, 2025
22f3266
Update CODE_STRUCTURE_EN.md
chelaxian Apr 7, 2025
6b18b3f
Update CODE_STRUCTURE.md
chelaxian Apr 7, 2025
b08014b
Update shared_func.py
chelaxian Apr 7, 2025
c4cebcb
Update common.py
chelaxian Apr 7, 2025
be13b0e
Update imports.py
chelaxian Apr 7, 2025
a577213
Update memcached.py
chelaxian Apr 7, 2025
ef91ea4
Create async_tasks.py
chelaxian Apr 7, 2025
a57a270
Delete routes/async_tasks.py
chelaxian Apr 7, 2025
56928af
Update img_func.py
chelaxian Apr 7, 2025
30ae8b9
Update audio_func.py
chelaxian Apr 7, 2025
5f30d4f
Merge pull request #4 from chelaxian/test6
chelaxian Apr 7, 2025
595feef
Update README_EN.md
chelaxian Apr 8, 2025
b13e035
Update README.md
chelaxian Apr 8, 2025
b49ecf6
Update text.py
chelaxian Apr 8, 2025
83bd836
Update constants.py
chelaxian Apr 8, 2025
0822fed
Update txt_func.py
chelaxian Apr 8, 2025
5cf0226
Update app.py
chelaxian Apr 8, 2025
8743970
Update __init__.py
chelaxian Apr 8, 2025
72d0cd9
Update common.py
chelaxian Apr 8, 2025
5bfb288
Update constants.py
chelaxian Apr 8, 2025
06cc25f
Update imports.py
chelaxian Apr 8, 2025
cec9062
Update logger.py
chelaxian Apr 8, 2025
0f701d1
Update memcached.py
chelaxian Apr 8, 2025
c838188
Update app.py
chelaxian Apr 8, 2025
994366f
Update constants.py
chelaxian Apr 8, 2025
706a917
Update memcached.py
chelaxian Apr 8, 2025
621db30
Update memcached.py
chelaxian Apr 8, 2025
d1fc521
Update img_func.py
chelaxian Apr 8, 2025
7fd1085
Update memcached.py
chelaxian Apr 8, 2025
ff870af
Update memcached.py
chelaxian Apr 8, 2025
80a55d9
Update memcached.py
chelaxian Apr 8, 2025
7ff9c33
Update app.py
chelaxian Apr 8, 2025
5c8f9cd
Update app.py
chelaxian Apr 8, 2025
e37cb2b
Update memcached.py
chelaxian Apr 8, 2025
40150a6
Update constants.py
chelaxian Apr 8, 2025
7e53e09
Update imports.py
chelaxian Apr 8, 2025
08a6971
Merge pull request #6 from chelaxian/new1
chelaxian Apr 8, 2025
75dbc42
Update audio_func.py
chelaxian Apr 8, 2025
3591594
Update audio.py
chelaxian Apr 8, 2025
167a1a3
Update text.py
chelaxian Apr 8, 2025
f069ba0
Merge pull request #7 from chelaxian/new1
chelaxian Apr 8, 2025
c6d6f58
Update constants.py
chelaxian Jun 4, 2025
fa40c3d
Update constants.py
chelaxian Aug 22, 2025
2a14b5a
Update constants.py
chelaxian Aug 22, 2025
ee7a986
Update constants.py
chelaxian Dec 14, 2025
d18cc10
Update constants.py
chelaxian Dec 14, 2025
a2d26b3
Update constants.py
chelaxian Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 280 additions & 0 deletions CODE_STRUCTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
# code structure

разбивка на логические модули:
---
1. [app.py](https://github.com/chelaxian/1min-relay/blob/test/app.py) (основной файл)
```python
# Инициализация
app = Flask(__name__)
# ...

# Основные настройки
if __name__ == "__main__":
# Логирование старта сервера
# ...
# Запуск сервера
serve(app, host="0.0.0.0", port=PORT, threads=6)
```
---
2. [utils/common.py](https://github.com/chelaxian/1min-relay/blob/test/utils/common.py)
```python
# Общие утилиты
def calculate_token(sentence, model="DEFAULT"):
# ...

def api_request(req_method, url, headers=None, requester_ip=None, data=None, files=None, stream=False, timeout=None, json=None, **kwargs):
# ...

def set_response_headers(response):
# ...

def create_session():
# ...

def safe_temp_file(prefix, request_id=None):
# ...

def ERROR_HANDLER(code, model=None, key=None):
# ...

def handle_options_request():
# ...

def split_text_for_streaming(text, chunk_size=6):
# ...
```
---
3. [utils/constants.py](https://github.com/chelaxian/1min-relay/blob/test/utils/constants.py)
```python
ONE_MIN_API_URL = "https://api.1min.ai/api/features"
PORT = 5000
# другие глобальные переменные...
```
---
4. [utils/imports.py](https://github.com/chelaxian/1min-relay/blob/test/utils/imports.py)
```python
# Стандартные библиотеки Python
import base64
# Библиотеки Flask и зависимости
from flask import Flask, request, jsonify, make_response, Response, redirect, url_for
# другие импорты...
```
---
5. [utils/logger.py](https://github.com/chelaxian/1min-relay/blob/test/utils/logger.py)
```python
# Создаем логгер
logger = logging.getLogger("1min-relay")
logger.setLevel(logging.DEBUG)
# ...
```
---
6. [utils/memcached.py](https://github.com/chelaxian/1min-relay/blob/test/utils/memcached.py)
```python
# Функции для работы с Memcached
def check_memcached_connection():
# ...

def set_global_refs(memcached_client=None, memory_storage=None):
# ...

def safe_memcached_operation(operation, key, value=None, expiry=3600):
# ...

def delete_all_files_task():
# ...
```
---
7. [routes/utils.py](https://github.com/chelaxian/1min-relay/blob/test/routes/utils.py)
```python
# Общие утилиты для маршрутов

def validate_auth(request, request_id=None):
# ...

def handle_api_error(response, api_key=None, request_id=None):
# ...

def format_openai_response(content, model, request_id=None, prompt_tokens=0):
# ...

def get_user_files(api_key, request_id=None):
# ...

def save_user_files(api_key, files, request_id=None):
# ...

def create_temp_file(file_data, suffix=".tmp", request_id=None):
# ...

def upload_asset(file_data, filename, mime_type, api_key, request_id=None, file_type=None):
# ...

def get_mime_type(filename):
# ...

def extract_image_urls(response_data, request_id=None):
# ...

def format_image_response(image_urls, request_id=None, model=None):
# ...

def prepare_image_payload(model, prompt, request_data, image_paths=None, request_id=None):
# ...

def prepare_chat_payload(model, messages, request_data, request_id=None):
# ...

def stream_response(response, request_data, model, prompt_tokens, session=None):
# ...
```
---
8. [routes/text.py](https://github.com/chelaxian/1min-relay/blob/test/routes/text.py)
```python
# Маршруты для текстовых моделей
@app.route("/", methods=["GET", "POST"])
def index():
# ...

@app.route("/v1/models")
@limiter.limit("60 per minute")
def models():
# ...

@app.route("/v1/chat/completions", methods=["POST"])
@limiter.limit("60 per minute")
def conversation():
# ...

@app.route("/v1/assistants", methods=["POST", "OPTIONS"])
@limiter.limit("60 per minute")
def create_assistant():
# ...

# Вспомогательные функции для текстовых моделей
def format_conversation_history(messages, new_input):
# ...

def get_model_capabilities(model):
# ...

def prepare_payload(request_data, model, all_messages, image_paths=None, request_id=None):
# ...

def transform_response(one_min_response, request_data, prompt_token):
# ...

def emulate_stream_response(full_content, request_data, model, prompt_tokens):
# ...
```
---
9. [routes/images.py](https://github.com/chelaxian/1min-relay/blob/test/routes/images.py)
```python
# Маршруты для работы с изображениями
@app.route("/v1/images/generations", methods=["POST", "OPTIONS"])
@limiter.limit("60 per minute")
def generate_image():
# ...

@app.route("/v1/images/variations", methods=["POST", "OPTIONS"])
@limiter.limit("60 per minute")
@cross_origin()
def image_variations():
# ...

# Вспомогательные функции для изображений
def get_full_url(url, asset_host="https://asset.1min.ai"):
# ...

def build_generation_payload(model, prompt, request_data, negative_prompt, aspect_ratio, size, mode, request_id):
# ...

def extract_image_urls_from_response(response_json, request_id):
# ...

def parse_aspect_ratio(prompt, model, request_data, request_id=None):
# ...

def retry_image_upload(image_url, api_key, request_id=None):
# ...

def create_image_variations(image_url, user_model, n, aspect_width=None, aspect_height=None, mode=None, request_id=None):
# ...
```
---
10. [routes/audio.py](https://github.com/chelaxian/1min-relay/blob/test/routes/audio.py)
```python
# Маршруты для работы с аудио
@app.route("/v1/audio/transcriptions", methods=["POST", "OPTIONS"])
@limiter.limit("60 per minute")
def audio_transcriptions():
# ...

@app.route("/v1/audio/translations", methods=["POST", "OPTIONS"])
@limiter.limit("60 per minute")
def audio_translations():
# ...

@app.route("/v1/audio/speech", methods=["POST", "OPTIONS"])
@limiter.limit("60 per minute")
def text_to_speech():
# ...

# Вспомогательные функции для аудио
def upload_audio_file(audio_file, api_key, request_id):
# ...

def try_models_in_sequence(models_to_try, payload_func, api_key, request_id):
# ...

def extract_text_from_response(response_data, request_id):
# ...

def prepare_models_list(requested_model, available_models):
# ...

def get_audio_from_url(audio_url, request_id):
# ...

def handle_error_response(error, api_key, request_id):
# ...

def extract_audio_url(response_data, request_id):
# ...
```
---
11. [routes/files.py](https://github.com/chelaxian/1min-relay/blob/test/routes/files.py)
```python
# Маршруты для работы с файлами
@app.route("/v1/files", methods=["GET", "POST", "OPTIONS"])
@limiter.limit("60 per minute")
def handle_files():
# ...

@app.route("/v1/files/<file_id>", methods=["GET", "DELETE", "OPTIONS"])
@limiter.limit("60 per minute")
def handle_file(file_id):
# ...

@app.route("/v1/files/<file_id>/content", methods=["GET", "OPTIONS"])
@limiter.limit("60 per minute")
def handle_file_content(file_id):
# ...

# Вспомогательные функции для работы с файлами
def format_file_response(file_info, file_id=None, purpose="assistants", status="processed"):
# ...

def create_api_response(data, request_id=None):
# ...

def find_conversation_id(response_data, request_id=None):
# ...

def find_file_by_id(user_files, file_id):
# ...

def create_conversation_with_files(file_ids, title, model, api_key, request_id=None):
# ...
```
---

7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ WORKDIR /app
COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt
RUN pip install python-memcached

COPY . .

# Создаем директорию для временных файлов
RUN mkdir -p temp

EXPOSE 5001

CMD ["python", "main.py"]
# Изменяем запуск с main.py на app.py
CMD ["python", "app.py"]
Loading