Skip to content

Commit e022427

Browse files
authored
Merge pull request #8 from YoannDev90/dev
Dev
2 parents 4b92c30 + 20d7de5 commit e022427

70 files changed

Lines changed: 1302 additions & 802 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env_sample

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
BOT_TOKEN="--- IGNORE ---"
2+
LOGGER_BOT_TOKEN="--- IGNORE ---"
3+
ADMIN_BOT_TOKEN="--- IGNORE ---"
4+
5+
DEV_BOT_TOKEN="--- IGNORE ---"
6+
DEV_ADMIN_BOT_TOKEN="--- IGNORE ---"
7+
8+
MISTRAL_BOT_TOKEN="--- IGNORE ---"
9+
GEMINI_BOT_TOKEN="--- IGNORE ---"
10+
LLAMA_BOT_TOKEN="--- IGNORE ---"
11+
EVILGPT_BOT_TOKEN="--- IGNORE ---"
12+
DEEPSEEK_BOT_TOKEN="--- IGNORE ---"
13+
PERPLEXITY_BOT_TOKEN="--- IGNORE ---"
14+
CHATGPT_BOT_TOKEN="--- IGNORE ---"
15+
GROK_BOT_TOKEN="--- IGNORE ---"
16+
QWEN_BOT_TOKEN="--- IGNORE ---"
17+
CLAUDE_BOT_TOKEN="--- IGNORE ---"
18+
PHI_BOT_TOKEN="--- IGNORE ---"
19+
KIMI_BOT_TOKEN="--- IGNORE ---"
20+
GLM_BOT_TOKEN="--- IGNORE ---"
21+
COMMAND_BOT_TOKEN="--- IGNORE ---"
22+
23+
CEREBRAS_API_KEY="--- IGNORE ---"
24+
MISTRAL_API_KEY="--- IGNORE ---"
25+
GEMINI_API_KEY="--- IGNORE ---"
26+
OPENROUTER_API_KEY="--- IGNORE ---"
27+
GROQ_API_KEY="--- IGNORE ---"
28+
AIML_API_KEY="--- IGNORE ---"
29+
BYTEZ_API_KEY="--- IGNORE ---"
30+
POLLINATIONS_API_KEY="--- IGNORE ---"
31+
COHERE_API_KEY="--- IGNORE ---"
32+
CLOUDFLARE_WORKERS_API_KEY="--- IGNORE ---"
33+
CLOUDFLARE_WORKERS_ACCOUNT_ID="--- IGNORE ---"
34+
NAVY_API_KEY="--- IGNORE ---"
35+
VOID_API_KEY="--- IGNORE ---"
36+
MNN_AI_API_KEY="--- IGNORE ---"
37+
ELECTRONHUB_API_KEY="--- IGNORE ---"
38+
39+
NSFW_CLASSIFIER_API_KEY="--- IGNORE ---"
40+
CROWDIN_API_KEY="--- IGNORE ---"
41+
OPIK_API_KEY="--- IGNORE ---"
42+
SPEECHIFY_API_KEY="--- IGNORE ---"
43+
TAVILY_API_KEY="--- IGNORE ---"
44+
CLOUDINARY_URL="--- IGNORE ---"
45+
46+
DB_URL="--- IGNORE ---"
47+
DB_KEY="--- IGNORE ---"
48+
JWT_KEY="--- IGNORE ---"
49+
50+
DB_DIRECT_CONN="--- IGNORE ---"
51+
DB_HOST="--- IGNORE ---"
52+
DB_PORT="--- IGNORE ---"
53+
DB_USER="--- IGNORE ---"
54+
DB_PASSWORD="--- IGNORE ---"
55+
DB_NAME="--- IGNORE ---"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ polls
1010
publish.sh
1111
crowdin.yml
1212
config.toml
13+
cert.pem
14+
key.pem
1315
API_KEY.txt

api/api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ async def start_api_async(host: str = API_HOST, port: int = API_PORT):
4444
host=API_HOST,
4545
port=API_PORT,
4646
log_level="info",
47-
reload=True
47+
reload=True,
48+
ssl_keyfile="key.pem",
49+
ssl_certfile="cert.pem"
4850
)
4951
except Exception as e:
5052
logger.error(f"Erreur lors du démarrage du serveur API: {str(e)}")

api/endpoints/image_gen.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from typing import Optional
44
import asyncio
55
import base64
6+
import json
7+
import os
68

79
from . import logger, REQUEST_TIMEOUT
810
from api.utils.security_utils import get_api_key
@@ -54,12 +56,9 @@ async def generate_image(
5456
logger.error(f"Format d'image non supporté dans tuple: {type(image_data)}")
5557
return {"status": "error", "message": "Format d'image non supporté"}
5658
else:
57-
if isinstance(response, str):
58-
logger.info(f"Image générée avec succès - URL directe: {response[:50]}{'...' if len(response) > 50 else ''}")
59-
return {"status": "success", "image_url": response}
60-
elif isinstance(response, bytes):
59+
if isinstance(response, bytes):
6160
image_b64 = base64.b64encode(response).decode('utf-8')
62-
logger.info(f"Image générée avec succès - Données binaires directes encodées en base64 ({len(response)} bytes)")
61+
logger.info(f"Image générée avec succès")
6362
return {
6463
"status": "success",
6564
"image_data": image_b64,

api/models/image_models.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,74 @@
44
"author": "Black Forest Labs",
55
"supported_sizes": ["512x512", "768x768", "1024x1024"]
66
},
7+
"flux-schnell": {
8+
"name": "Flux Schnell",
9+
"author": "Black Forest Labs",
10+
"supported_sizes": ["512x512", "768x768", "1024x1024"]
11+
},
712
"sdxl": {
813
"name": "Stable Diffusion XL",
914
"author": "Stability AI",
1015
"supported_sizes": ["512x512", "768x768", "1024x1024", "1152x896", "896x1152"]
16+
},
17+
"sdlarge": {
18+
"name": "Stable Diffusion 3.5 Large",
19+
"author": "Stability AI",
20+
"supported_sizes": ["512x512", "768x768", "1024x1024", "1152x896", "896x1152"]
21+
},
22+
"dalle": {
23+
"name": "DALL-E 3",
24+
"author": "OpenAI",
25+
"supported_sizes": ["1024x1024", "1792x1024", "1024x1792"]
26+
},
27+
"gpt-image": {
28+
"name": "GPT-Image-1",
29+
"author": "OpenAI",
30+
"supported_sizes": ["512x512", "768x768", "1024x1024"]
31+
},
32+
"imagen": {
33+
"name": "Imagen 3 Fast",
34+
"author": "Google",
35+
"supported_sizes": ["512x512", "768x768", "1024x1024"]
36+
},
37+
"recraft": {
38+
"name": "Recraft 20B",
39+
"author": "Recraft AI",
40+
"supported_sizes": ["512x512", "768x768", "1024x1024"]
41+
},
42+
"sana": {
43+
"name": "Sana",
44+
"author": "NVIDIA",
45+
"supported_sizes": ["512x512", "768x768", "1024x1024"]
46+
},
47+
"playground": {
48+
"name": "Playground v2.5",
49+
"author": "Playground AI",
50+
"supported_sizes": ["512x512", "768x768", "1024x1024"]
51+
},
52+
"phoenix": {
53+
"name": "Phoenix 1.0",
54+
"author": "Phoenix AI",
55+
"supported_sizes": ["512x512", "768x768", "1024x1024"]
56+
},
57+
"kontext": {
58+
"name": "Kontext",
59+
"author": "Black Forest Labs",
60+
"supported_sizes": ["512x512", "768x768", "1024x1024", "1152x896", "896x1152"]
61+
},
62+
"nanobanana": {
63+
"name": "Nanobanana",
64+
"author": "Google",
65+
"supported_sizes": ["512x512", "768x768", "1024x1024", "1152x896", "896x1152"]
66+
},
67+
"seedream": {
68+
"name": "Seedream",
69+
"author": "ByteDance",
70+
"supported_sizes": ["512x512", "768x768", "1024x1024", "1152x896", "896x1152"]
71+
},
72+
"turbo": {
73+
"name": "Turbo",
74+
"author": "Stability AI",
75+
"supported_sizes": ["512x512", "768x768", "1024x1024", "1152x896", "896x1152"]
1176
}
1277
}

api/models/text_models.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2+
"auto": {
3+
"name": "Auto",
4+
"author": "AlphaLLM",
5+
"icon": "https://alphallm.tech/assets/images/bots/alphallm.webp"
6+
},
27
"mistral": {
38
"name": "Mistral",
49
"author": "Mistral AI",

api/utils/security_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Optional
88
import logging
99

10-
from utils.config import API_KEYS, API_KEY_REQUIRED, LOGGER_NAME
10+
from utils.config import API_KEYS, API_KEYS_MAPPING, API_KEY_REQUIRED, LOGGER_NAME
1111

1212
logger = logging.getLogger(LOGGER_NAME)
1313

@@ -70,7 +70,9 @@ def verify_api_access(api_key: str) -> bool:
7070

7171
is_valid = api_key in API_KEYS
7272
if is_valid:
73-
logger.info(f"Authentification réussie pour la clé API: {api_key[:8]}***")
73+
# Retrouver le nom associé à la clé API pour les logs
74+
user_name = next((name for name, key in API_KEYS_MAPPING.items() if key == api_key), "utilisateur inconnu")
75+
logger.info(f"Authentification réussie pour l'utilisateur: {user_name}")
7476
else:
7577
logger.warning(f"Tentative d'authentification échouée avec la clé API: {api_key[:8]}***")
7678

api/utils/server_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import socket
99
import logging
1010

11-
from utils.config import REQUEST_TIMEOUT, LOGGER_NAME
11+
from utils.config import REQUEST_TIMEOUT, LOGGER_NAME, API_URL
1212

1313
logger = logging.getLogger(LOGGER_NAME)
1414

@@ -24,7 +24,7 @@ def get_server_ip():
2424
return "127.0.0.1"
2525

2626
async def is_https_api_running():
27-
url = "https://alphallm-api.onrender.com/status"
27+
url = f"{API_URL}/status"
2828
try:
2929
logger.debug(f"Vérification de l'état de l'API HTTPS: {url}")
3030
timeout = aiohttp.ClientTimeout(total=10)

bots/bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from utils.database import get_supabase_client
99
from utils.config import DEBUG, GUILD_ID, OWNER_ID, get_bot_token, LOGGER_NAME
1010
from utils.server_config import update_all_guilds_info
11-
from embeds.welcome_embed import create_welcome_embed, WelcomeLanguageView
11+
from embeds.welcome import create_welcome_embed, WelcomeLanguageView
1212
from utils.command_ids import command_id_manager
1313
from utils.msg_process import message_process
1414

commands/admin_commands/announce.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from dotenv import load_dotenv
55
from utils.server_config import get_announce_channel
66
from utils.translator import TranslationManager, SUPPORTED_LANGUAGES, load_translations
7-
from embeds.announcement_embed import create_announcement_embed, AnnouncementTranslationView
8-
from embeds.announcement_confirmation_embed import ConfirmationView, create_announcement_confirmation_embed
7+
from embeds.announce import create_announcement_embed, AnnouncementTranslationView
8+
from embeds.announce_confirm import AnnounceConfirmView, create_announcement_confirmation_embed
99
from utils.command_ids import command_id_manager
1010
from utils.config import logger_name
1111
import os
@@ -53,9 +53,9 @@ async def on_submit(self, interaction: discord.Interaction):
5353
translation_manager = TranslationManager(message, file_path)
5454

5555
await translation_manager.generate_all_translations(interaction)
56-
57-
confirmation_view = ConfirmationView(message, file_path, translation_manager, len(self.bot.guilds))
58-
56+
57+
confirmation_view = AnnounceConfirmView(message, file_path, translation_manager, len(self.bot.guilds))
58+
5959
# Créer l'embed de confirmation avec aperçu
6060
embed = discord.Embed(
6161
title="🔍 Traductions générées - Confirmation requise",

0 commit comments

Comments
 (0)