File size: 4,648 Bytes
73400c8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #!/usr/bin/env python3
import sys
import readline
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.shorekeeper import SHOREKEEPER
def print_banner():
print("""
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β βββββββββββ βββ βββββββ βββββββ βββββββββββ βββ β
β βββββββββββ βββββββββββββββββββββββββββββββ ββββ β
β βββββββββββββββββββ βββββββββββββββββ βββββββ β
β βββββββββββββββββββ βββββββββββββββββ βββββββ β
β βββββββββββ βββββββββββββββ ββββββββββββββ βββ β
β βββββββββββ βββ βββββββ βββ ββββββββββββββ βββ β
β β
β SHOREKEEPER-4B β
β The AI with 12 Specialized Experts β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Commands:
/remember <fact> - Store in memory
/recall <query> - Search memory
/run <command> - Execute in sandbox
/project <name> - Create project on 3TB drive
/exit - Goodbye
""")
def main():
print_banner()
print("Loading SHOREKEEPER-4B...")
model = SHOREKEEPER()
print("SHOREKEEPER is ready. Type /help for commands.\n")
while True:
try:
user_input = input("\nYou: ").strip()
if not user_input:
continue
if user_input == "/exit":
print("\nSHOREKEEPER: Until we meet again. The council will remember.")
break
elif user_input == "/help":
print("""
Commands:
/remember <fact> - Store something in memory
/recall <query> - Search memory
/run <command> - Run terminal command in sandbox
/project <name> - Create new project on 3TB drive
/exit - Quit
""")
elif user_input.startswith("/remember "):
fact = user_input[10:]
mem_id = model.remember(fact)
print(f"SHOREKEEPER: I will remember that. (ID: {mem_id})")
elif user_input.startswith("/recall "):
query = user_input[8:]
memories = model.recall(query)
if memories:
print("\nSHOREKEEPER: I found these memories:")
for mem in memories[:5]:
content = mem.get("content", {})
if isinstance(content, dict):
for k, v in content.items():
print(f" * {k}: {v}")
else:
print(f" * {content}")
else:
print("SHOREKEEPER: I don't remember anything matching that.")
elif user_input.startswith("/run "):
command = user_input[5:]
print(f"\nExecuting: {command}\n")
output = model.run_command(command)
print(output)
elif user_input.startswith("/project "):
name = user_input[9:]
project_path = model.create_project(name)
print(f"SHOREKEEPER: Created project {name} at {project_path}")
else:
response = model.chat(user_input)
print(f"\nSHOREKEEPER: {response}")
except KeyboardInterrupt:
print("\n\nSHOREKEEPER: Interrupted. Goodbye.")
break
except Exception as e:
print(f"\nError: {e}")
if __name__ == "__main__":
main()
|