Cleanup pelan-pelan
This commit is contained in:
parent
b6cecd686d
commit
44fca6c366
20
hendrik.py
20
hendrik.py
@ -1,4 +1,4 @@
|
|||||||
import os, sys, argparse, threading, time, signal
|
import os, sys, threading, time, signal
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
@ -11,6 +11,8 @@ from services.telegram_client import TelegramClient
|
|||||||
|
|
||||||
from interfaces.tui import HendrikTUI
|
from interfaces.tui import HendrikTUI
|
||||||
|
|
||||||
|
from modules import argsparser
|
||||||
|
|
||||||
tools_definition = [
|
tools_definition = [
|
||||||
# Coder Tools
|
# Coder Tools
|
||||||
gadget.tools_mapping( schema = coder.schema_read_file, handler = coder.read_file ),
|
gadget.tools_mapping( schema = coder.schema_read_file, handler = coder.read_file ),
|
||||||
@ -71,16 +73,12 @@ TOOLS = gadget.tool_schemas (tools_definition)
|
|||||||
TOOL_HANDLERS = gadget.tool_handlers (tools_definition)
|
TOOL_HANDLERS = gadget.tool_handlers (tools_definition)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Hendrik AI Agent")
|
|
||||||
parser.add_argument('--char', type=str, default=None, help='Character name (overrides config.yaml)')
|
|
||||||
parser.add_argument('-w', '--workspace', type=str, default=None, help='Working directory')
|
|
||||||
parser.add_argument('--tui', action='store_true', help='Force run in TUI mode')
|
|
||||||
parser.add_argument('--service', action='store_true', help='Force run in service mode')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
|
args = argsparser.args
|
||||||
|
# Override char configuration from args
|
||||||
if args.char:
|
if args.char:
|
||||||
config.load_service_config(char_override=args.char)
|
config.load_service_config(char_override=args.char)
|
||||||
|
# Set workspace from args
|
||||||
if args.workspace:
|
if args.workspace:
|
||||||
resolved = os.path.abspath(args.workspace)
|
resolved = os.path.abspath(args.workspace)
|
||||||
if not os.path.isdir(resolved):
|
if not os.path.isdir(resolved):
|
||||||
@ -88,7 +86,10 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
coder.set_current_workspace(resolved)
|
coder.set_current_workspace(resolved)
|
||||||
|
|
||||||
|
# Inference
|
||||||
llm_client = LLMClient("", "", "", config.llm_timeout)
|
llm_client = LLMClient("", "", "", config.llm_timeout)
|
||||||
|
|
||||||
|
# Pesan saat opsi model belum dipilih
|
||||||
if not moop.configure_client(llm_client):
|
if not moop.configure_client(llm_client):
|
||||||
if config.XMPP_ENABLED or config.TELEGRAM_ENABLED:
|
if config.XMPP_ENABLED or config.TELEGRAM_ENABLED:
|
||||||
print(
|
print(
|
||||||
@ -145,8 +146,7 @@ def main():
|
|||||||
return
|
return
|
||||||
|
|
||||||
if args.service:
|
if args.service:
|
||||||
# Force service mode by ensuring services list is populated if any are enabled in config
|
pass # Ya kocak sih, pakai --service dan ga pake --service jalannya ya sama-sama aja.
|
||||||
pass # Fall through to the services logic below
|
|
||||||
|
|
||||||
if services:
|
if services:
|
||||||
threads = []
|
threads = []
|
||||||
|
|||||||
8
modules/argsparser.py
Normal file
8
modules/argsparser.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import argparse
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description="Hendrik AI Agent")
|
||||||
|
parser.add_argument('--char', type=str, default=None, help='Character name (overrides config.yaml)')
|
||||||
|
parser.add_argument('-w', '--workspace', type=str, default=None, help='Working directory')
|
||||||
|
parser.add_argument('--tui', action='store_true', help='Force run in TUI mode')
|
||||||
|
parser.add_argument('--service', action='store_true', help='Force run in service mode')
|
||||||
|
args = parser.parse_args()
|
||||||
Loading…
Reference in New Issue
Block a user