mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 01:40:15 +01:00
refactor: Clarify content handling logic in useStepHandler
- Updated comments to better explain the handling of initialContent and existingContent in edit and resume scenarios. - Simplified the logic for merging content, ensuring that initialContent is used directly when available, improving clarity and maintainability.
This commit is contained in:
parent
58520017c7
commit
0c05ccc92e
1 changed files with 3 additions and 3 deletions
|
|
@ -239,10 +239,10 @@ export default function useStepHandler({
|
||||||
? lastMessage
|
? lastMessage
|
||||||
: (submission?.initialResponse as TMessage);
|
: (submission?.initialResponse as TMessage);
|
||||||
|
|
||||||
// Preserve existing content from DB (partial response) and prepend initialContent if provided
|
// For edit scenarios, initialContent IS the complete starting content (not to be merged)
|
||||||
|
// For resume scenarios (no editedContent), initialContent is empty and we use existingContent
|
||||||
const existingContent = responseMessage?.content ?? [];
|
const existingContent = responseMessage?.content ?? [];
|
||||||
const mergedContent =
|
const mergedContent = initialContent.length > 0 ? initialContent : existingContent;
|
||||||
initialContent.length > 0 ? [...initialContent, ...existingContent] : existingContent;
|
|
||||||
|
|
||||||
response = {
|
response = {
|
||||||
...responseMessage,
|
...responseMessage,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue