feat: allow renaming of agent chat title (#24489)

Co-authored-by: Coder Agents <noreply@coder.com>
This commit is contained in:
Jaayden Halko
2026-04-20 14:00:46 +01:00
committed by GitHub
co-authored by Coder Agents
parent 18a30a7a10
commit 410f9a5e19
26 changed files with 1911 additions and 297 deletions
+7
View File
@@ -3171,6 +3171,13 @@ class ExperimentalApiMethods {
return response.data;
};
proposeChatTitle = async (chatId: string): Promise<{ title: string }> => {
const response = await this.axios.post<{ title: string }>(
`/api/experimental/chats/${chatId}/title/propose`,
);
return response.data;
};
createChatMessage = async (
chatId: string,
req: CreateChatMessageRequestWithClearablePlanMode,
+32
View File
@@ -826,6 +826,38 @@ export const regenerateChatTitle = (queryClient: QueryClient) => ({
},
});
type UpdateChatTitleVariables = {
chatId: string;
title: string;
};
export const updateChatTitle = (queryClient: QueryClient) => ({
mutationFn: ({ chatId, title }: UpdateChatTitleVariables) =>
API.experimental.updateChat(chatId, { title }),
onSuccess: (_data: unknown, { chatId, title }: UpdateChatTitleVariables) => {
queryClient.setQueryData<TypesGen.Chat | undefined>(
chatKey(chatId),
(chat) => (chat ? { ...chat, title } : chat),
);
updateInfiniteChatsCache(queryClient, (chats) =>
chats.map((chat) => (chat.id === chatId ? { ...chat, title } : chat)),
);
},
onSettled: async (
_data: unknown,
_error: unknown,
{ chatId }: UpdateChatTitleVariables,
) => {
await invalidateChatListQueries(queryClient);
await queryClient.invalidateQueries({
queryKey: chatKey(chatId),
exact: true,
});
},
});
export const createChat = (queryClient: QueryClient) => ({
mutationFn: (req: TypesGen.CreateChatRequest) =>
API.experimental.createChat(req),
+8
View File
@@ -5700,6 +5700,14 @@ export interface PrometheusConfig {
readonly aggregate_agent_stats_by: string;
}
// From codersdk/chats.go
/**
* ProposeChatTitleResponse is returned by the propose-title endpoint.
*/
export interface ProposeChatTitleResponse {
readonly title: string;
}
// From codersdk/deployment.go
export interface ProvisionerConfig {
/**