Pakai YAML list ketimbang comma separator
This commit is contained in:
parent
7480f7ff84
commit
496c828429
@ -1,4 +1,4 @@
|
||||
# Copy and edit to `config.yaml`
|
||||
# Copy and edit this file to `config.yaml`
|
||||
|
||||
agent:
|
||||
character : hendrik # Directory name in agent/characters/<character>/
|
||||
@ -7,24 +7,17 @@ agent:
|
||||
max_tool_output : 0 # character(s) - 0 for unlimited (Connected to AGENT_MAX_TOOL_OUTPUT but Dead Config)
|
||||
|
||||
user:
|
||||
id: # Fill your user UUID here
|
||||
|
||||
moop:
|
||||
db_path: "~/.config/hendrik/moop.sqlite3" # optional; Model Option database
|
||||
id: # Fill your user UUID here, empty = TUI/MUC guest
|
||||
|
||||
llm:
|
||||
timeout: 3000 # second
|
||||
# Model/provider/API key kini dikelola via Model Option (moop) — database sqlite.
|
||||
# Atur melalui TUI: Model > Manage Providers & Manage Sets.
|
||||
|
||||
imagegen:
|
||||
# Image generation kini dikelola via Model Option (moop), tipe 'imagegen'.
|
||||
moop: # Model Option
|
||||
db_path: "~/.config/hendrik/moop.sqlite3"
|
||||
|
||||
ragroleplay:
|
||||
ragroleplay: # Use nomic-embed-text as default
|
||||
db_path : "~/.config/hendrik/ragroleplay"
|
||||
vector_size : 768 # used on table create only
|
||||
model_url : "http://localhost:11434/api/embed"
|
||||
model_name : "nomic-embed-text" # fallback jika default chain 'embedding' belum diatur
|
||||
|
||||
session:
|
||||
db_path: "~/.config/hendrik/sessions.json"
|
||||
@ -33,14 +26,19 @@ xmpp:
|
||||
enabled: false
|
||||
username: ""
|
||||
password: ""
|
||||
muc_rooms: "" # comma-separated, e.g. "room1@conference.server,room2@conference.server"
|
||||
muc_rooms: # YAML list, e.g.:
|
||||
# - "room1@conference.server"
|
||||
# - "room2@conference.server"
|
||||
nickname: "" # custom MUC nickname (empty = use username)
|
||||
selective_response: true # true = only response if mentioned/relevant
|
||||
debug: false # true = tampilkan log debug menyeluruh (semua stanza XML, lifecycle, dll)
|
||||
|
||||
telegram:
|
||||
enabled: false
|
||||
token: ""
|
||||
allowed_group_ids: "" # comma-separated, empty = all group
|
||||
allowed_group_ids: # YAML list, empty = all group. e.g.:
|
||||
# - "123456789"
|
||||
# - "987654321"
|
||||
selective_response: true # true = only response if mentioned/relevant
|
||||
|
||||
delay: # Humanize Delay (anti-bot detection)
|
||||
@ -48,4 +46,3 @@ delay: # Humanize Delay (anti-bot detection)
|
||||
read_max : 2.0 # second
|
||||
typing_speed : 15.0 # character(s) per second
|
||||
typing_max : 10.0 # max typing delay limit per second
|
||||
|
||||
11
config.py
11
config.py
@ -19,6 +19,13 @@ def _yaml_get(*keys, default=None):
|
||||
return default
|
||||
return current if current is not None else default
|
||||
|
||||
def _as_list(value):
|
||||
if isinstance(value, list):
|
||||
return [str(v).strip() for v in value if str(v).strip()]
|
||||
if value:
|
||||
print(f"[config] Warning: '{value}' bukan YAML list, diabaikan. Gunakan format list.", flush=True)
|
||||
return []
|
||||
|
||||
TUI_USER_ID = _yaml_get("user", "id", default=None)
|
||||
|
||||
ragroleplay_db_path = _yaml_get("ragroleplay", "db_path", default="./.ragroleplay" )
|
||||
@ -62,7 +69,7 @@ AGENT_SKILLS = _yaml_get("agent", "skills", default="").strip().lower()
|
||||
# ─── XMPP ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
XMPP_ENABLED = str(_yaml_get("xmpp", "enabled", default="false")).strip().lower() in ("true", "1", "yes")
|
||||
XMPP_MUC_ROOMS = _yaml_get("xmpp", "muc_rooms", default="").strip()
|
||||
XMPP_MUC_ROOMS = _as_list(_yaml_get("xmpp", "muc_rooms", default=[]))
|
||||
XMPP_NICKNAME = _yaml_get("xmpp", "nickname", default="").strip()
|
||||
XMPP_DEBUG = str(_yaml_get("xmpp", "debug", default="false")).strip().lower() in ("true", "1", "yes")
|
||||
XMPP_SELECTIVE_RESPONSE = str(_yaml_get("xmpp", "selective_response", default="true")).strip().lower() in ("true", "1", "yes")
|
||||
@ -72,7 +79,7 @@ XMPP_SELECTIVE_RESPONSE = str(_yaml_get("xmpp", "selective_response", default="t
|
||||
|
||||
TELEGRAM_ENABLED = str(_yaml_get("telegram", "enabled", default="false")).strip().lower() in ("true", "1", "yes")
|
||||
TELEGRAM_TOKEN = _yaml_get("telegram", "token", default="")
|
||||
TELEGRAM_ALLOWED_GROUP_IDS = _yaml_get("telegram", "allowed_group_ids", default="").strip()
|
||||
TELEGRAM_ALLOWED_GROUP_IDS = _as_list(_yaml_get("telegram", "allowed_group_ids", default=[]))
|
||||
TELEGRAM_SELECTIVE_RESPONSE = str(_yaml_get("telegram", "selective_response", default="true")).strip().lower() in ("true", "1", "yes")
|
||||
|
||||
|
||||
|
||||
@ -115,9 +115,7 @@ def main():
|
||||
services = []
|
||||
|
||||
if config.XMPP_ENABLED:
|
||||
muc_rooms = []
|
||||
if config.XMPP_MUC_ROOMS.strip():
|
||||
muc_rooms = [r.strip() for r in config.XMPP_MUC_ROOMS.split(',') if r.strip()]
|
||||
muc_rooms = list(config.XMPP_MUC_ROOMS)
|
||||
client = XMPPClient(
|
||||
jid = config.XMPP_USERNAME,
|
||||
password = config.XMPP_PASSWORD,
|
||||
@ -132,9 +130,7 @@ def main():
|
||||
services.append(client)
|
||||
|
||||
if config.TELEGRAM_ENABLED:
|
||||
allowed_ids = []
|
||||
if config.TELEGRAM_ALLOWED_GROUP_IDS.strip():
|
||||
allowed_ids = [r.strip() for r in config.TELEGRAM_ALLOWED_GROUP_IDS.split(',') if r.strip()]
|
||||
allowed_ids = list(config.TELEGRAM_ALLOWED_GROUP_IDS)
|
||||
|
||||
tg = TelegramClient(
|
||||
token = config.TELEGRAM_TOKEN,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user