Skip to content

A curated collection of practical AI projects implementing OCR systems, RAG, AI agents, and other AI use cases.

Fix code review comments: remove IDE/cache files, fix style.css path, pin dependencies, fix warmup toast, use st.html(), fix Ollama error handling, pin MCP server version

Tiioluwani320c825bee45
diff --git a/README.md b/README.md
index bfe45af..b9dbe5e 100644
--- a/README.md
+++ b/README.md
@@ -1,120 +1,3 @@
-
-# Eagle Eye
-
-AI-powered GitHub PR review agent using OpenClaw, MiniMax M2.7, and GitHub MCP. Triggered via Telegram.
-
-## Project Overview
-
-Eagle Eye is a Telegram-triggered code review assistant that analyses GitHub pull requests and delivers structured feedback directly to your Telegram chat. It uses MiniMax M2.7 as the reasoning model and the GitHub MCP server to fetch PR diffs and post reviews. Reviews cover security vulnerabilities, bugs, code quality, and best practices, with findings grouped by severity and an overall rating. Nothing is posted to GitHub without your explicit approval.
-
----
-
-## How It Works
-
-![Eagle Eye Architecture](docs/architecture.svg)
-
----
-
-## Prerequisites
-
-- **[OpenClaw](https://openclaw.dev)** installed and available in your PATH
-- **Telegram bot token**: create a bot via [@BotFather](https://t.me/BotFather) and note the token
-- **GitHub Personal Access Token (PAT)**: with `repo`, `pull_requests: write`, and `issues: write` permissions
-
----
-
-## Setup
-
-### 1. Run `openclaw onboard`
-
-```bash
-openclaw onboard
-```
-
-When prompted, select **MiniMax M2.7** as your model. OpenClaw will ask for your API key and store it securely in its auth profiles; no need to put it in `openclaw.json`.
-
-### 2. Configure `openclaw.json`
-
-Copy `openclaw.example.json` to `openclaw.json` and fill in your credentials:
-
-```json
-{
- "gateway": {
- "mode": "local",
- "auth": {
- "mode": "token",
- "token": "YOUR_OPENCLAW_GATEWAY_TOKEN"
- }
- },
- "channels": {
- "telegram": {
- "enabled": true,
- "botToken": "YOUR_TELEGRAM_BOT_TOKEN"
- }
- },
- "mcp": {
- "servers": {
- "github": {
- "command": "npx",
- "args": ["-y", "@modelcontextprotocol/server-github"],
- "env": {
- "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"
- }
- }
- }
- }
-}
-```
-
-### 3. Copy the project to your OpenClaw workspace
-
-**macOS / Linux:**
-```bash
-cp -r . ~/.openclaw/workspace/skills/eagle-eye/
-```
-
-**Windows:**
-```cmd
-xcopy . %USERPROFILE%\.openclaw\workspace\skills\eagle-eye\ /E /I
-```
-
-### 4. Start the OpenClaw gateway
-
-```bash
-openclaw gateway
-```
-
-The agent is now listening for messages on Telegram.
-
----
-
-## Usage
-
-Send any message containing a GitHub PR URL to your Telegram bot:
-
-```
-https://github.com/owner/repo/pull/42
-```
-
-Or inline with other text:
-
-```
-Please review this: https://github.com/owner/repo/pull/42
-```
-
-The agent fetches the PR, analyses the diff, and sends a structured review back to Telegram. It then asks whether you want to post the review to GitHub: reply **`post`** to post it as a GitHub comment, or **`no`** to discard it.
-
-You can also reply with edits or instructions (e.g. *"add a note about the missing tests"*) and the agent will revise the review and ask again.
-
----
-
-## Known Limitations
-
-- **No CI/CD context**: the agent cannot see test results, build logs, or coverage reports unless you paste them into the chat
-- **Large PRs**: for PRs with 200+ changed files, the review prioritises security and correctness findings and may not cover every file exhaustively
-- **No session memory**: the agent does not remember previous reviews between Telegram sessions; each conversation starts fresh
-- **Single reviewer identity**: the agent posts as whichever GitHub account owns the PAT; it cannot impersonate other reviewers
-=======
# **Hands-On AI Engineering** πŸš€
A curated repository of AI-powered applications and agentic systems showcasing practical use cases of Large Language Models (LLMs) from providers like Google, Anthropic, OpenAI, and self-hosted open-source models.
@@ -132,4 +15,3 @@ We welcome contributions! If you have an AI app, agent, or enhancement to share,
## **πŸ“œ License**
This repository is licensed under the **MIT License**. See the [LICENSE](./LICENSE) file for details.
-
diff --git a/glm-ocr-pro/.gitignore b/glm-ocr-pro/.gitignore
new file mode 100644
index 0000000..3cebe7d
--- /dev/null
+++ b/glm-ocr-pro/.gitignore
@@ -0,0 +1,4 @@
+.idea/
+*.iml
+__pycache__/
+*.pyc
\ No newline at end of file
diff --git a/glm-ocr-pro/.idea/.gitignore b/glm-ocr-pro/.idea/.gitignore
deleted file mode 100644
index ab1f416..0000000
--- a/glm-ocr-pro/.idea/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Ignored default folder with query files
-/queries/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
-# Editor-based HTTP Client requests
-/httpRequests/
diff --git a/glm-ocr-pro/.idea/glm-ocr-streamlit.iml b/glm-ocr-pro/.idea/glm-ocr-streamlit.iml
deleted file mode 100644
index 480a398..0000000
--- a/glm-ocr-pro/.idea/glm-ocr-streamlit.iml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
- <component name="NewModuleRootManager">
- <content url="file://$MODULE_DIR$">
- <excludeFolder url="file://$MODULE_DIR$/.venv" />
- </content>
- <orderEntry type="jdk" jdkName="Python 3.14 (glm-ocr-streamlit)" jdkType="Python SDK" />
- <orderEntry type="sourceFolder" forTests="false" />
- </component>
-</module>
\ No newline at end of file
diff --git a/glm-ocr-pro/.idea/inspectionProfiles/profiles_settings.xml b/glm-ocr-pro/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/glm-ocr-pro/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<component name="InspectionProjectProfileManager">
- <settings>
- <option name="USE_PROJECT_PROFILE" value="false" />
- <version value="1.0" />
- </settings>
-</component>
\ No newline at end of file
diff --git a/glm-ocr-pro/.idea/misc.xml b/glm-ocr-pro/.idea/misc.xml
deleted file mode 100644
index e69d5df..0000000
--- a/glm-ocr-pro/.idea/misc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="Black">
- <option name="sdkName" value="Python 3.14 (glm-ocr-streamlit)" />
- </component>
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.14 (glm-ocr-streamlit)" project-jdk-type="Python SDK" />
-</project>
\ No newline at end of file
diff --git a/glm-ocr-pro/.idea/modules.xml b/glm-ocr-pro/.idea/modules.xml
deleted file mode 100644
index 9050181..0000000
--- a/glm-ocr-pro/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ProjectModuleManager">
- <modules>
- <module fileurl="file://$PROJECT_DIR$/.idea/glm-ocr-streamlit.iml" filepath="$PROJECT_DIR$/.idea/glm-ocr-streamlit.iml" />
- </modules>
- </component>
-</project>
\ No newline at end of file
diff --git a/glm-ocr-pro/__pycache__/app.cpython-314.pyc b/glm-ocr-pro/__pycache__/app.cpython-314.pyc
deleted file mode 100644
index 64e0327..0000000
Binary files a/glm-ocr-pro/__pycache__/app.cpython-314.pyc and /dev/null differ
diff --git a/glm-ocr-pro/__pycache__/ocr_cloud.cpython-314.pyc b/glm-ocr-pro/__pycache__/ocr_cloud.cpython-314.pyc
deleted file mode 100644
index 60161f9..0000000
Binary files a/glm-ocr-pro/__pycache__/ocr_cloud.cpython-314.pyc and /dev/null differ
diff --git a/glm-ocr-pro/__pycache__/ocr_local.cpython-314.pyc b/glm-ocr-pro/__pycache__/ocr_local.cpython-314.pyc
deleted file mode 100644
index 06a9436..0000000
Binary files a/glm-ocr-pro/__pycache__/ocr_local.cpython-314.pyc and /dev/null differ
diff --git a/glm-ocr-pro/__pycache__/utils.cpython-314.pyc b/glm-ocr-pro/__pycache__/utils.cpython-314.pyc
deleted file mode 100644
index aa1e227..0000000
Binary files a/glm-ocr-pro/__pycache__/utils.cpython-314.pyc and /dev/null differ
diff --git a/glm-ocr-pro/app.py b/glm-ocr-pro/app.py
index 7209c40..15c173a 100644
--- a/glm-ocr-pro/app.py
+++ b/glm-ocr-pro/app.py
@@ -5,8 +5,10 @@ import os
from ocr_local import check_ollama_status, extract_markdown_local_stream, warmup_local_model
# Design System Injection
-if os.path.exists("style.css"):
- with open("style.css") as f:
+_here = os.path.dirname(os.path.abspath(__file__))
+_css_path = os.path.join(_here, "style.css")
+if os.path.exists(_css_path):
+ with open(_css_path) as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
def _looks_like_html_table(text: str) -> bool:
@@ -34,14 +36,20 @@ with col1:
with st.container(border=True):
st.subheader("βš™οΈ Settings")
- ok, status = check_ollama_status()
+ @st.cache_data(ttl=30)
+ def _cached_ollama_status():
+ return check_ollama_status()
+ ok, status = _cached_ollama_status()
status_color = "green" if ok else "red"
st.markdown(f"**Ollama Status:** <span style='color:{status_color}'>{'●' if ok else 'β—‹'} {status}</span>", unsafe_allow_html=True)
if st.button("Warm Up Model", use_container_width=True, type="primary"):
with st.spinner("Loading GLM-OCR weights..."):
- warmup_local_model()
- st.toast("Model warmed up on GPU!")
+ result = warmup_local_model()
+ if result and "error" in result.lower():
+ st.error(result)
+ else:
+ st.toast("Model warmed up on GPU!")
st.divider()
@@ -125,7 +133,7 @@ with col2:
# The Viewer
if _looks_like_html_table(st.session_state["ocr_output"]):
- st.markdown(st.session_state["ocr_output"], unsafe_allow_html=True)
+ st.html(st.session_state["ocr_output"])
else:
st.markdown(st.session_state["ocr_output"])
diff --git a/glm-ocr-pro/ocr_local.py b/glm-ocr-pro/ocr_local.py
index 5f7de25..2837d14 100644
--- a/glm-ocr-pro/ocr_local.py
+++ b/glm-ocr-pro/ocr_local.py
@@ -1,6 +1,6 @@
import json
from io import BytesIO
-from urllib import error, request
+import urllib.request
from typing import Generator
import pypdfium2 as pdfium
@@ -14,8 +14,8 @@ OLLAMA_BASE_URL = "http://localhost:11434"
def check_ollama_status() -> tuple[bool, str]:
try:
- req = request.Request(f"{OLLAMA_BASE_URL}/api/tags", method="GET")
- with request.urlopen(req, timeout=5) as resp:
+ req = urllib.request.Request(f"{OLLAMA_BASE_URL}/api/tags", method="GET")
+ with urllib.request.urlopen(req, timeout=5) as resp:
if resp.status == 200:
return True, "Ollama is running."
return False, "Ollama is not responding as expected."
@@ -63,14 +63,14 @@ def _optimize_image_bytes(image_bytes: bytes, max_side: int = 1400, quality: int
def warmup_local_model(timeout_seconds: int = 120) -> str:
payload = {"model": "glm-ocr", "prompt": "ready", "stream": False, "keep_alive": "10m"}
- req = request.Request(
+ req = urllib.request.Request(
f"{OLLAMA_BASE_URL}/api/generate",
method="POST",
headers={"Content-Type": "application/json"},
data=json.dumps(payload).encode("utf-8"),
)
try:
- with request.urlopen(req, timeout=timeout_seconds) as resp:
+ with urllib.request.urlopen(req, timeout=timeout_seconds) as resp:
_ = resp.read()
return "Warm-up completed. Model is loaded."
except Exception as exc:
@@ -101,7 +101,7 @@ def _run_single_image_local_stream(image_bytes: bytes, timeout_seconds: int) ->
],
}
- req = request.Request(
+ req = urllib.request.Request(
f"{OLLAMA_BASE_URL}/api/chat",
method="POST",
headers={"Content-Type": "application/json"},
@@ -110,7 +110,7 @@ def _run_single_image_local_stream(image_bytes: bytes, timeout_seconds: int) ->
try:
# We manually iterate over response lines for streaming
- with request.urlopen(req, timeout=timeout_seconds) as resp:
+ with urllib.request.urlopen(req, timeout=timeout_seconds) as resp:
for line in resp:
if not line:
continue
@@ -124,7 +124,7 @@ def _run_single_image_local_stream(image_bytes: bytes, timeout_seconds: int) ->
except json.JSONDecodeError:
continue
except Exception as exc:
- yield f"\n[Error calling local Ollama: {exc}]\n"
+ raise RuntimeError(f"Ollama request failed: {exc}") from exc
def extract_markdown_local_stream(
diff --git a/glm-ocr-pro/requirements.txt b/glm-ocr-pro/requirements.txt
index 97389ef..570f15e 100644
--- a/glm-ocr-pro/requirements.txt
+++ b/glm-ocr-pro/requirements.txt
@@ -1,4 +1,4 @@
-streamlit
-python-dotenv
-pypdfium2
-pillow
+streamlit>=1.31.0
+python-dotenv>=1.0.0
+pypdfium2>=4.30.0
+pillow>=10.0.0
\ No newline at end of file
diff --git a/openclaw.example.json b/openclaw.example.json
index e816aec..fbd9bd3 100644
--- a/openclaw.example.json
+++ b/openclaw.example.json
@@ -19,7 +19,7 @@
"servers": {
"github": {
"command": "npx",
- "args": ["-y", "@modelcontextprotocol/server-github"],
+ "args": ["-y", "@modelcontextprotocol/[email protected]"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"
}