Skip to content

Commit

Permalink
refactor(continue): add selected context in slash command (continuede…
Browse files Browse the repository at this point in the history
…v#1919)

Signed-off-by: Vijai Sivakumar <[email protected]>
  • Loading branch information
vijaisivakumar authored Aug 9, 2024
1 parent eabcdd1 commit 0b528a2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gui/src/hooks/useChatHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ChatHistory,
ChatHistoryItem,
ChatMessage,
ContextItemWithId,
InputModifiers,
MessageContent,
PromptLog,
Expand All @@ -22,6 +23,7 @@ import { IIdeMessenger } from "../context/IdeMessenger";
import { defaultModelSelector } from "../redux/selectors/modelSelectors";
import {
addPromptCompletionPair,
addContextItems,
clearLastResponse,
initNewActiveMessage,
resubmitAtIndex,
Expand Down Expand Up @@ -115,6 +117,7 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) {
input: string,
historyIndex: number,
selectedCode: RangeInFile[],
contextItems: ContextItemWithId[],
) {
const abortController = new AbortController();
const cancelToken = abortController.signal;
Expand Down Expand Up @@ -171,6 +174,7 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) {
modifiers,
ideMessenger,
);
dispatch(addContextItems(contextItems));

// Automatically use currently open file
if (!modifiers.noContext && (history.length === 0 || index === 0)) {
Expand Down Expand Up @@ -252,6 +256,7 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) {
commandInput,
historyIndex,
selectedCode,
contextItems,
);
}
} catch (e) {
Expand Down

0 comments on commit 0b528a2

Please sign in to comment.