|
|
|
|
|
""" |
|
|
NovaForge Elizabeth Concise CLI - Optimized for direct responses |
|
|
""" |
|
|
|
|
|
import requests |
|
|
import json |
|
|
import sys |
|
|
import os |
|
|
from datetime import datetime |
|
|
import subprocess |
|
|
|
|
|
class ElizabethConciseCLI: |
|
|
def __init__(self): |
|
|
self.api_url = "http://localhost:8000" |
|
|
self.api_key = "elizabeth-secret-key-2025" |
|
|
self.model_name = "qwen3-8b-elizabeth" |
|
|
self.headers = { |
|
|
"Authorization": f"Bearer {self.api_key}", |
|
|
"Content-Type": "application/json" |
|
|
} |
|
|
|
|
|
def send_concise_message(self, message, max_tokens=150, temperature=0.3): |
|
|
"""Send message with concise prompt""" |
|
|
try: |
|
|
|
|
|
messages = [ |
|
|
{ |
|
|
"role": "system", |
|
|
"content": "You are Elizabeth, an efficient AI assistant. Respond with brief, direct answers. Avoid lengthy explanations unless specifically asked." |
|
|
}, |
|
|
{"role": "user", "content": message} |
|
|
] |
|
|
|
|
|
payload = { |
|
|
"model": self.model_name, |
|
|
"messages": messages, |
|
|
"max_tokens": max_tokens, |
|
|
"temperature": temperature, |
|
|
"stream": False, |
|
|
"top_p": 0.9, |
|
|
"frequency_penalty": 0.1, |
|
|
"presence_penalty": 0.1 |
|
|
} |
|
|
|
|
|
response = requests.post( |
|
|
f"{self.api_url}/v1/chat/completions", |
|
|
headers=self.headers, |
|
|
json=payload, |
|
|
timeout=30 |
|
|
) |
|
|
|
|
|
if response.status_code == 200: |
|
|
return response.json()['choices'][0]['message']['content'].strip() |
|
|
else: |
|
|
return f"β {response.status_code}" |
|
|
|
|
|
except Exception as e: |
|
|
return f"β {str(e)}" |
|
|
|
|
|
def display_banner(self): |
|
|
print("\n" + "="*60) |
|
|
print(f"π― Elizabeth CLI - {datetime.now().strftime('%H:%M:%S')}") |
|
|
print("π¬ Concise mode: brief, direct responses") |
|
|
print("β‘ Type 'exit' to quit") |
|
|
print("="*60) |
|
|
|
|
|
def run(self): |
|
|
try: |
|
|
self.display_banner() |
|
|
|
|
|
while True: |
|
|
try: |
|
|
prompt = input("β ").strip() |
|
|
|
|
|
if not prompt: |
|
|
continue |
|
|
|
|
|
if prompt.lower() == 'exit': |
|
|
print("π") |
|
|
break |
|
|
|
|
|
print("π‘ ", end="", flush=True) |
|
|
response = self.send_concise_message(prompt) |
|
|
print(response) |
|
|
|
|
|
except KeyboardInterrupt: |
|
|
print("\nπ") |
|
|
break |
|
|
|
|
|
except KeyboardInterrupt: |
|
|
print("\nπ") |
|
|
|
|
|
if __name__ == "__main__": |
|
|
cli = ElizabethConciseCLI() |
|
|
cli.run() |