Resolving Title Generation Issues in ChatGPT Next Web with OpenAI Key Limited to GPT-4o Only

Encountered issues with conversation title generation in ChatGPT Next Web after switching to GPT-4o? Learn how to resolve it by modifying the default model or using custom models, ensuring titles are generated correctly even without GPT-3.5 support.

Resolving Title Generation Issues in ChatGPT Next Web with OpenAI Key Limited to GPT-4o Only

I am using the ChatGPT Next Web application along with an OpenAI key to utilize ChatGPT. This service is accessible through a web browser and also via the NextChat desktop app. I primarily use the desktop app. However, after updating my OpenAI key to use GPT-4o exclusively, I encountered an issue where conversation titles were not being generated successfully. Instead, all titles defaulted to "New Conversation."

Investigation

To address this issue, I examined the code and found the following function:

function getSummarizeModel(currentModel: string) {
  // if it is using gpt-* models, force to use 3.5 to summarize
  if (currentModel.startsWith("gpt")) {
    const configStore = useAppConfig.getState();
    const accessStore = useAccessStore.getState();
    const allModel = collectModelsWithDefaultModel(
      configStore.models,
      [configStore.customModels, accessStore.customModels].join(","),
      accessStore.defaultModel,
    );
    const summarizeModel = allModel.find(
      (m) => m.name === SUMMARIZE_MODEL && m.available,
    );
    return summarizeModel?.name ?? currentModel;
  }
  if (currentModel.startsWith("gemini")) {
    return GEMINI_SUMMARIZE_MODEL;
  }
  return currentModel;
}

From this code, it's clear that the application defaults to using gpt-3.5 for summarization. Since my key only supports gpt-4o, the summarization process failed, resulting in the issue with title generation.

Web App Solution

Solution 1: Modify Default Model

Since I am running the web service from the source code, I changed the default model to gpt-4o. After making this change, I restarted the application and cleared all chats from my browser. This resolved the issue, and titles were generated successfully.

The path for setting the default model is app/constant.ts, at line 122. The update is as follows:

// export const SUMMARIZE_MODEL = "gpt-3.5-turbo";
export const SUMMARIZE_MODEL = "gpt-4o";
export const GEMINI_SUMMARIZE_MODEL = "gemini-pro";

Solution 2: Use Custom Models

Upon deeper investigation, I found that I could force the application to use gpt-4o by setting custom models. This approach eliminates the need to modify the source code directly.

Add the following line to your .env.local file:

CUSTOM_MODELS=-all,+gpt-4o

With this change, the application will use the current model, bypassing the default model setting.

Desktop App Solution

ChatGPT Next Web also offers a desktop application built with Tauri. I wasn't sure how to pass the CUSTOM_MODELS configuration to the desktop app. Therefore, I updated the code to use gpt-4o and rebuilt the application using the following command:

yarn app:build

After installing the app built from the source, the title generation issue was resolved.

Conclusion

I hope this article helps anyone facing the same problem with title generation in ChatGPT Next Web when the OpenAI key uses models without gpt-3.5, such as when using gpt-4o exclusively. By either modifying the default model or using custom models, you can ensure that conversation titles are generated correctly.