Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
125a094
Improved Chatbot prompts to reduce hallucination tendencies. Also all…
Feb 10, 2026
d4f42cd
Fixed the issue with crappy RAG retrievals by using a better embeddin…
Feb 10, 2026
8c2183d
Update server_api/auth/router.py
zhangdjr Feb 10, 2026
5969128
Initial plan
Copilot Feb 10, 2026
67fc57e
Initial plan
Copilot Feb 10, 2026
b9efcf4
Add validation for query parameter in /chat/query endpoint
Copilot Feb 10, 2026
2771468
Add mount operation guardrails to prevent self-DoS
Copilot Feb 10, 2026
a0f75b2
Update client/src/components/FilePickerModal.js
zhangdjr Feb 10, 2026
9cc6195
Address code review feedback on mount guardrails
Copilot Feb 10, 2026
6e29b1d
Clarify depth limit semantics in error messages
Copilot Feb 10, 2026
9b0d139
Initial plan
Copilot Feb 10, 2026
7f05d72
Improve depth limit constant clarity
Copilot Feb 10, 2026
879232b
Merge pull request #117 from PytorchConnectomics/copilot/sub-pr-116
zhangdjr Feb 10, 2026
b117332
Use environment variables for Ollama configuration in update_faiss.py
Copilot Feb 10, 2026
d601235
Merge pull request #119 from PytorchConnectomics/copilot/sub-pr-116-a…
zhangdjr Feb 10, 2026
db2e6c7
Merge pull request #118 from PytorchConnectomics/copilot/sub-pr-116-a…
zhangdjr Feb 10, 2026
b5aef24
Merge branch 'main' into improve-chatbot
zhangdjr Feb 10, 2026
94753eb
small change to prompt
Feb 10, 2026
d07f392
added chatbot history awareness
Feb 10, 2026
c789a97
formatted code to appease linter
Feb 10, 2026
3048bdc
returned back to old code
Feb 12, 2026
b426f06
formatting changes and slight prompt modification
Feb 12, 2026
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
12 changes: 12 additions & 0 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ function createMenu() {
label: "Electron",
submenu: [{ role: "toggleDevTools" }, { role: "quit" }],
},
{
label: "Edit",
submenu: [
{ role: "undo" },
{ role: "redo" },
{ type: "separator" },
{ role: "cut" },
{ role: "copy" },
{ role: "paste" },
{ role: "selectAll" },
],
},
{
label: "Views",
submenu: [
Expand Down
11 changes: 6 additions & 5 deletions client/src/components/FilePickerModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ const FilePickerModal = ({
const [loading, setLoading] = useState(false);
const [previewStatus, setPreviewStatus] = useState({});
const [onlyImages, setOnlyImages] = useState(false);
const previewBaseUrl =
apiClient.defaults.baseURL || "http://localhost:4242";
const previewBaseUrl = apiClient.defaults.baseURL || "http://localhost:4242";

// Refactored fetch to get all files once
const [allData, setAllData] = useState([]);
Expand All @@ -46,6 +45,7 @@ const FilePickerModal = ({
if (visible) {
setCurrentPath("root");
setOnlyImages(false);
setPreviewStatus({});
loadAllData();
}
}, [visible]);
Expand Down Expand Up @@ -180,12 +180,13 @@ const FilePickerModal = ({
const isImageFile = (item) => {
if (!item || item.is_folder) return false;
if (item.type && item.type.startsWith("image/")) return true;
const ext = `.${String(item.name || "").split(".").pop()}`.toLowerCase();
const ext = `.${String(item.name || "")
.split(".")
.pop()}`.toLowerCase();
return IMAGE_EXTENSIONS.has(ext);
};

const getPreviewUrl = (item) =>
`${previewBaseUrl}/files/preview/${item.id}`;
const getPreviewUrl = (item) => `${previewBaseUrl}/files/preview/${item.id}`;

const markPreviewLoaded = (id) => {
setPreviewStatus((prev) => ({ ...prev, [id]: "loaded" }));
Expand Down
7 changes: 4 additions & 3 deletions client/src/views/FilesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ function FilesManager() {
const containerRef = useRef(null);
const itemRefs = useRef({});
const isDragSelecting = useRef(false);
const previewBaseUrl =
apiClient.defaults.baseURL || "http://localhost:4242";
const previewBaseUrl = apiClient.defaults.baseURL || "http://localhost:4242";

// Sidebar Resize Logic
const [sidebarWidth, setSidebarWidth] = useState(250);
Expand Down Expand Up @@ -215,7 +214,9 @@ function FilesManager() {
const isImageFile = (file) => {
if (!file || file.is_folder) return false;
if (file.type && file.type.startsWith("image/")) return true;
const ext = `.${String(file.name || "").split(".").pop()}`.toLowerCase();
const ext = `.${String(file.name || "")
.split(".")
.pop()}`.toLowerCase();
return IMAGE_EXTENSIONS.has(ext);
};

Expand Down
80 changes: 40 additions & 40 deletions scripts/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ DEFAULT_OLLAMA_BASE_URL="http://localhost:11434"
DEFAULT_OLLAMA_MODEL="llama3.1:8b"

if ! command -v uv >/dev/null 2>&1; then
echo "uv is required. Run scripts/bootstrap.sh first." >&2
exit 1
echo "uv is required. Run scripts/bootstrap.sh first." >&2
exit 1
fi

if ! command -v npm >/dev/null 2>&1; then
echo "npm is required to launch the Electron client." >&2
exit 1
echo "npm is required to launch the Electron client." >&2
exit 1
fi

cleanup() {
local exit_code=$?
if [[ -n "${API_PID:-}" ]] && ps -p "${API_PID}" >/dev/null 2>&1; then
kill "${API_PID}" >/dev/null 2>&1 || true
fi
if [[ -n "${PYTC_PID:-}" ]] && ps -p "${PYTC_PID}" >/dev/null 2>&1; then
kill "${PYTC_PID}" >/dev/null 2>&1 || true
fi
if [[ -n "${DATA_SERVER_PID:-}" ]] && ps -p "${DATA_SERVER_PID}" >/dev/null 2>&1; then
kill "${DATA_SERVER_PID}" >/dev/null 2>&1 || true
fi
if [[ -n "${REACT_PID:-}" ]] && ps -p "${REACT_PID}" >/dev/null 2>&1; then
kill "${REACT_PID}" >/dev/null 2>&1 || true
fi
wait || true
exit "${exit_code}"
local exit_code=$?
if [[ -n "${API_PID:-}" ]] && ps -p "${API_PID}" >/dev/null 2>&1; then
kill "${API_PID}" >/dev/null 2>&1 || true
fi
if [[ -n "${PYTC_PID:-}" ]] && ps -p "${PYTC_PID}" >/dev/null 2>&1; then
kill "${PYTC_PID}" >/dev/null 2>&1 || true
fi
if [[ -n "${DATA_SERVER_PID:-}" ]] && ps -p "${DATA_SERVER_PID}" >/dev/null 2>&1; then
kill "${DATA_SERVER_PID}" >/dev/null 2>&1 || true
fi
if [[ -n "${REACT_PID:-}" ]] && ps -p "${REACT_PID}" >/dev/null 2>&1; then
kill "${REACT_PID}" >/dev/null 2>&1 || true
fi
wait || true
exit "${exit_code}"
}

trap cleanup EXIT INT TERM
Expand All @@ -43,8 +43,8 @@ DATA_SERVER_PID=$!

echo "Starting API server (port 4242)..."
OLLAMA_BASE_URL="${OLLAMA_BASE_URL:-${DEFAULT_OLLAMA_BASE_URL}}" \
OLLAMA_MODEL="${OLLAMA_MODEL:-${DEFAULT_OLLAMA_MODEL}}" \
PYTHONDONTWRITEBYTECODE=1 uv run --directory "${ROOT_DIR}" python -m server_api.main &
OLLAMA_MODEL="${OLLAMA_MODEL:-${DEFAULT_OLLAMA_MODEL}}" \
PYTHONDONTWRITEBYTECODE=1 uv run --directory "${ROOT_DIR}" python -m server_api.main &
API_PID=$!

echo "Starting PyTC server (port 4243)..."
Expand All @@ -53,33 +53,33 @@ PYTC_PID=$!

echo "Starting React dev server (port 3000)..."
pushd "${CLIENT_DIR}" >/dev/null
PORT=3000 BROWSER=none npm start > react.log 2>&1 &
PORT=3000 BROWSER=none npm start >react.log 2>&1 &
REACT_PID=$!

# Robust readiness check with progress feedback
wait_for_react() {
local max_attempts=60
local attempt=1
while [[ ${attempt} -le ${max_attempts} ]]; do
if curl -sf http://localhost:3000 >/dev/null 2>&1; then
echo "React dev server is ready!"
return 0
fi
echo "Waiting for React (attempt ${attempt}/${max_attempts})..."
attempt=$((attempt + 1))
sleep 1
done
echo "ERROR: React dev server failed to start within ${max_attempts} seconds" >&2
echo "Check client/react.log for details." >&2
return 1
local max_attempts=60
local attempt=1
while [[ ${attempt} -le ${max_attempts} ]]; do
if curl -sf http://localhost:3000 >/dev/null 2>&1; then
echo "React dev server is ready!"
return 0
fi
echo "Waiting for React (attempt ${attempt}/${max_attempts})..."
attempt=$((attempt + 1))
sleep 1
done
echo "ERROR: React dev server failed to start within ${max_attempts} seconds" >&2
echo "Check client/react.log for details." >&2
return 1
}

if wait_for_react; then
echo "Launching Electron client..."
ENVIRONMENT=development npm run electron
echo "Launching Electron client..."
ENVIRONMENT=development npm run electron
else
echo "Failed to start React dev server" >&2
exit 1
echo "Failed to start React dev server" >&2
exit 1
fi

popd >/dev/null
Loading
Loading