fix: WAL mode for concurrent reads, skipped stats, anti-repetition prompts
Build & Deploy ResearchOwl / build-and-push (push) Successful in 5s

database.py: enable PRAGMA journal_mode=WAL + synchronous=NORMAL so
  /status reads from concurrent connections see committed data without
  blocking behind the scraper's writes; add 'skipped' to get_session_stats

bot.py: show skipped count in fmt_progress and cmd_status; use 'or 0'
  to guard against NULL from SUM(); label active research in /status

processor.py: raise generate() temperature default to 0.7 + add
  repeat_penalty=1.15/repeat_last_n=128 to Ollama options to stop
  qwen2.5:3b from looping; scoring prompt keeps temperature=0.1

generator.py: rewrite all prompts with explicit "NEVER repeat"
  constraints and distinct-content rules per section; podcast prompt
  now asks for spoken-word style (no formal headers); reduce thread
  to 12-18 tweets (was 15-25) to fit model context; pass temperature=0.7

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ChemaVX
2026-04-28 10:15:30 +00:00
parent f7d62345b8
commit c4fb33fbf5
4 changed files with 115 additions and 73 deletions
+8 -3
View File
@@ -25,12 +25,17 @@ class OllamaClient:
self.model = settings.ollama_model
async def generate(self, prompt: str, system: str = None,
timeout: int = 120) -> str:
timeout: int = 120, temperature: float = 0.7) -> str:
payload = {
"model": self.model,
"prompt": prompt,
"stream": False,
"options": {"temperature": 0.1, "num_predict": 512}
"options": {
"temperature": temperature,
"num_predict": 2048,
"repeat_penalty": 1.15,
"repeat_last_n": 128,
}
}
if system:
payload["system"] = system
@@ -219,7 +224,7 @@ class ContentProcessor:
f"Reply with ONLY a single integer 0-10. No explanation."
)
try:
response = await self.ollama.generate(prompt)
response = await self.ollama.generate(prompt, temperature=0.1)
numbers = re.findall(r'\b(\d+(?:\.\d+)?)\b', response)
if numbers:
score = float(numbers[0])