u
This commit is contained in:
@@ -296,7 +296,7 @@ async function parseDocumentManifest({ req, res, pages, sourceLabel }) {
|
||||
|
||||
// ── LLMOrbiter setup ─────────────────────────────────────────────
|
||||
const model = await resolveDefaultModel(req.user.id);
|
||||
const provider = new OpenRouterProvider({ apiKey });
|
||||
const provider = new OpenRouterProvider({ apiKey, apiUrl: env.openrouterApiUrl });
|
||||
const orbiter = new LLMOrbiter(provider, {
|
||||
onStatus: (status) => {
|
||||
console.log(`[llmorbiter] Status: ${status}`);
|
||||
|
||||
@@ -313,11 +313,11 @@ export function register(app, basePath = '') {
|
||||
* summary: Stream conversation events (SSE)
|
||||
* description: |
|
||||
* Opens a Server-Sent Events stream for the specified conversation.
|
||||
* Streams `message` events (persisted user/assistant messages), live `delta`
|
||||
* text chunks of the model answer, and `state` events (`thinking`, `working`,
|
||||
* `done`). The SSE states are not stored; the database only knows `idle`/`busy`.
|
||||
* `done` carries `usage` (`input`, `cached`, `output`, `cost`) on success or
|
||||
* `error` (string) if the run failed.
|
||||
* Streams live `delta` text chunks of the model answer, `usage` stats per turn,
|
||||
* and `state` events (`thinking`, `connected`, `firstevent`, `reasoning`,
|
||||
* `content`, `working`, `toolcall`, `done`). The SSE states are not stored;
|
||||
* the database only knows `idle`/`busy`.
|
||||
* `done` indicates generation has finished, carrying `error` (string) only if the run failed.
|
||||
* security:
|
||||
* - cookieAuth: []
|
||||
* parameters:
|
||||
@@ -330,7 +330,7 @@ export function register(app, basePath = '') {
|
||||
* responses:
|
||||
* 200:
|
||||
* description: |
|
||||
* SSE stream (`text/event-stream`). Emits `state`, `delta`, and `message` events.
|
||||
* SSE stream (`text/event-stream`). Emits `state`, `delta`, and `usage` events.
|
||||
* content:
|
||||
* text/event-stream:
|
||||
* schema:
|
||||
@@ -340,16 +340,22 @@ export function register(app, basePath = '') {
|
||||
* data: {"state":"thinking"}
|
||||
*
|
||||
* event: state
|
||||
* data: {"state":"working"}
|
||||
* data: {"state":"connected"}
|
||||
*
|
||||
* event: state
|
||||
* data: {"state":"firstevent"}
|
||||
*
|
||||
* event: state
|
||||
* data: {"state":"content"}
|
||||
*
|
||||
* event: delta
|
||||
* data: {"delta":"Hel","text":"Hel"}
|
||||
*
|
||||
* event: message
|
||||
* data: {"id":2,"conversation_id":1,"created_at":"...","role":"assistant","message":"Hello there"}
|
||||
* event: usage
|
||||
* data: {"input":20,"cached":0,"output":3,"cost":0.0001}
|
||||
*
|
||||
* event: state
|
||||
* data: {"state":"done","usage":{"input":20,"cached":0,"output":3,"cost":0.0001}}
|
||||
* data: {"state":"done"}
|
||||
* 400:
|
||||
* description: Invalid ID or no company selected
|
||||
* content:
|
||||
|
||||
Reference in New Issue
Block a user