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:
|
agent:
|
||||||
character : hendrik # Directory name in agent/characters/<character>/
|
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)
|
max_tool_output : 0 # character(s) - 0 for unlimited (Connected to AGENT_MAX_TOOL_OUTPUT but Dead Config)
|
||||||
|
|
||||||
user:
|
user:
|
||||||
id: # Fill your user UUID here
|
id: # Fill your user UUID here, empty = TUI/MUC guest
|
||||||
|
|
||||||
moop:
|
|
||||||
db_path: "~/.config/hendrik/moop.sqlite3" # optional; Model Option database
|
|
||||||
|
|
||||||
llm:
|
llm:
|
||||||
timeout: 3000 # second
|
timeout: 3000 # second
|
||||||
# Model/provider/API key kini dikelola via Model Option (moop) — database sqlite.
|
|
||||||
# Atur melalui TUI: Model > Manage Providers & Manage Sets.
|
|
||||||
|
|
||||||
imagegen:
|
moop: # Model Option
|
||||||
# Image generation kini dikelola via Model Option (moop), tipe 'imagegen'.
|
db_path: "~/.config/hendrik/moop.sqlite3"
|
||||||
|
|
||||||
ragroleplay:
|
ragroleplay: # Use nomic-embed-text as default
|
||||||
db_path : "~/.config/hendrik/ragroleplay"
|
db_path : "~/.config/hendrik/ragroleplay"
|
||||||
vector_size : 768 # used on table create only
|
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:
|
session:
|
||||||
db_path: "~/.config/hendrik/sessions.json"
|
db_path: "~/.config/hendrik/sessions.json"
|
||||||
@ -33,14 +26,19 @@ xmpp:
|
|||||||
enabled: false
|
enabled: false
|
||||||
username: ""
|
username: ""
|
||||||
password: ""
|
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)
|
nickname: "" # custom MUC nickname (empty = use username)
|
||||||
selective_response: true # true = only response if mentioned/relevant
|
selective_response: true # true = only response if mentioned/relevant
|
||||||
|
debug: false # true = tampilkan log debug menyeluruh (semua stanza XML, lifecycle, dll)
|
||||||
|
|
||||||
telegram:
|
telegram:
|
||||||
enabled: false
|
enabled: false
|
||||||
token: ""
|
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
|
selective_response: true # true = only response if mentioned/relevant
|
||||||
|
|
||||||
delay: # Humanize Delay (anti-bot detection)
|
delay: # Humanize Delay (anti-bot detection)
|
||||||
@ -48,4 +46,3 @@ delay: # Humanize Delay (anti-bot detection)
|
|||||||
read_max : 2.0 # second
|
read_max : 2.0 # second
|
||||||
typing_speed : 15.0 # character(s) per second
|
typing_speed : 15.0 # character(s) per second
|
||||||
typing_max : 10.0 # max typing delay limit 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 default
|
||||||
return current if current is not None else 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)
|
TUI_USER_ID = _yaml_get("user", "id", default=None)
|
||||||
|
|
||||||
ragroleplay_db_path = _yaml_get("ragroleplay", "db_path", default="./.ragroleplay" )
|
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 ──────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
XMPP_ENABLED = str(_yaml_get("xmpp", "enabled", default="false")).strip().lower() in ("true", "1", "yes")
|
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_NICKNAME = _yaml_get("xmpp", "nickname", default="").strip()
|
||||||
XMPP_DEBUG = str(_yaml_get("xmpp", "debug", default="false")).strip().lower() in ("true", "1", "yes")
|
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")
|
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_ENABLED = str(_yaml_get("telegram", "enabled", default="false")).strip().lower() in ("true", "1", "yes")
|
||||||
TELEGRAM_TOKEN = _yaml_get("telegram", "token", default="")
|
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")
|
TELEGRAM_SELECTIVE_RESPONSE = str(_yaml_get("telegram", "selective_response", default="true")).strip().lower() in ("true", "1", "yes")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -115,9 +115,7 @@ def main():
|
|||||||
services = []
|
services = []
|
||||||
|
|
||||||
if config.XMPP_ENABLED:
|
if config.XMPP_ENABLED:
|
||||||
muc_rooms = []
|
muc_rooms = list(config.XMPP_MUC_ROOMS)
|
||||||
if config.XMPP_MUC_ROOMS.strip():
|
|
||||||
muc_rooms = [r.strip() for r in config.XMPP_MUC_ROOMS.split(',') if r.strip()]
|
|
||||||
client = XMPPClient(
|
client = XMPPClient(
|
||||||
jid = config.XMPP_USERNAME,
|
jid = config.XMPP_USERNAME,
|
||||||
password = config.XMPP_PASSWORD,
|
password = config.XMPP_PASSWORD,
|
||||||
@ -132,9 +130,7 @@ def main():
|
|||||||
services.append(client)
|
services.append(client)
|
||||||
|
|
||||||
if config.TELEGRAM_ENABLED:
|
if config.TELEGRAM_ENABLED:
|
||||||
allowed_ids = []
|
allowed_ids = list(config.TELEGRAM_ALLOWED_GROUP_IDS)
|
||||||
if config.TELEGRAM_ALLOWED_GROUP_IDS.strip():
|
|
||||||
allowed_ids = [r.strip() for r in config.TELEGRAM_ALLOWED_GROUP_IDS.split(',') if r.strip()]
|
|
||||||
|
|
||||||
tg = TelegramClient(
|
tg = TelegramClient(
|
||||||
token = config.TELEGRAM_TOKEN,
|
token = config.TELEGRAM_TOKEN,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user