Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 22 additions & 24 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,28 @@
# - 0.4 to 0.7: Balanced, conversational (Good for general writing)
# - 0.8 to 1.0: Highly creative, unpredictable (Good for brainstorming)
TEMPERATURES = {
# The global fallback used if a script doesn't have a specific setting.
"default": 0.2,
"default": 0.2, # The global fallback

# Specific script overrides.
# Replace 'None' with a float to override the default.
"insights": None, # generate_insights.py
"briefing": None, # morning_briefing.py
"recap": None, # study_recap.py
"txt": None, # txt_to_notes.py
# Replace 'None' with a float (0.0-1.0) to override.
"insights": None,
"briefing": None,
"recap": None,
"txt": None,
}

# -------------------------------------------------------------
# API Configuration
# -------------------------------------------------------------
OLLAMA_API_URL = "http://localhost:11434/api/generate" # Ollama API endpoint

TIMEOUT = 1000 # Max seconds to wait for a response per call.
# Increase for slow hardware or large prompts. Default: 1000

KEEP_ALIVE = "10m" # How long Ollama keeps the model loaded after last request.
# Format: "5m", "1h", "0" (unload immediately). Default: "10m"

NUM_CTX = 8192 # Context window size in tokens.
# Higher = more notes fit in prompt but uses more RAM.
# Recommended: 4096 (fast) to 16384 (large vaults). Default: 8192

# -------------------------------------------------------------
# Vault Configuration
# -------------------------------------------------------------
VAULT_PATH = "~/Obsidian" # Path to your Obsidian vault. Supports ~ for home directory.
VAULT_PATH = "~/Obsidian" # Path to your Obsidian vault.

# -------------------------------------------------------------
# Script Behaviour
# -------------------------------------------------------------
DAYS_BACK = 7
HOURS_BACK = 24
MAX_NOTE_CHARS = 2000
MAX_FILE_SIZE = 1_000_000
DAYS_BACK = 7 # generate_insights.py: how many days back to collect notes.
# 7 = weekly report, 30 = monthly report.

Expand All @@ -64,6 +52,7 @@
# "Archive",
]


#--------------------------------------------------------------
# Tagging System (generate_insights.py)
#--------------------------------------------------------------
Expand Down Expand Up @@ -93,4 +82,13 @@
RECAP_TITLE_FORMAT = "{date} ({time}) Study Recap — {subject}.md"

# Placeholders: {title}
TXT_TITLE_FORMAT = "{title}.md"
TXT_TITLE_FORMAT = "{title}.md"


# -------------------------------------------------------------
# API Configuration
# -------------------------------------------------------------
OLLAMA_API_URL = "http://localhost:11434/api/generate"
TIMEOUT = 1000
KEEP_ALIVE = "10m"
NUM_CTX = 8192
17 changes: 14 additions & 3 deletions generate_insights.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import sys
import json
import re
import datetime
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor, as_completed
Expand All @@ -36,10 +37,14 @@
with PROMPTS_PATH.open(encoding="utf-8") as f:
PROMPTS = json.load(f)

TEMP_INSIGHTS = TEMPERATURES.get("insights")

GROUNDING = PROMPTS["grounding"]
LENSES = PROMPTS["insights"]["lenses"]

TEMP_INSIGHTS = TEMPERATURES.get("insights")
def format_obsidian_tag(text: str) -> str:
text = text.lower().replace(" ", "-")
return re.sub(r'[^a-z0-9_-]', '', text)

def fill_prompt(template: str, **kwargs) -> str:
"""
Expand Down Expand Up @@ -245,7 +250,13 @@ def extract_tags(lens_results: list[dict], synthesis: str) -> list[str]:
if any(kw in text for kw in keywords):
base_tags.append(tag)

return base_tags[:6]
final_tags = []
for tag in base_tags:
cleaned = format_obsidian_tag(tag)
if cleaned:
final_tags.append(cleaned)

return final_tags[:6]


# --- OUTPUT ---
Expand Down Expand Up @@ -273,7 +284,7 @@ def write_insight_note(lens_results: list[dict], synthesis: str, note_count: int

fm_lines = [
"---",
f"creation date: + {date_str}",
f"creation date: {date_str}",
"tags:"
] + [f" - {t}" for t in tags] + [
time_property,
Expand Down
2 changes: 2 additions & 0 deletions morning_briefing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
PROMPTS_PATH = SCRIPT_DIR / "prompts.json"
with PROMPTS_PATH.open(encoding="utf-8") as f:
PROMPTS = json.load(f)

TEMP_BRIEFING = TEMPERATURES.get("briefing")

GROUNDING = PROMPTS["grounding"]

Expand Down
2 changes: 2 additions & 0 deletions study_recap.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
with PROMPTS_PATH.open(encoding="utf-8") as f:
PROMPTS = json.load(f)

TEMP_RECAP = TEMPERATURES.get("recap")

GROUNDING = PROMPTS["grounding"]

TEMP_RECAP = TEMPERATURES.get("recap")
Expand Down
5 changes: 3 additions & 2 deletions txt_to_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
with PROMPTS_PATH.open(encoding="utf-8") as f:
PROMPTS = json.load(f)


TEMP_TXT = TEMPERATURES.get("txt")

GROUNDING = PROMPTS["grounding"]

R = "\033[0m"
Expand All @@ -48,8 +51,6 @@
GREEN = "\033[32m"
RED = "\033[31m"

TEMP_TXT = TEMPERATURES.get("txt")

def format_obsidian_tag(text: str) -> str:
text = text.lower().replace(" ", "-")
return re.sub(r'[^a-z0-9_-]', '', text)
Expand Down
Loading