Skip to content

🏷️ feat: Request Body Placeholders in Custom Headers #8601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

s10gopal
Copy link
Contributor

@s10gopal s10gopal commented Jul 22, 2025

Summary

feat: add support for request body placeholders in custom endpoint headers

  • Add {{LIBRECHAT_BODY_*}} placeholders for conversationId, parentMessageId, messageId

Change Type

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Testing

Please describe your test process and include instructions so that we can reproduce your test. If there are any important variables for your testing configuration, list them here.

Test Configuration:

endpoints:
custom:
- name: 'customllm'
apiKey: 'KEY'
baseURL: 'http://host.docker.internal:8001/v1'
models:
default:
[
'mycustommodel'
]
fetch: false
titleConvo: true
titleModel: 'current_model'
modelDisplayLabel: 'mycustommodel'
headers:
X-Conversation-ID: "{{LIBRECHAT_BODY_CONVERSATIONID}}"

Checklist

@s10gopal
Copy link
Contributor Author

#8017

@s10gopal s10gopal force-pushed the feat/custom-endpoint-conversation-id branch 3 times, most recently from b6162a6 to 2dfb523 Compare July 22, 2025 16:14
@s10gopal s10gopal force-pushed the feat/custom-endpoint-conversation-id branch 6 times, most recently from e9416c9 to cfe699d Compare July 23, 2025 17:31
@s10gopal s10gopal force-pushed the feat/custom-endpoint-conversation-id branch from cfe699d to 9d33ce3 Compare July 24, 2025 10:35
@s10gopal s10gopal requested a review from MrunmayS July 24, 2025 11:34
Copy link

@MrunmayS MrunmayS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good!

@s10gopal s10gopal force-pushed the feat/custom-endpoint-conversation-id branch from ca0bd4e to 1d55f8a Compare July 25, 2025 12:37
@s10gopal
Copy link
Contributor Author

#8017

@s10gopal s10gopal force-pushed the feat/custom-endpoint-conversation-id branch 2 times, most recently from fd8ec0a to 3a8bd57 Compare August 5, 2025 08:20
@s10gopal
Copy link
Contributor Author

s10gopal commented Aug 5, 2025

Hi @danny-avila, Could you please review?

@s10gopal s10gopal changed the title feat: Add conversation ID support to custom endpoint headers feat: add {{LIBRECHAT_BODY_*}} placeholders (conversationId, parentMessageId, messageId) to custom endpoint headers Aug 7, 2025
@s10gopal s10gopal requested a review from danny-avila August 7, 2025 00:10
@s10gopal s10gopal force-pushed the feat/custom-endpoint-conversation-id branch from ee3e954 to a7905eb Compare August 7, 2025 00:11
Copy link
Contributor Author

@s10gopal s10gopal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the guidance! I've moved the logic to env.ts and added tests in env.spec.ts. Happy to adjust further if needed

@dustinhealy
Copy link
Collaborator

I'll continue on from where you guys left off here and resolve the rest of Danny's requested changes. Thanks for the work done so far!

Gopal Sharma and others added 4 commits August 10, 2025 03:55
- Add LIBRECHAT_CONVERSATION_ID to customUserVars when provided
- Pass conversation ID to header resolution for dynamic headers
- Add comprehensive test coverage

Enables custom endpoints to access conversation context using {{LIBRECHAT_CONVERSATION_ID}} placeholder.
…aders

- Add {{LIBRECHAT_BODY_*}} placeholders for conversationId, parentMessageId, messageId
- Update tests to reflect new body placeholder functionality
@s10gopal s10gopal force-pushed the feat/custom-endpoint-conversation-id branch from 6fd4531 to d37db43 Compare August 9, 2025 22:25
@s10gopal
Copy link
Contributor Author

s10gopal commented Aug 9, 2025

Docs PR: LibreChat-AI/librechat.ai#386

@s10gopal s10gopal requested a review from dustinhealy August 13, 2025 19:12
@dustinhealy
Copy link
Collaborator

Hi Gopal, just resolving the final conflicts right now.

@s10gopal
Copy link
Contributor Author

Hi @danny-avila, Could you please review?

@s10gopal s10gopal requested a review from danny-avila August 14, 2025 16:05
@s10gopal
Copy link
Contributor Author

Hi @danny-avila, really appreciate your earlier reviews and guidance. When you have a moment, could you take another look?

@danny-avila danny-avila changed the title feat: add {{LIBRECHAT_BODY_*}} placeholders (conversationId, parentMessageId, messageId) to custom endpoint headers 🏷️ feat: Request Body Placeholders in Custom Headers Aug 16, 2025
@danny-avila
Copy link
Owner

Moved to #9095

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.

4 participants