Merge pull request #3374 from continuedev/dallin/save-fixes
Only save in chat mode, handle chat describer errors
This commit is contained in:
commit
4368bf9698
2 changed files with 22 additions and 15 deletions
|
|
@ -174,15 +174,19 @@ export const saveCurrentSession = createAsyncThunk<
|
|||
?.message?.content?.toString();
|
||||
|
||||
if (assistantResponse) {
|
||||
const result = await extra.ideMessenger.request(
|
||||
"chatDescriber/describe",
|
||||
{
|
||||
text: assistantResponse,
|
||||
selectedModelTitle: state.config.defaultModelTitle,
|
||||
},
|
||||
);
|
||||
if (result.status === "success" && result.content) {
|
||||
title = result.content;
|
||||
try {
|
||||
const result = await extra.ideMessenger.request(
|
||||
"chatDescriber/describe",
|
||||
{
|
||||
text: assistantResponse,
|
||||
selectedModelTitle: state.config.defaultModelTitle,
|
||||
},
|
||||
);
|
||||
if (result.status === "success" && result.content) {
|
||||
title = result.content;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error generating chat title", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export const streamThunkWrapper = createAsyncThunk<
|
|||
void,
|
||||
() => Promise<void>,
|
||||
ThunkApiType
|
||||
>("chat/streamWrapper", async (runStream, { dispatch, extra }) => {
|
||||
>("chat/streamWrapper", async (runStream, { dispatch, extra, getState }) => {
|
||||
try {
|
||||
await runStream();
|
||||
} catch (e: any) {
|
||||
|
|
@ -16,10 +16,13 @@ export const streamThunkWrapper = createAsyncThunk<
|
|||
dispatch(clearLastEmptyResponse());
|
||||
} finally {
|
||||
dispatch(setInactive());
|
||||
await dispatch(
|
||||
saveCurrentSession({
|
||||
openNewSession: false,
|
||||
}),
|
||||
);
|
||||
const state = getState();
|
||||
if (state.session.mode === "chat") {
|
||||
await dispatch(
|
||||
saveCurrentSession({
|
||||
openNewSession: false,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue