fix linting errors

This commit is contained in:
Patrick Erichsen 2025-04-08 22:00:54 -07:00
parent ae72f3a293
commit fe97190e40
7 changed files with 14 additions and 16 deletions

View file

@ -82,10 +82,10 @@ export default function StepContainerPreToolbar(
const isNextCodeBlock = nextCodeBlockIndex === props.codeBlockIndex;
const hasFileExtension = /\.[0-9a-z]+$/i.test(props.relativeFilepath);
const defaultModel = useAppSelector(selectSelectedChatModel);
const selectedChatModel = useAppSelector(selectSelectedChatModel);
async function onClickApply() {
if (!defaultModel) {
if (!selectedChatModel) {
return;
}

View file

@ -105,7 +105,7 @@ export function Chat() {
const showSessionTabs = useAppSelector(
(store) => store.config.config.ui?.showSessionTabs,
);
const defaultModel = useAppSelector(selectSelectedChatModel);
const selectedChatModel = useAppSelector(selectSelectedChatModel);
const isStreaming = useAppSelector((state) => state.session.isStreaming);
const [stepsOpen, setStepsOpen] = useState<(boolean | undefined)[]>([]);
const mainTextInputRef = useRef<HTMLInputElement>(null);
@ -165,7 +165,7 @@ export function Chat() {
"Cannot submit message while awaiting tool confirmation",
);
}
if (defaultModel?.provider === "free-trial") {
if (selectedChatModel?.provider === "free-trial") {
const newCount = incrementFreeTrialCount();
if (newCount === FREE_TRIAL_LIMIT_REQUESTS) {
@ -224,7 +224,7 @@ export function Chat() {
},
[
history,
defaultModel,
selectedChatModel,
streamResponse,
isSingleRangeEditOrInsertion,
codeToEdit,
@ -233,7 +233,7 @@ export function Chat() {
);
async function handleSingleRangeEditOrInsertion(editorState: JSONContent) {
if (!defaultModel) {
if (!selectedChatModel) {
console.error("No selected chat model");
return;
}
@ -248,7 +248,7 @@ export function Chat() {
defaultContextProviders: [],
availableSlashCommands: [],
dispatch,
selectedModelTitle: defaultModel.title,
selectedModelTitle: selectedChatModel.title,
});
const prompt = [

View file

@ -32,7 +32,7 @@ export const callTool = createAsyncThunk<void, undefined, ThunkApiType>(
const selectedChatModel = selectSelectedChatModel(state);
if (!defaultModel) {
if (!selectedChatModel) {
throw new Error("No model selected");
}
@ -77,7 +77,7 @@ export const callTool = createAsyncThunk<void, undefined, ThunkApiType>(
} else {
const result = await extra.ideMessenger.request("tools/call", {
toolCall: toolCallState.toolCall,
selectedModelTitle: defaultModel.title,
selectedModelTitle: selectedChatModel.title,
});
if (result.status === "error") {
errorMessage = result.error;

View file

@ -42,7 +42,7 @@ export const gatherContext = createAsyncThunk<
const defaultContextProviders =
state.config.config.experimental?.defaultContext ?? [];
if (!defaultModel) {
if (!selectedChatModel) {
console.error(
"gatherContext thunk: Cannot gather context, no model selected",
);

View file

@ -35,10 +35,10 @@ export const streamNormalInput = createAsyncThunk<
const toolGroupSettings = state.ui.toolGroupSettings;
const streamAborter = state.session.streamAborter;
const useTools = selectUseTools(state);
if (!defaultModel) {
if (!selectedChatModel) {
throw new Error("Default model not defined");
}
const includeTools = useTools && modelSupportsTools(defaultModel);
const includeTools = useTools && modelSupportsTools(selectedChatModel);
// Send request
const gen = extra.ideMessenger.llmStreamChat(

View file

@ -35,11 +35,9 @@ export const streamResponseThunk = createAsyncThunk<
streamThunkWrapper(async () => {
const state = getState();
const selectedChatModel = selectSelectedChatModel(state);
const slashCommands = state.config.config.slashCommands || [];
const inputIndex = index ?? state.session.history.length; // Either given index or concat to end
if (!defaultModel) {
if (!selectedChatModel) {
throw new Error("No chat model selected");
}

View file

@ -29,7 +29,7 @@ export const streamResponseAfterToolCall = createAsyncThunk<
const initialHistory = state.session.history;
const selectedChatModel = selectSelectedChatModel(state);
if (!defaultModel) {
if (!selectedChatModel) {
throw new Error("No model selected");
}