refactor: title generation logic

- Changed the title generation endpoint from POST to GET, allowing for more efficient retrieval of titles based on conversation ID.
- Implemented exponential backoff for title fetching retries, improving responsiveness and reducing server load.
- Introduced a queuing mechanism for title generation, ensuring titles are generated only after job completion.
- Updated relevant components and hooks to utilize the new title generation logic, enhancing user experience and application performance.
This commit is contained in:
Danny Avila 2025-12-17 17:10:14 -05:00
parent 24263c9874
commit c7bc5548bc
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
9 changed files with 118 additions and 97 deletions

View file

@ -101,7 +101,8 @@ export const conversations = (params: q.ConversationListParams) => {
export const conversationById = (id: string) => `${conversationsRoot}/${id}`;
export const genTitle = () => `${conversationsRoot}/gen_title`;
export const genTitle = (conversationId: string) =>
`${conversationsRoot}/gen_title/${encodeURIComponent(conversationId)}`;
export const updateConversation = () => `${conversationsRoot}/update`;

View file

@ -724,7 +724,7 @@ export function archiveConversation(
}
export function genTitle(payload: m.TGenTitleRequest): Promise<m.TGenTitleResponse> {
return request.post(endpoints.genTitle(), payload);
return request.get(endpoints.genTitle(payload.conversationId));
}
export const listMessages = (params?: q.MessagesListParams): Promise<q.MessagesListResponse> => {