-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
💸 feat: Balance Tab in Settings Dialog #6537
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
d0090d8
🚀 feat: Implement Auto-Refill Settings for Balance
rubentalstra 91ec113
Merge branch 'main' into feat/balance-settings-tab
rubentalstra da32349
Merge branch 'main' into feat/balance-settings-tab
rubentalstra e3acd18
🎨 feat: add `copy-tex` to improve copying KaTeX (#7308)
andresgit 71effb1
🔃 refactor: `AgentFooter` to conditionally render buttons based on `a…
mawburn c925f9f
🚀 feat: Add `Cloudflare Turnstile` support (#5987)
rubentalstra 6128270
Merge branch 'main' into feat/balance-settings-tab
rubentalstra a2d5c07
Merge branch 'dev' into feat/balance-settings-tab
rubentalstra a370c19
Potential fix for code scanning alert no. 5764: Ensure code is proper…
rubentalstra cad4489
Potential fix for code scanning alert no. 5765: Ensure code is proper…
rubentalstra d7f9fe1
🖼️ feat: Tool Call and Loading UI Refresh, Image Resize Config (#7086)
berry-13 ceccfb0
Merge branch 'dev' into feat/balance-settings-tab
rubentalstra a849ff8
📊 feat: Improve Helm Chart (#3638)
hofq a10e754
📜 docs: Unreleased Changelog (#7434)
github-actions[bot] 3cbae93
🛡️ chore: `multer` v2.0.0 for CVE-2025-47935 and CVE-2025-47944 (#7454)
danny-avila b812cb1
🎚️ feat: Custom Parameters (#7342)
nhtruong b2ea660
📃 fix: Ensure MCP Resources Pass Name and Description Fields to LLM (…
renehonig cd1b6bf
🔗 feat: Support Environment Variables in MCP URL Config (#7424)
benverhees a4b5234
🦙 chore: Add `llama-4` to Vision Models List (#7433)
AmgadHasan 5c0fbe4
🔧 fix: File Deletion for Azure Assistants API (#7466)
danny-avila 00b0313
🔬 fix: File Search Request Format (Azure Assistants API) (#7404)
arthurolivierfortin 7929a6f
🖼️ chore: Linting & Transition Styling in UI Components (#7467)
danny-avila fbbd0d0
✅ fix: Emojis rendering in `SplitText` Animation (#7460)
sbruel ee86a11
📂 refactor: Improve `FileAttachment` & File Form Deletion (#7471)
danny-avila 91da375
🌍 i18n: Update translation.json with latest translations (#7468)
github-actions[bot] 696298d
🦾 feat: Claude-4 Support (#7509)
danny-avila ed37d84
📊 chore: Remove Old Helm Chart (#7512)
hofq 422a64d
🪨 feat: Bedrock Support for Claude-4 Reasoning (#7517)
danny-avila 2663aa2
🪖 chore: bump helm app version to v0.7.8 (#7524)
austin-barrington a49c1ff
⌛ feat: Agent Version History and Management (#7455)
mawburn c34dd83
*️⃣ feat: Reuse OpenID Auth Tokens (#7397)
peeeteeer 2d5465a
🔎 feat: Native Web Search with Citation References (#7516)
danny-avila ef861d7
🧹 chore: Bump Agents Dependencies (#7525)
danny-avila 09dacff
🔧 refactor: Progress Text Localization for Running Tools (#7526)
danny-avila 2786aed
🔧 chore: Bump Data Provider and Custom Config Versions (#7527)
danny-avila 5422dcd
👤 feat: Enhance Agent Versioning to Track User Updates (#7523)
mawburn ca463ea
🧩 feat: Web Search Config Validations & Clipboard Citation Processing…
danny-avila e2fdfc1
🌍 i18n: Update translation.json with latest translations (#7532)
github-actions[bot] 20034cc
🔧 chore: Update data-provider dependencies for typing (#7533)
danny-avila 3a73031
🔧 fix: Artifacts Display Crash on Close and Max Width (#7540)
danny-avila 6a44e0a
🏷️ refactor: EditPresetDialog UI and Remove `chatGptLabel` from Prese…
danny-avila 0a33546
📦 refactor: Add Additional Chunking to Vite Config (#7544)
danny-avila e99dde2
⌚ fix: Debounce `setUserContext` and Default State Param for OpenID A…
danny-avila 79ee302
🚀 feat: Implement Auto-Refill Settings for Balance
rubentalstra 8b6b82d
Merge branch 'dev' into feat/balance-settings-tab
rubentalstra 42acd7e
fix: ESLint
rubentalstra 2f19ca0
✨ feat: Enhance Auto-Refill Settings with Validation and Localization
rubentalstra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
const Balance = require('~/models/Balance'); | ||
|
||
async function balanceController(req, res) { | ||
const { tokenCredits: balance = '' } = | ||
(await Balance.findOne({ user: req.user.id }, 'tokenCredits').lean()) ?? {}; | ||
res.status(200).send('' + balance); | ||
const balanceData = await Balance.findOne( | ||
{ user: req.user.id }, | ||
'-_id tokenCredits autoRefillEnabled refillIntervalValue refillIntervalUnit lastRefill refillAmount', | ||
).lean(); | ||
|
||
if (!balanceData) { | ||
return res.status(404).json({ error: 'Balance not found' }); | ||
} | ||
|
||
// If auto-refill is not enabled, remove auto-refill related fields from the response | ||
if (!balanceData.autoRefillEnabled) { | ||
delete balanceData.refillIntervalValue; | ||
delete balanceData.refillIntervalUnit; | ||
delete balanceData.lastRefill; | ||
delete balanceData.refillAmount; | ||
} | ||
|
||
res.status(200).json(balanceData); | ||
} | ||
|
||
module.exports = balanceController; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const { removeNullishValues } = require('librechat-data-provider'); | ||
const { logger } = require('~/config'); | ||
|
||
/** | ||
* Loads and maps the Cloudflare Turnstile configuration. | ||
* | ||
* Expected config structure: | ||
* | ||
* turnstile: | ||
* siteKey: "your-site-key-here" | ||
* options: | ||
* language: "auto" // "auto" or an ISO 639-1 language code (e.g. en) | ||
* size: "normal" // Options: "normal", "compact", "flexible", or "invisible" | ||
* | ||
* @param {TCustomConfig | undefined} config - The loaded custom configuration. | ||
* @param {TConfigDefaults} configDefaults - The custom configuration default values. | ||
* @returns {TCustomConfig['turnstile']} The mapped Turnstile configuration. | ||
*/ | ||
function loadTurnstileConfig(config, configDefaults) { | ||
const { turnstile: customTurnstile = {} } = config ?? {}; | ||
const { turnstile: defaults = {} } = configDefaults; | ||
|
||
/** @type {TCustomConfig['turnstile']} */ | ||
const loadedTurnstile = removeNullishValues({ | ||
siteKey: customTurnstile.siteKey ?? defaults.siteKey, | ||
options: customTurnstile.options ?? defaults.options, | ||
}); | ||
|
||
logger.info('Turnstile configuration loaded:\n' + JSON.stringify(loadedTurnstile, null, 2)); | ||
return loadedTurnstile; | ||
} | ||
|
||
module.exports = { | ||
loadTurnstileConfig, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.