Add per-chat settings UI in web app for additional system prompt and tool checkboxes

This commit is contained in:
Agent
2026-05-24 22:04:05 +00:00
parent 93e34d086f
commit f3bb8503aa
9 changed files with 282 additions and 28 deletions

View File

@@ -7,6 +7,8 @@ export type ChatSummary = {
initiatedModel: string | null;
lastUsedProvider: Provider | null;
lastUsedModel: string | null;
additionalSystemPrompt: string | null;
enabledTools: string[] | null;
};
export type SearchSummary = {
@@ -58,6 +60,8 @@ export type ChatDetail = {
initiatedModel: string | null;
lastUsedProvider: Provider | null;
lastUsedModel: string | null;
additionalSystemPrompt: string | null;
enabledTools: string[] | null;
messages: Message[];
};
@@ -149,6 +153,11 @@ export type ModelCatalogResponse = {
providers: Partial<Record<Provider, ProviderModelInfo>>;
};
export type ChatToolInfo = {
name: string;
description: string;
};
export type ActiveRunsResponse = {
chats: string[];
searches: string[];
@@ -174,6 +183,8 @@ type CreateChatRequest = {
title?: string;
provider?: Provider;
model?: string;
additionalSystemPrompt?: string;
enabledTools?: string[];
messages?: CompletionRequestMessage[];
};
@@ -237,6 +248,11 @@ export async function listModels() {
return api<ModelCatalogResponse>("/v1/models");
}
export async function listChatTools() {
const data = await api<{ tools: ChatToolInfo[] }>("/v1/chat-tools");
return data.tools;
}
export async function getActiveRuns() {
return api<ActiveRunsResponse>("/v1/active-runs");
}
@@ -263,6 +279,14 @@ export async function updateChatTitle(chatId: string, title: string) {
return data.chat;
}
export async function updateChatSettings(chatId: string, body: { additionalSystemPrompt?: string | null; enabledTools?: string[] }) {
const data = await api<{ chat: ChatSummary }>(`/v1/chats/${chatId}`, {
method: "PATCH",
body: JSON.stringify(body),
});
return data.chat;
}
export async function suggestChatTitle(body: { chatId: string; content: string }) {
const data = await api<{ chat: ChatSummary }>("/v1/chats/title/suggest", {
method: "POST",
@@ -569,6 +593,8 @@ export async function runCompletion(body: {
provider: Provider;
model: string;
messages: CompletionRequestMessage[];
additionalSystemPrompt?: string;
enabledTools?: string[];
userLocation?: string;
}) {
return api<CompletionResponse>("/v1/chat-completions", {
@@ -584,6 +610,8 @@ export async function runCompletionStream(
provider: Provider;
model: string;
messages: CompletionRequestMessage[];
additionalSystemPrompt?: string;
enabledTools?: string[];
userLocation?: string;
},
handlers: CompletionStreamHandlers,