janhq / jan

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer. Multiple engine support (llama.cpp, TensorRT-LLM)
https://jan.ai/
GNU Affero General Public License v3.0
23.74k stars 1.38k forks source link

fix: 4086 - editing message should not send follow-up messages #4116

Closed louis-jan closed 10 hours ago

louis-jan commented 11 hours ago

Describe Your Changes

When editing a message, for instance, "A of A _ B _C," it sends "A B C A" instead of just "A."

CleanShot 2024-11-25 at 17 32 16@2x

Fixes Issues

Changes made

  1. useSendChatMessage.ts:

    • The sendChatMessage function's signature has been updated to accept an optional messages parameter of type ThreadMessage[].
    • When calling requestBuilder.requestThread, if messages is provided, it will be used; otherwise, currentMessages will be used as before.
  2. index.tsx:

    • Within the EditChatInput component, the call to sendChatMessage has been updated to pass newMessages as the second argument, matching the updated function signature.

These changes likely aim to provide more flexibility when sending chat messages by allowing an optional thread message array to be passed to the sendChatMessage function.

github-actions[bot] commented 11 hours ago

Barecheck - Code coverage report

Total: 69.21% Your code coverage diff: 0.00% ▴
Uncovered files and lines
FileLines
web/hooks/useSendChatMessage.ts92-96, 98, 100, 102, 110, 113, 118-119, 121-126, 129-130, 135, 142, 144-146, 149, 151-152, 154, 156-158, 160, 164, 166, 170, 173-174, 180-181, 185, 196, 199, 203, 206, 209, 217, 220, 226, 229-230, 233-239, 242, 245, 248, 251, 254, 259-260
web/screens/Thread/ThreadCenterPanel/EditChatInput/index.tsx40-42, 44-51, 53-54, 57-61, 65-69, 74-75, 79-85, 93, 98-103, 107-108, 141, 149, 157, 160
louis-jan commented 10 hours ago

Feature build: https://github.com/janhq/jan/actions/runs/12009116996