Fix default model to llama3.1:latest
This commit is contained in:
14
app.py
14
app.py
@@ -49,7 +49,7 @@ OLLAMA_BASE = "http://localhost:11434"
|
|||||||
SEARXNG_BASE = "http://localhost:8888"
|
SEARXNG_BASE = "http://localhost:8888"
|
||||||
BASE_DIR = Path(__file__).parent
|
BASE_DIR = Path(__file__).parent
|
||||||
DB_PATH = BASE_DIR / "jarvischat.db"
|
DB_PATH = BASE_DIR / "jarvischat.db"
|
||||||
DEFAULT_MODEL = "deepseek-coder:6.7b"
|
DEFAULT_MODEL = "llama3.1:latest"
|
||||||
|
|
||||||
# --- Templates and Static Files ---
|
# --- Templates and Static Files ---
|
||||||
templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
|
templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
|
||||||
@@ -141,7 +141,7 @@ DEFAULT_PRESETS = [
|
|||||||
def init_db():
|
def init_db():
|
||||||
conn = sqlite3.connect(DB_PATH)
|
conn = sqlite3.connect(DB_PATH)
|
||||||
conn.row_factory = sqlite3.Row
|
conn.row_factory = sqlite3.Row
|
||||||
|
|
||||||
conn.execute("""
|
conn.execute("""
|
||||||
CREATE TABLE IF NOT EXISTS conversations (
|
CREATE TABLE IF NOT EXISTS conversations (
|
||||||
id TEXT PRIMARY KEY,
|
id TEXT PRIMARY KEY,
|
||||||
@@ -183,7 +183,7 @@ def init_db():
|
|||||||
value TEXT NOT NULL
|
value TEXT NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# FTS5 Memory table
|
# FTS5 Memory table
|
||||||
conn.execute("""
|
conn.execute("""
|
||||||
CREATE VIRTUAL TABLE IF NOT EXISTS memories USING fts5(
|
CREATE VIRTUAL TABLE IF NOT EXISTS memories USING fts5(
|
||||||
@@ -343,7 +343,7 @@ def process_remember_command(user_message: str) -> Optional[str]:
|
|||||||
topic = detect_topic(fact)
|
topic = detect_topic(fact)
|
||||||
add_memory(fact, topic=topic, source=source)
|
add_memory(fact, topic=topic, source=source)
|
||||||
return f"✓ Remembered [{topic}]: {fact}"
|
return f"✓ Remembered [{topic}]: {fact}"
|
||||||
|
|
||||||
for pattern in FORGET_PATTERNS:
|
for pattern in FORGET_PATTERNS:
|
||||||
match = re.search(pattern, user_message, re.IGNORECASE)
|
match = re.search(pattern, user_message, re.IGNORECASE)
|
||||||
if match:
|
if match:
|
||||||
@@ -377,7 +377,7 @@ async def query_searxng(query: str, max_results: int = 5) -> list[dict]:
|
|||||||
return [{"title": "Current Weather", "url": f"https://wttr.in/{location}", "content": resp.text.strip()}]
|
return [{"title": "Current Weather", "url": f"https://wttr.in/{location}", "content": resp.text.strip()}]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning(f"wttr.in error: {e}")
|
log.warning(f"wttr.in error: {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = await client.get(f"{SEARXNG_BASE}/search", params={"q": query, "format": "json", "categories": "general"}, timeout=10.0)
|
resp = await client.get(f"{SEARXNG_BASE}/search", params={"q": query, "format": "json", "categories": "general"}, timeout=10.0)
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
@@ -746,7 +746,7 @@ def build_system_prompt(db, extra_prompt="", user_message=""):
|
|||||||
"""Build the full system prompt: profile + memories + preset."""
|
"""Build the full system prompt: profile + memories + preset."""
|
||||||
parts = []
|
parts = []
|
||||||
settings = {row["key"]: row["value"] for row in db.execute("SELECT key, value FROM settings").fetchall()}
|
settings = {row["key"]: row["value"] for row in db.execute("SELECT key, value FROM settings").fetchall()}
|
||||||
|
|
||||||
if settings.get("profile_enabled", "true") == "true":
|
if settings.get("profile_enabled", "true") == "true":
|
||||||
profile = db.execute("SELECT content FROM profile WHERE id = 1").fetchone()
|
profile = db.execute("SELECT content FROM profile WHERE id = 1").fetchone()
|
||||||
if profile and profile["content"].strip():
|
if profile and profile["content"].strip():
|
||||||
@@ -916,4 +916,4 @@ async def chat(request: Request):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import uvicorn
|
import uvicorn
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8080)
|
uvicorn.run(app, host="0.0.0.0", port=8080)
|
||||||
|
|||||||
Reference in New Issue
Block a user