adds ability to star chats

This commit is contained in:
2026-05-28 22:47:45 -07:00
parent cb8ea935fa
commit a6c2ec664b
16 changed files with 779 additions and 145 deletions

View File

@@ -3,6 +3,8 @@ export type ChatSummary = {
title: string | null;
createdAt: string;
updatedAt: string;
starred: boolean;
starredAt: string | null;
initiatedProvider: Provider | null;
initiatedModel: string | null;
lastUsedProvider: Provider | null;
@@ -15,6 +17,8 @@ export type SearchSummary = {
query: string | null;
createdAt: string;
updatedAt: string;
starred: boolean;
starredAt: string | null;
};
export type ChatWorkspaceItem = ChatSummary & {
@@ -54,6 +58,8 @@ export type ChatDetail = {
title: string | null;
createdAt: string;
updatedAt: string;
starred: boolean;
starredAt: string | null;
initiatedProvider: Provider | null;
initiatedModel: string | null;
lastUsedProvider: Provider | null;
@@ -83,6 +89,8 @@ export type SearchDetail = {
query: string | null;
createdAt: string;
updatedAt: string;
starred: boolean;
starredAt: string | null;
requestId: string | null;
latencyMs: number | null;
error: string | null;
@@ -263,6 +271,14 @@ export async function updateChatTitle(chatId: string, title: string) {
return data.chat;
}
export async function updateChatStar(chatId: string, starred: boolean) {
const data = await api<{ chat: ChatSummary }>(`/v1/chats/${chatId}/star`, {
method: "PATCH",
body: JSON.stringify({ starred }),
});
return data.chat;
}
export async function suggestChatTitle(body: { chatId: string; content: string }) {
const data = await api<{ chat: ChatSummary }>("/v1/chats/title/suggest", {
method: "POST",
@@ -293,6 +309,14 @@ export async function getSearch(searchId: string) {
return data.search;
}
export async function updateSearchStar(searchId: string, starred: boolean) {
const data = await api<{ search: SearchSummary }>(`/v1/searches/${searchId}/star`, {
method: "PATCH",
body: JSON.stringify({ starred }),
});
return data.search;
}
export async function createChatFromSearch(searchId: string, body?: { title?: string }) {
const data = await api<{ chat: ChatSummary }>(`/v1/searches/${searchId}/chat`, {
method: "POST",