File size: 1,685 Bytes
454a778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os

from vitalis import CognitiveLayer
from vitalis.config import KNOWLEDGE_DIR

SEED_FILE = KNOWLEDGE_DIR / "vitalis_core.md"
if not SEED_FILE.exists():
    KNOWLEDGE_DIR.mkdir(parents=True, exist_ok=True)
    SEED_FILE.write_text(
        "Vitalis Core is a bolt-on cognitive framework for synthetic intelligence.\n"
        "It provides memory, validation, sandboxing, and truth-checking for any model.\n"
        "Created by FerrellSyntheticIntelligence.\n"
    )


def model_stub(prompt: str) -> str:
    return (
        "Vitalis Core active. No external model bolted yet.\n"
        f"Received: {prompt[:120]}..."
    )


brain = CognitiveLayer(model=model_stub)

try:
    import gradio as gr

    def vitalis_chat(user_input, history):
        result = brain.process(user_input)
        response = result["response"]
        meta = (
            f"\n\n---\n"
            f"confidence={result['confidence']}, "
            f"truthful={result['truthful']}, "
            f"sandbox={result['sandbox_passed']}"
        )
        return response + meta

    demo = gr.ChatInterface(
        fn=vitalis_chat,
        title="Vitalis Core — Bolt-On Cognitive Framework",
        theme="soft",
    )
    demo.launch()

except ImportError:
    print("Gradio not installed. Running CLI mode.")
    print("Vitalis Core — Bolt-On Cognitive Framework")
    print("Type 'exit' to quit.")
    while True:
        user_input = input("> ")
        if user_input.lower() in ("exit", "quit"):
            break
        result = brain.process(user_input)
        print(result["response"])
        if not result["truthful"]:
            print(f"[truth issues: {result['truth_issues']}]")