mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Restructure: promote working_copy to repo root
Make the stable 'working copy' bot the canonical code at the repository
root so the install/deploy scripts operate against it again.
- Move working_copy/* to root (bot entrypoint is bot.py)
- Restore root-level install/ops scripts from c4fa88e (deploy.sh,
install_main_bot.sh, status_report.*, conjurer.service, etc.)
- Fix deploy.sh: copy bot.py (was thin_client.py) and add the
conanjurer_* modules; bump command count
- Remove side-by-side variant dirs (backup_old_docker, prototype_one,
prototype_musician_one, musician_old, working_copy) and docker cruft
- Keep components as subdirs: conjurer_librarian, conjurer_musician,
spotify_dl, yt_dlp, fonts, utils, docs
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+155
@@ -0,0 +1,155 @@
|
||||
import json
|
||||
import netrc
|
||||
from datetime import datetime
|
||||
from platform import uname
|
||||
from sys import platform
|
||||
from typing import List, Optional, TypedDict
|
||||
|
||||
import openai
|
||||
import spotipy
|
||||
from spotipy.oauth2 import SpotifyClientCredentials
|
||||
|
||||
Music_Config = TypedDict(
|
||||
"Music_Config",
|
||||
{
|
||||
"ctx": Optional[str],
|
||||
"queue": List[str],
|
||||
"requester": List[str],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
# *=========================================== Predefines
|
||||
MASTER_TIMEOUT = datetime.now()
|
||||
INITIAL_TIME_WAIT = 500
|
||||
MUZYKA: Music_Config = {"ctx": None, "queue": [], "requester": []}
|
||||
|
||||
LOGFILE = ""
|
||||
NETRC_FILE = ""
|
||||
MUSIC_FOLDER = ""
|
||||
MEMORY_FIVE_SIARA = ""
|
||||
MEMORY_FIVE_MUZYKA = ""
|
||||
SETTINGS_FILE = ""
|
||||
ENCODING = ""
|
||||
GRAPHICS_PATH = ""
|
||||
MUZYKA_MOJEGO_LUDU_HISTORIA = 1500
|
||||
MUZYKA_MOJEGO_LUDU_SLOWA_KLUCZOWE = 15
|
||||
MUZYKA_MOJEGO_LUDU_PLAJLISTA = 30
|
||||
|
||||
FILE_SERVICE_ADDRESS = "http://192.168.1.15:5000"
|
||||
RADIO_HARBOR_ADDRESS = "http://192.168.1.15:54321"
|
||||
SKIP_TRACK = "/skip"
|
||||
|
||||
GET_MP3 = "/mp3"
|
||||
SEND_MP3 = "/update_mp3"
|
||||
GET_PLAYLIST = "/get_music"
|
||||
ADD_TO_PRIO_PLAYLIST = "/add_to_priority"
|
||||
CREATE_PRIO_PLAYLIST = "/create_priority_playlist"
|
||||
|
||||
REQUEST_MUSIC = "/request_radio_file"
|
||||
CLEAR_PRIO = "/clear_pr_pls"
|
||||
LIBRARIAN_SERVICE_ADDRESS = "http://192.168.1.192:5001"
|
||||
SEND_QUERY = "/query"
|
||||
TIME_BETWEEN_CALLS = 100000
|
||||
LAST_SPONTANEOUS_CALL = datetime.now()
|
||||
HOST_ADDRESS = "192.168.1.191"
|
||||
PORT_ADDRESS = 5000
|
||||
|
||||
# *=========================================== Platform Specific Predefines
|
||||
|
||||
if platform in ("linux", "linux2"):
|
||||
SEPARATOR_FILE_PATH = "/"
|
||||
if "microsoft-standard" in uname().release:
|
||||
LOGFILE = "/home/mtuszowski/conjurer/discord.log"
|
||||
MEMORY_FIVE_SIARA = "/home/mtuszowski/conjurer/pamiec.json"
|
||||
SYSTEM_GPT_SETTINGS = "/home/mtuszowski/conjurer/system_gpt_settings.json"
|
||||
MEMORY_FIVE_MUZYKA = "/home/mtuszowski/conjurer/pamiec_muzyki.json"
|
||||
MUSIC_FOLDER = "/mnt/g/Muzyka/"
|
||||
SETTINGS_FILE = "/home/mtuszowski/conjurer/settings.json"
|
||||
NETRC_FILE = "/home/mtuszowski/.netrc"
|
||||
LOGSTORE = "/home/mtuszowski/conjurer/logs/"
|
||||
ACCIDENT_LOG = "/home/mtuszowski/conjurer/accident_log.json"
|
||||
ENCODING = "utf-8"
|
||||
GRAPHICS_PATH = "/home/mtuszowski/conjurer/Conjurer_graphics/"
|
||||
DIR_PATH_SADOX = "/mnt/c/Users/mtusz/OneDrive/Dokumenty/Fansadox"
|
||||
|
||||
else:
|
||||
LOGFILE = "/home/pi/Conjurer/discord.log"
|
||||
MEMORY_FIVE_SIARA = "/home/pi/Conjurer/pamiec.json"
|
||||
SYSTEM_GPT_SETTINGS = "/home/pi/Conjurer/system_gpt_settings.json"
|
||||
MEMORY_FIVE_MUZYKA = "/home/pi/Conjurer/pamiec_muzyki.json"
|
||||
MUSIC_FOLDER = "/home/pi/MediaShare/mp3/"
|
||||
SETTINGS_FILE = "/home/pi/Conjurer/settings.json"
|
||||
NETRC_FILE = "/home/pi/.netrc"
|
||||
LOGSTORE = "/home/pi/MediaShara/logs/"
|
||||
ACCIDENT_LOG = "/home/pi/Conjurer/accident_log.json"
|
||||
ENCODING = "utf-8"
|
||||
GRAPHICS_PATH = "/home/pi/MediaShare/Conjurer_graphics/"
|
||||
DIR_PATH_SADOX = "/home/pi/MediaShare/Fansadox/"
|
||||
|
||||
|
||||
elif platform == "win32":
|
||||
LOGFILE = "discord.log"
|
||||
MEMORY_FIVE_SIARA = "pamiec.json"
|
||||
SYSTEM_GPT_SETTINGS = "system_gpt_settings.json"
|
||||
MEMORY_FIVE_MUZYKA = "pamiec_muzyki.json"
|
||||
MUSIC_FOLDER = "G:\\Muzyka\\"
|
||||
SETTINGS_FILE = "settings.json"
|
||||
NETRC_FILE = "C:\\Users\\mtusz\\.netrc"
|
||||
LOGSTORE = "C:\\Users\\mtusz\\OneDrive\\Pulpit\\Conjurer\\logs\\"
|
||||
ACCIDENT_LOG = "accident_log.json"
|
||||
ENCODING = "utf-8"
|
||||
DIR_PATH_SADOX = "C:\\Users\\mtusz\\OneDrive\\Dokumenty\\Fansadox\\"
|
||||
SEPARATOR_FILE_PATH = "\\"
|
||||
with open(SETTINGS_FILE, "r", encoding=ENCODING) as f_settings_file:
|
||||
DATA = json.load(f_settings_file)
|
||||
REMOTE_HOST_NAME = "openai"
|
||||
netrc_mod = netrc.netrc(NETRC_FILE)
|
||||
authTokens = netrc_mod.authenticators(REMOTE_HOST_NAME)
|
||||
openai.api_key = authTokens[2]
|
||||
OPENAICLIENT = openai.AsyncOpenAI(api_key=openai.api_key)
|
||||
REMOTE_HOST_NAME = "discord"
|
||||
authTokens = netrc_mod.authenticators(REMOTE_HOST_NAME)
|
||||
TOKEN = authTokens[2]
|
||||
|
||||
REMOTE_HOST_NAME = "spotipy"
|
||||
authTokens = netrc_mod.authenticators(REMOTE_HOST_NAME)
|
||||
SPOTIFY_CTRL = spotipy.Spotify(
|
||||
client_credentials_manager=SpotifyClientCredentials(
|
||||
client_id=authTokens[0],
|
||||
client_secret=authTokens[2],
|
||||
)
|
||||
)
|
||||
REMOTE_HOST_NAME = "youtube"
|
||||
authTokens = netrc_mod.authenticators(REMOTE_HOST_NAME)
|
||||
YOUTUBE_AUTH = [authTokens[0],authTokens[2]]
|
||||
|
||||
WORD_REACTIONS = DATA["word_reactions"]
|
||||
CYCLIC_WORDS = DATA["cyclic_words"]
|
||||
for key in WORD_REACTIONS:
|
||||
WORD_REACTIONS[key][2] = datetime.now()
|
||||
with open(MEMORY_FIVE_SIARA, "r+", encoding=ENCODING) as temp_memory_file:
|
||||
# First we load existing data into a dict.
|
||||
MESSAGE_TABLE = json.load(temp_memory_file)
|
||||
|
||||
with open(SYSTEM_GPT_SETTINGS, "r+", encoding=ENCODING) as temp_settings_file:
|
||||
# First we load existing data into a dict.
|
||||
GPT_SETTINGS = json.load(temp_settings_file)
|
||||
with open(MEMORY_FIVE_MUZYKA, "r+", encoding=ENCODING) as temp_music_memory_file:
|
||||
# First we load existing data into a dict.
|
||||
MESSAGE_TABLE_MUZYKA = json.load(temp_music_memory_file)
|
||||
SPECJALNE_ZIEMNIACZKI = GPT_SETTINGS[1]
|
||||
ASSISTANTS = {}
|
||||
|
||||
|
||||
LATEX_TEX_ENGINE = "tectonic"
|
||||
LATEX_MAX_COMPILE_SECONDS = 45
|
||||
LATEX_MAX_ATTACH_MB = 8
|
||||
LATEX_MAX_ZIP_MB = 25
|
||||
|
||||
OPENAI_MODEL = "gpt-4o-mini"
|
||||
|
||||
ALLOWED_ROLES = ["Nocna Zmiana", "Jarl", "Thane", "Bartender"]
|
||||
GUILD_ID = 664789470779932693
|
||||
LATEST_MODEL = "gpt-4o" # najnowszy/do rozmów (możesz zmienić w jednym miejscu)
|
||||
CHEAP_MODEL = "gpt-4o-mini" # najtańszy (fallback do 3.5 niżej)
|
||||
Reference in New Issue
Block a user