{"repo":"axcode07/affine_ai_helper","free":true,"listed":false,"github":"https://github.com/axcode07/affine_ai_helper","clone":"git clone https://github.com/axcode07/affine_ai_helper.git","description":"A bridge type solution between Affine and LiteLLM (+ Ollama self-hosted AI)","language":"TypeScript","stars":18,"topics":[],"license":"Apache-2.0","category":"self-hosted-apps","readme_excerpt":"AFFiNE + LiteLLM “Responses → Chat” Adapter Update: Please also add the openai.ts changed file and restart adapter in order for the responeses-adapter to work! A tiny, production-friendly fix for connecting AFFiNE Copilot to LiteLLM/Ollama when AFFiNE streams to /v1/responses but your stack only supports /v1/chat/completions. Problem: AFFiNE (via the Vercel AI SDK) streams to /v1/responses and expects Responses-API SSE events. LiteLLM/Ollama speak OpenAI Chat Completions (/v1/chat/completions) and a different stream shape. Result: \" Provider openai failed with unexpected response: text part … not found \" Tried: Upgrading LiteLLM, reverse-proxy tricks, patching AFFiNE bundle to use Chat Completions. Too brittle/invasive. Solution: Drop in a small Node adapter that: - Accepts POST /v1/responses - Calls LiteLLM POST /v1/chat/completions - Normalizes AFFiNE inputs to valid OpenAI chat messages - Streams back Responses-API SSE events with a stable item id - Passes everything else (models/embeddings) straight to LiteLLM Routing: Caddy sends only /v1/responses to the adapter; everything else to LiteLLM. Note: In this example I am using a domain + ssl for both Affine and LiteLLM (running docker containers + ollama installed locally along) Why this is needed AFFiNE’s Copilot (Vercel AI SDK) uses an OpenAI-compatible Responses API. Its streaming contract requires a prelude: 1. response.created 2. response.output item.added (declares the message item & id) 3. response.content part.added","default_branch":null,"files":null,"tree":[],"storefront":"/r/axcode07","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/axcode07/affine_ai_helper/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}