improv: get chat titles enabled by default

This commit is contained in:
tomasz-io 2024-11-06 21:38:38 +07:00
parent f60009c2ea
commit 8181c2a7cf
4 changed files with 13 additions and 13 deletions

View file

@ -134,6 +134,10 @@ function loadSerializedConfig(
config.allowAnonymousTelemetry = true;
}
if (config.getChatTitles === undefined) {
config.getChatTitles = true;
}
if (ideSettings.remoteConfigServerUrl) {
try {
const remoteConfigJson = resolveSerializedConfig(
@ -511,6 +515,7 @@ function finalToBrowserConfig(
embeddingsProvider: final.embeddingsProvider?.id,
ui: final.ui,
experimental: final.experimental,
getChatTitles: final.getChatTitles,
};
}

8
core/index.d.ts vendored
View file

@ -978,11 +978,6 @@ interface ExperimentalConfig {
*/
readResponseTTS?: boolean;
/**
* Prompt the user's LLM for a title given the current chat content
*/
getChatTitles?: boolean;
/**
* If set to true, we will attempt to pull down and install an instance of Chromium
* that is compatible with the current version of Puppeteer.
@ -1019,6 +1014,7 @@ export interface SerializedContinueConfig {
experimental?: ExperimentalConfig;
analytics?: AnalyticsConfig;
docs?: SiteIndexingConfig[];
getChatTitles?: boolean;
}
export type ConfigMergeType = "merge" | "overwrite";
@ -1093,6 +1089,7 @@ export interface ContinueConfig {
experimental?: ExperimentalConfig;
analytics?: AnalyticsConfig;
docs?: SiteIndexingConfig[];
getChatTitles?: boolean;
}
export interface BrowserSerializedContinueConfig {
@ -1111,4 +1108,5 @@ export interface BrowserSerializedContinueConfig {
reranker?: RerankerDescription;
experimental?: ExperimentalConfig;
analytics?: AnalyticsConfig;
getChatTitles?: boolean;
}

View file

@ -40,7 +40,7 @@ export class ChatDescriber {
return;
}
completionOptions.maxTokens = 24;
completionOptions.maxTokens = 6;
// Prompt the user's current LLM for the title
const titleResponse = await model.chat(

View file

@ -54,16 +54,13 @@ function useHistory(dispatch: Dispatch) {
if (state.history.length === 0) return;
const stateCopy = { ...state };
if (open_new_session){
if (open_new_session) {
dispatch(newSession());
updateLastSessionId(stateCopy.sessionId);
}
await new Promise((resolve) => setTimeout(resolve, 10));
if (
state.config?.experimental?.getChatTitles &&
stateCopy.title === "New Session"
) {
if (state.config?.getChatTitles && stateCopy.title === "New Session") {
try {
// Check if we have first assistant response
let assistantResponse = stateCopy.history
@ -89,8 +86,8 @@ function useHistory(dispatch: Dispatch) {
MAX_TITLE_LENGTH,
)
: stateCopy.title?.length > 0
? stateCopy.title
: (await getSession(stateCopy.sessionId)).title; // to ensure titles are synced with updates from history page.
? stateCopy.title
: (await getSession(stateCopy.sessionId)).title; // to ensure titles are synced with updates from history page.
const sessionInfo: PersistedSessionInfo = {
history: stateCopy.history,