Working guide: AFFiNE + LiteLLM + Ollama via Responses→Chat bridge (FIXED) #13575
axcode07
started this conversation in
Show and tell
Replies: 2 comments
-
|
It worked like magic! The show WILL GO ON thanks to @axcode07 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
This seems like a great solution. I wanna confirm a few things though:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
AFFiNE Copilot streams to /v1/responses (Responses API) and expects a specific SSE prelude + a stable item_id. LiteLLM/Ollama expose OpenAI Chat Completions (/v1/chat/completions) with a different stream shape—causing the classic “text part … not found” error.
What this is:
A tiny Node adapter that accepts POST /v1/responses, translates inputs into OpenAI-style messages[], calls LiteLLM chat (stream or non-stream), and re-emits proper Responses-API events. /v1/models and /v1/embeddings are passed through unchanged. No patching AFFiNE, no forking LiteLLM.
Why it’s simple:
Normalizes AFFiNE content parts → plain string messages
Emits the required Responses prelude (response.output_item.added, response.content_part.added, …)
Streams deltas cleanly; stable item_id
Works with LiteLLM + Ollama out of the box
Check out repo: https://github.com/axcode07/affine_ai_helper
Quick start
Run the adapter container (Dockerfile included).
In your proxy (e.g. Caddy), route only /v1/responses* to the adapter; everything else → LiteLLM.
In AFFiNE → Copilot (OpenAI), keep baseURL = https:///v1 and your API key.
Feedback and forks are welcomed!
Beta Was this translation helpful? Give feedback.
All reactions