feat: complete overhaul of AI subsystem with multi-agent litellm architecture
- Refactored AI module to use litellm, supporting Anthropic, Google, OpenAI, etc. - Introduced 'Engineer' (execution) and 'Architect' (strategic) AI agents. - Added real-time streaming responses and interactive chat mode via 'rich'. - Added CLI arguments for model/key overrides (--engineer-model, --architect-model). - Replaced 'openai' with 'litellm' in requirements.txt and setup.cfg. - Updated nodes.run() to support an 'on_complete' callback for live node-status streaming. - Fixed an undefined variable bug (config.profiles -> self.profiles) in configfile.py. - Updated README and docstrings with new AI plugin tool registration API. - Regenerated HTML documentation using pdoc3. - Bumped version to 5.0b1 for beta release.
This commit is contained in:
1 parent
b2c414485c
commit
257cb05cc1
12 files changed
+2646
-1353
No files matched your search
+18
-3
@@ -710,7 +710,7 @@ class nodes:
|
||||
|
||||
|
||||
@MethodHook
|
||||
def run(self, commands, vars = None,*, folder = None, prompt = None, stdout = None, parallel = 10, timeout = None):
|
||||
def run(self, commands, vars = None,*, folder = None, prompt = None, stdout = None, parallel = 10, timeout = None, on_complete = None):
|
||||
'''
|
||||
Run a command or list of commands on all the nodes in nodelist.
|
||||
|
||||
@@ -751,6 +751,11 @@ class nodes:
|
||||
- timeout (int): Time in seconds for expect to wait for prompt/EOF.
|
||||
default 10.
|
||||
|
||||
- on_complete (callable): Optional callback called when each node
|
||||
finishes. Receives (unique, output, status).
|
||||
Called from the node's thread so it must
|
||||
be thread-safe.
|
||||
|
||||
###Returns:
|
||||
|
||||
dict: Dictionary formed by nodes unique as keys, Output of the
|
||||
@@ -765,13 +770,20 @@ class nodes:
|
||||
Path(folder).mkdir(parents=True, exist_ok=True)
|
||||
if prompt != None:
|
||||
args["prompt"] = prompt
|
||||
if stdout != None:
|
||||
if stdout != None and on_complete is None:
|
||||
args["stdout"] = stdout
|
||||
if timeout != None:
|
||||
args["timeout"] = timeout
|
||||
output = {}
|
||||
status = {}
|
||||
tasks = []
|
||||
|
||||
def _run_node(node_obj, node_args, callback):
|
||||
"""Wrapper that runs a node and fires the callback on completion."""
|
||||
node_obj.run(**node_args)
|
||||
if callback:
|
||||
callback(node_obj.unique, node_obj.output, node_obj.status)
|
||||
|
||||
for n in self.nodelist:
|
||||
nodesargs[n.unique] = deepcopy(args)
|
||||
if vars != None:
|
||||
@@ -780,7 +792,10 @@ class nodes:
|
||||
nodesargs[n.unique]["vars"].update(vars["__global__"])
|
||||
if n.unique in vars.keys():
|
||||
nodesargs[n.unique]["vars"].update(vars[n.unique])
|
||||
tasks.append(threading.Thread(target=n.run, kwargs=nodesargs[n.unique]))
|
||||
if on_complete:
|
||||
tasks.append(threading.Thread(target=_run_node, args=(n, nodesargs[n.unique], on_complete)))
|
||||
else:
|
||||
tasks.append(threading.Thread(target=n.run, kwargs=nodesargs[n.unique]))
|
||||
taskslist = list(self._splitlist(tasks, parallel))
|
||||
for t in taskslist:
|
||||
for i in t:
|
||||
|
||||
Reference in new issue
Block a user