fix(import): keep imported ChatGPT conversations on a configured model

default_model_slug is a historical ChatGPT identifier - auto, research,
gpt-5-t - that no endpoint serves, and it was being written as the
conversation's own model, which is what the next prompt is sent with. The
messages keep their historical slug for display; the conversation resolves
to the configured default, as the Claude and Grok converters already do.
This commit is contained in:
Marco Beretta 2026-07-29 02:28:15 +02:00
parent 884d2d3235
commit fdd0a9ce65
No known key found for this signature in database
GPG key ID: D918033D8E74CC11
2 changed files with 14 additions and 5 deletions

View file

@ -25,7 +25,7 @@ const OPTIONS = {
};
describe('convertConversation', () => {
it('carries archive, pin, model, and external id onto the conversation', () => {
it('carries archive, pin, and external id onto the conversation, on the configured model', () => {
const result = convertConversation(
conversation({
root: { id: 'root', message: null, parent: null, children: ['a'] },
@ -46,7 +46,10 @@ describe('convertConversation', () => {
expect(result.isArchived).toBe(true);
expect(result.pinned).toBe(true);
expect(result.model).toBe('gpt-5-thinking');
/** Not `default_model_slug` ('gpt-5-thinking'): the conversation's model is
* what its next prompt is sent with, and a historical ChatGPT slug is not a
* model any endpoint serves. */
expect(result.model).toBe('gpt-4o');
expect(result.externalId).toBe('ext-1');
expect(result.title).toBe('Trip planning');
});

View file

@ -210,8 +210,6 @@ export function convertConversation(
orderTree(messages);
const { model } = resolveModel(conv.default_model_slug ?? undefined, options.defaultModel);
return {
conversationId: uuidv4(),
externalId: conv.conversation_id,
@ -219,7 +217,15 @@ export function convertConversation(
createdAt: new Date(fallbackTime),
isArchived: conv.is_archived === true,
pinned: conv.is_starred === true || conv.pinned_time != null,
model,
/** The conversation's model is what its *next* prompt is sent with, so it
* has to be a model this deployment actually serves. `default_model_slug`
* is a historical ChatGPT identifier `auto`, `research`, `gpt-5-t` that
* no endpoint accepts, and setting it here would leave every imported
* conversation unusable until the user picked a model by hand. The
* per-message `model` keeps the historical slug for display, which is
* where it belongs; the Claude and Grok converters resolve this field the
* same way. */
model: options.defaultModel,
messages,
};
}