|
| 1 | +# Opey & Chat File Comparison: OBP-Portal vs API-Manager-II |
| 2 | + |
| 3 | +> Generated: 2026-03-08 |
| 4 | +> |
| 5 | +> OBP-Portal is the **master** for all Opey-related code. |
| 6 | +> API-Manager-II should match it exactly. |
| 7 | +
|
| 8 | +## Identical Files (19 of 24) |
| 9 | + |
| 10 | +| # | File | Status | |
| 11 | +|---|------|--------| |
| 12 | +| 1 | `src/lib/opey/types.ts` | IDENTICAL | |
| 13 | +| 2 | `src/lib/opey/controllers/ChatController.ts` | IDENTICAL | |
| 14 | +| 3 | `src/lib/opey/controllers/SessionController.ts` | IDENTICAL | |
| 15 | +| 4 | `src/lib/opey/controllers/ToolCallController.ts` | IDENTICAL | |
| 16 | +| 5 | `src/lib/opey/state/ChatState.ts` | IDENTICAL | |
| 17 | +| 6 | `src/lib/opey/state/SessionState.ts` | IDENTICAL | |
| 18 | +| 7 | `src/lib/opey/services/ChatService.ts` | IDENTICAL | |
| 19 | +| 8 | `src/lib/opey/services/RestChatService.ts` | IDENTICAL | |
| 20 | +| 9 | `src/lib/opey/services/SessionService.ts` | IDENTICAL | |
| 21 | +| 10 | `src/lib/opey/services/ConsentSessionService.ts` | IDENTICAL | |
| 22 | +| 11 | `src/lib/opey/services/AuthStrategy.ts` | IDENTICAL | |
| 23 | +| 12 | `src/lib/opey/utils/roles.ts` | IDENTICAL | |
| 24 | +| 13 | `src/lib/opey/utils/chatToMarkdown.ts` | IDENTICAL | |
| 25 | +| 14 | `src/lib/components/OpeyChat.svelte` | IDENTICAL | |
| 26 | +| 15 | `src/lib/components/ChatMessage.svelte` | IDENTICAL | |
| 27 | +| 16 | `src/lib/components/tool-messages/index.ts` | IDENTICAL | |
| 28 | +| 17 | `src/lib/components/tool-messages/ToolMessage.svelte` | IDENTICAL | |
| 29 | +| 18 | `src/lib/components/tool-messages/ToolError.svelte` | IDENTICAL | |
| 30 | +| 19 | `src/lib/markdown/helper-funcs.ts` | IDENTICAL | |
| 31 | +| 20 | `src/routes/api/opey/auth/+server.ts` | IDENTICAL | |
| 32 | + |
| 33 | +## Files With Trivial Whitespace-Only Differences (4 of 24) |
| 34 | + |
| 35 | +These have no functional code differences -- only trailing whitespace on some lines. |
| 36 | + |
| 37 | +| # | File | Difference | |
| 38 | +|---|------|------------| |
| 39 | +| 21 | `src/lib/opey/services/OBPIntegrationService.ts` | Line 83: OBP-Portal has trailing tab, API-Manager-II does not | |
| 40 | +| 22 | `src/lib/components/tool-messages/ObpApiResponse.svelte` | Lines 5, 7, 10-11, 17, 19-20: OBP-Portal has trailing spaces | |
| 41 | +| 23 | `src/lib/components/tool-messages/DefaultToolResponse.svelte` | Line 5: OBP-Portal has trailing space | |
| 42 | +| 24 | `src/routes/api/opey/consent/+server.ts` | Lines 11, 16: OBP-Portal has trailing space in comment | |
| 43 | + |
| 44 | +## Files Only in API-Manager-II (not in OBP-Portal) |
| 45 | + |
| 46 | +| File | Purpose | |
| 47 | +|------|---------| |
| 48 | +| `src/lib/opey/bootstrap/opeyNotebook.ts` | Bootstraps `opey_notebook` dynamic entity in OBP at startup | |
| 49 | +| `src/routes/api/opey/stream/+server.ts` | SSE stream proxy (legacy, no longer used for streaming) | |
| 50 | +| `src/routes/api/opey/stream/[threadId]/stop/+server.ts` | Stop stream proxy | |
| 51 | +| `src/routes/api/opey/stream/[threadId]/regenerate/+server.ts` | Regenerate stream proxy | |
| 52 | + |
| 53 | +> **Note:** The stream proxy routes exist because API-Manager-II originally proxied |
| 54 | +> Opey streaming through SvelteKit. As of 2026-03-08, API-Manager-II connects directly |
| 55 | +> to the Opey backend (via `PUBLIC_OPEY_BASE_URL`), matching OBP-Portal's architecture. |
| 56 | +> These proxy routes are no longer used for the main chat flow but remain for reference. |
| 57 | +
|
| 58 | +## Files Only in OBP-Portal (not in API-Manager-II) |
| 59 | + |
| 60 | +None. |
| 61 | + |
| 62 | +## Key Architecture Notes |
| 63 | + |
| 64 | +- **Svelte version**: Both projects must use Svelte `5.33.2`. Newer versions (5.43+) have a reactivity regression that breaks streaming (keyed `{#each}` blocks skip re-renders for mutated objects). |
| 65 | +- **Opey connection**: Both projects connect directly to the Opey backend from the browser using `PUBLIC_OPEY_BASE_URL`. No SvelteKit proxy for streaming. |
| 66 | +- **CORS**: The Opey backend's `CORS_ALLOWED_ORIGINS` must include the origin of each frontend (e.g. `http://localhost:5174` for Portal, `http://localhost:3003` for API-Manager-II). |
| 67 | +- **Auth/consent**: Both projects proxy auth (`/api/opey/auth`) and consent (`/api/opey/consent`) through SvelteKit server-side routes (these need server-side secrets). |
0 commit comments