style: apply dotnet format across solution
Co-Authored-By: Oz <oz-agent@warp.dev>
This commit is contained in:
parent
192e6e3891
commit
2aa9850782
@ -76,7 +76,9 @@ type ConversationChatResultRaw = {
|
||||
|
||||
// ── Normalizers ─────────────────────────────────────────────────
|
||||
|
||||
function normalizeMessage(raw: ConversationMessageDtoRaw): ConversationMessageDto {
|
||||
function normalizeMessage(
|
||||
raw: ConversationMessageDtoRaw,
|
||||
): ConversationMessageDto {
|
||||
return {
|
||||
id: pickCase(raw, "id", "Id", ""),
|
||||
role: pickCase(raw, "role", "Role", ""),
|
||||
@ -95,7 +97,12 @@ function normalizeConversation(raw: ConversationDtoRaw): ConversationDto {
|
||||
}
|
||||
|
||||
function normalizeDetail(raw: ConversationDetailDtoRaw): ConversationDetailDto {
|
||||
const msgs = pickCase(raw, "messages", "Messages", [] as ConversationMessageDtoRaw[]);
|
||||
const msgs = pickCase(
|
||||
raw,
|
||||
"messages",
|
||||
"Messages",
|
||||
[] as ConversationMessageDtoRaw[],
|
||||
);
|
||||
return {
|
||||
id: pickCase(raw, "id", "Id", ""),
|
||||
title: pickCase(raw, "title", "Title", ""),
|
||||
@ -105,9 +112,21 @@ function normalizeDetail(raw: ConversationDetailDtoRaw): ConversationDetailDto {
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeChatResult(raw: ConversationChatResultRaw): ConversationChatResult {
|
||||
const userRaw = pickCase(raw, "userMessage", "UserMessage", {} as ConversationMessageDtoRaw);
|
||||
const assistantRaw = pickCase(raw, "assistantMessage", "AssistantMessage", {} as ConversationMessageDtoRaw);
|
||||
function normalizeChatResult(
|
||||
raw: ConversationChatResultRaw,
|
||||
): ConversationChatResult {
|
||||
const userRaw = pickCase(
|
||||
raw,
|
||||
"userMessage",
|
||||
"UserMessage",
|
||||
{} as ConversationMessageDtoRaw,
|
||||
);
|
||||
const assistantRaw = pickCase(
|
||||
raw,
|
||||
"assistantMessage",
|
||||
"AssistantMessage",
|
||||
{} as ConversationMessageDtoRaw,
|
||||
);
|
||||
return {
|
||||
userMessage: normalizeMessage(userRaw),
|
||||
assistantMessage: normalizeMessage(assistantRaw),
|
||||
@ -124,7 +143,9 @@ export async function listConversations(): Promise<ConversationDto[]> {
|
||||
return (data ?? []).map(normalizeConversation);
|
||||
}
|
||||
|
||||
export async function getConversation(id: string): Promise<ConversationDetailDto> {
|
||||
export async function getConversation(
|
||||
id: string,
|
||||
): Promise<ConversationDetailDto> {
|
||||
const data = await sendCommand<ConversationDetailDtoRaw>({
|
||||
action: "conversations.get",
|
||||
id,
|
||||
@ -133,7 +154,9 @@ export async function getConversation(id: string): Promise<ConversationDetailDto
|
||||
return normalizeDetail(data);
|
||||
}
|
||||
|
||||
export async function createConversation(title: string): Promise<ConversationDto> {
|
||||
export async function createConversation(
|
||||
title: string,
|
||||
): Promise<ConversationDto> {
|
||||
const data = await sendCommand<ConversationDtoRaw>({
|
||||
action: "conversations.create",
|
||||
payload: { title },
|
||||
@ -141,7 +164,10 @@ export async function createConversation(title: string): Promise<ConversationDto
|
||||
return normalizeConversation(data);
|
||||
}
|
||||
|
||||
export async function updateConversation(id: string, title: string): Promise<boolean> {
|
||||
export async function updateConversation(
|
||||
id: string,
|
||||
title: string,
|
||||
): Promise<boolean> {
|
||||
return sendCommand<boolean>({
|
||||
action: "conversations.update",
|
||||
id,
|
||||
@ -157,7 +183,10 @@ export async function deleteConversation(id: string): Promise<boolean> {
|
||||
});
|
||||
}
|
||||
|
||||
export async function conversationChat(conversationId: string, prompt: string): Promise<ConversationChatResult> {
|
||||
export async function conversationChat(
|
||||
conversationId: string,
|
||||
prompt: string,
|
||||
): Promise<ConversationChatResult> {
|
||||
const data = await sendCommand<ConversationChatResultRaw>({
|
||||
action: "conversations.chat",
|
||||
payload: { conversationId, prompt },
|
||||
|
||||
@ -170,8 +170,8 @@
|
||||
<div class="coach-empty">
|
||||
<span class="material-symbols-outlined empty-icon">psychology</span>
|
||||
<p>
|
||||
Select a coaching session from the sidebar, or ask a question using
|
||||
the input below.
|
||||
Select a coaching session from the sidebar, or ask a question using the
|
||||
input below.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
@ -182,8 +182,19 @@
|
||||
<h3>Conversation</h3>
|
||||
<div class="chat-messages">
|
||||
{#each chatMessages as msg}
|
||||
<div class="chat-msg" class:chat-user={msg.role === "user"} class:chat-assistant={msg.role === "assistant"} class:chat-error={msg.role === "error"}>
|
||||
<span class="chat-role">{msg.role === "user" ? "You" : msg.role === "error" ? "Error" : "AI"}</span>
|
||||
<div
|
||||
class="chat-msg"
|
||||
class:chat-user={msg.role === "user"}
|
||||
class:chat-assistant={msg.role === "assistant"}
|
||||
class:chat-error={msg.role === "error"}
|
||||
>
|
||||
<span class="chat-role"
|
||||
>{msg.role === "user"
|
||||
? "You"
|
||||
: msg.role === "error"
|
||||
? "Error"
|
||||
: "AI"}</span
|
||||
>
|
||||
<div class="chat-text">{msg.text}</div>
|
||||
</div>
|
||||
{/each}
|
||||
@ -226,7 +237,11 @@
|
||||
</button>
|
||||
</div>
|
||||
{#if chatMessages.length > 0}
|
||||
<button type="button" class="chat-clear-btn" on:click={clearActiveConversation}>
|
||||
<button
|
||||
type="button"
|
||||
class="chat-clear-btn"
|
||||
on:click={clearActiveConversation}
|
||||
>
|
||||
Clear Chat
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@ -195,7 +195,6 @@
|
||||
editingConversationTitle = "";
|
||||
}
|
||||
|
||||
|
||||
const today = new Date();
|
||||
let calendarYear = today.getFullYear();
|
||||
let calendarMonth = today.getMonth();
|
||||
@ -1990,7 +1989,6 @@
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
||||
@keyframes coach-pulse {
|
||||
0%,
|
||||
100% {
|
||||
|
||||
@ -110,14 +110,11 @@ export async function openConversation(id: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function sendConversationMessage(
|
||||
prompt: string,
|
||||
): Promise<void> {
|
||||
export async function sendConversationMessage(prompt: string): Promise<void> {
|
||||
const state = get(activeConversationStore);
|
||||
if (!state.id) {
|
||||
// Auto-create a conversation from the first message
|
||||
const title =
|
||||
prompt.length > 40 ? prompt.slice(0, 37) + "..." : prompt;
|
||||
const title = prompt.length > 40 ? prompt.slice(0, 37) + "..." : prompt;
|
||||
const convId = await createNewConversation(title);
|
||||
if (!convId) return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user