Skip to content

Commit 52b1262

Browse files
author
samcraftt
committed
add script to update faiss, and update faiss
1 parent 911cb0d commit 52b1262

41 files changed

Lines changed: 756 additions & 1618 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
240 KB
Binary file not shown.
-28.5 KB
Binary file not shown.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# client/src/App.js
2+
3+
Root component of the PyTC Client application. Wraps the app in context providers and performs cache clearing on boot.
4+
5+
## Structure
6+
7+
```
8+
App
9+
├── ContextWrapper (GlobalContext)
10+
│ └── YamlContextWrapper (YamlContext)
11+
│ └── CacheBootstrapper
12+
│ └── MainContent (Views)
13+
```
14+
15+
## Components
16+
17+
### `CacheBootstrapper`
18+
- Runs `resetFileState()` from `AppContext` on mount
19+
- Clears local cache (files, fileList, etc.) before rendering children
20+
- Renders nothing until cache is cleared; then renders main content
21+
22+
### `MainContent`
23+
- Renders `Views` component (main application layout with tabs)
24+
25+
## Contexts
26+
27+
- **AppContext** — Global state (files, configs, paths, etc.)
28+
- **YamlContext** — YAML-specific state (GPUs, batch size, etc.)
29+
30+
## Usage
31+
32+
Used as the root in `index.js` via `ReactDOM.createRoot`.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# client/src/api.js
2+
3+
Central API client for the PyTC Client frontend. Exposes functions for all backend communication.
4+
5+
## API Base URL
6+
7+
`${REACT_APP_SERVER_PROTOCOL || "http"}://${REACT_APP_SERVER_URL || "localhost:4242"}`
8+
9+
## Exports
10+
11+
### `apiClient`
12+
Axios instance with base URL, `withCredentials: true`. Used for general requests (e.g. `/files`, `/files/upload`).
13+
14+
### Visualization
15+
- **`getNeuroglancerViewer(image, label, scales)`** — Launches Neuroglancer viewer. Accepts file objects or path strings. Uses FormData for browser uploads.
16+
17+
### File Checks
18+
- **`checkFile(file)`** — POST to `/check_files` to detect if file is likely a label (heuristic).
19+
20+
### Generic
21+
- **`makeApiRequest(url, method, data)`** — HTTP request helper with JSON Content-Type.
22+
23+
### Model Training
24+
- **`startModelTraining(trainingConfig, logPath, outputPath)`** — Injects OUTPUT_PATH into YAML config and POSTs to `/start_model_training`
25+
- **`stopModelTraining()`**
26+
- **`getTrainingStatus()`**
27+
- **`getTensorboardURL()`**
28+
29+
### Model Inference
30+
- **`startModelInference(inferenceConfig, outputPath, checkpointPath)`** — Injects OUTPUT_PATH into YAML, sets NUM_GPUS=1, POSTs to `/start_model_inference`
31+
- **`stopModelInference()`**
32+
- **`getInferenceStatus()`**
33+
34+
### Chatbot
35+
- **`queryChatBot(query)`** — POST to `/chat/query`
36+
- **`clearChat()`** — POST to `/chat/clear`
37+
38+
### Config Presets
39+
- **`getConfigPresets()`** — GET `/pytc/configs`
40+
- **`getConfigPresetContent(path)`** — GET `/pytc/config`
41+
- **`getModelArchitectures()`** — GET `/pytc/architectures`
42+
43+
## Helper Functions
44+
45+
- `buildFilePath(file)` — Extracts path from various file object shapes ( Ant Design Upload, folderPath+name, etc.)
46+
- `hasBrowserFile(file)` — Checks if file is a browser File object
47+
- `handleError(error)` — Throws errors with response detail when available

server_api/chatbot/file_summaries/backend/main.md

Lines changed: 0 additions & 150 deletions
This file was deleted.
Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,25 @@
1-
# Chatbot Component
1+
# client/src/components/Chatbot.js
22

3-
## Overview
4-
5-
The ChatBot component provides an AI-powered conversational interface for user support and assistance. It integrates with a RAG (Retrieval-Augmented Generation) backend to provide intelligent responses about the PyTorch Connectomics platform.
6-
7-
## Functionality
8-
9-
- **Real-time Chat Interface**: Provides a full-screen chat interface with message history
10-
- **Session Management**: Creates and maintains chat sessions with unique session IDs
11-
- **Message Persistence**: Saves chat history and session data in localStorage
12-
- **AI Integration**: Connects to backend RAG system for intelligent responses
13-
- **User Experience**: Clean, modern UI with message bubbles and typing indicators
14-
15-
## Key Features
16-
17-
- **Session-based Conversations**: Each chat session maintains context and memory
18-
- **Message History**: Persistent storage of conversation history
19-
- **Error Handling**: Graceful error handling for network issues
20-
- **Responsive Design**: Full-height layout with proper scrolling
21-
- **Input Validation**: Prevents empty message sending
3+
AI assistant panel for helping users navigate PyTC Client. Renders a chat UI with message history, Markdown rendering, and server-backed responses.
224

235
## Props
246

25-
- `onClose`: Function to close the chat interface
26-
27-
## State Management
28-
29-
- `messages`: Array of chat messages with user/bot distinction
30-
- `inputValue`: Current text input value
31-
- `sessionId`: Unique identifier for the chat session
32-
- `isSending`: Boolean indicating if a message is being processed
33-
34-
## API Integration
35-
36-
- **createChatSession()**: Creates a new chat session with the backend
37-
- **queryChatBot(sessionId, query)**: Sends user queries to the AI assistant
38-
39-
## User Interactions
40-
41-
1. **Opening Chat**: Click the message icon to open the chat interface
42-
2. **Sending Messages**: Type in the text area and press Enter or click Send
43-
3. **Session Persistence**: Chat history is automatically saved and restored
44-
4. **Closing Chat**: Click the X button to close the interface
7+
- **`onClose`** — Callback when user closes the chat (e.g. drawer)
458

46-
## Technical Implementation
9+
## Features
4710

48-
- Uses Ant Design components for UI consistency
49-
- Implements proper cleanup with useEffect hooks
50-
- Handles async operations with proper error boundaries
51-
- Manages local storage for data persistence
11+
- **Message persistence** — Saves messages to `localStorage` under `chatMessages`
12+
- **Markdown rendering** — Uses `react-markdown` with `remarkGfm` for lists, tables, code blocks
13+
- **Keyboard shortcut** — Enter (without Shift) sends message
14+
- **Clear chat** — Popconfirm to clear; calls `clearChat()` API and resets to initial greeting
5215

53-
## Use Cases
16+
## API Calls
5417

55-
- **User Support**: Help users navigate the platform and understand features
56-
- **Troubleshooting**: Assist with common issues and error resolution
57-
- **Feature Guidance**: Provide step-by-step instructions for complex workflows
58-
- **Documentation Access**: Answer questions about platform capabilities
18+
- `queryChatBot(query)` — Sends user message, displays response
19+
- `clearChat()` — Clears server-side history and local state
5920

60-
## Integration Points
21+
## UI Layout
6122

62-
- **Global Context**: Accesses shared application state
63-
- **API Layer**: Communicates with backend RAG system
64-
- **Local Storage**: Persists user data across sessions
65-
- **UI Framework**: Integrates with Ant Design component library
23+
- Header: "AI Assistant" title, Clear button, Close button
24+
- Scrollable message list (user messages right-aligned, blue; bot messages left-aligned, gray)
25+
- TextArea + Send button at bottom

0 commit comments

Comments
 (0)