Skip to content

feat(workflows): make chat endpoint runnable - #3715

Closed
tang-vu wants to merge 1 commit into
Osmantic:mainfrom
tang-vu:feat/n8n-chat-endpoint-workflow
Closed

tang-vu wants to merge 1 commit into
Osmantic:mainfrom
tang-vu:feat/n8n-chat-endpoint-workflow

Conversation

@tang-vu

@tang-vu tang-vu commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • replace the Chat API Endpoint placeholder with an activatable POST /webhook/ods-chat-completions workflow
  • validate and bound messages, roles, model ID, temperature, output tokens, total input size, and non-streaming mode
  • forward a normalized request to the local llama-server with a three-minute inference timeout
  • emit an allowlisted OpenAI-compatible completion shape or explicit 400/502 error JSON

Why this matters

The dashboard catalog promises a one-minute REST chat endpoint, but enabling the template previously imported only a manual trigger and setup note. This PR turns that reachable catalog action into a usable local API facade with safer limits and predictable responses.

The invariant is: unvalidated fields never reach llama-server, streaming cannot enter a response-node workflow, upstream payloads are not reflected wholesale, and every accepted request has one terminal JSON response.

Overlap check

Searched open and closed upstream PR titles/bodies for n8n chat API endpoint workflow, reviewed the latest 1,000 open PRs and changed production files, and inspected 01-chat-endpoint.json history. No open or closed PR implements this workflow or changes its production file; upstream history only contains the repository rename. Other runnable n8n PRs operate on distinct catalog entries.

The HTTP Request node shape was checked against n8n's official implementation: https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts

Test plan

  • python -m pytest test_n8n_chat_endpoint_template.py test_workflows.py -q ? 48 passed
    • authenticated public enable imports the exact shipped graph and activates its n8n ID
    • webhook path, llama request, timeout, non-streaming body, validation ceilings, error branches, and allowlisted output
    • all existing workflow-management tests remain green
  • docker run --rm ... n8nio/n8n:2.6.4 import:workflow --input=/workflows/01-chat-endpoint.json ? successfully imported 1 workflow using the exact image ODS ships
  • python -m json.tool ods/config/n8n/01-chat-endpoint.json
  • python -m compileall -q .../test_n8n_chat_endpoint_template.py
  • git diff --check

Design and operational notes

  • This workflow intentionally supports text messages and non-streaming completion only; direct ODS APIs remain the path for streaming, tools, and multimodal payloads.
  • The existing n8n/llama-server network boundary and dependency gate are reused; no external credential or service is introduced.
  • HTTP failures continue into a controlled 502 response. Successful output retains only completion identity, one assistant choice, finish reason, and sanitized token counters.
  • Exact-version CLI import proves n8n 2.6.4 accepts the graph. A live inference call was not claimed because no running model endpoint was part of this validation.
  • Rollback restores the catalog placeholder with no persisted-data migration.

Generated with Codex.

Batch compatibility

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. We're closing outside-contributor pull requests that have had no activity for 14 days or more, so the queue reflects work that can still land. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and reopen it or open a focused PR. See #7253 for details and the contribution policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants