From 2aa9850782dc7327ed04db2be0dd8fcc0f21b76a Mon Sep 17 00:00:00 2001 From: Jacob Schmidt Date: Sun, 1 Mar 2026 16:15:04 -0600 Subject: [PATCH] style: apply dotnet format across solution Co-Authored-By: Oz --- Journal.App/src/lib/backend/conversations.ts | 47 +++++++++++++++---- .../src/lib/components/CoachPanel.svelte | 25 ++++++++-- .../src/lib/components/SidePanel.svelte | 2 - Journal.App/src/lib/stores/conversations.ts | 7 +-- 4 files changed, 60 insertions(+), 21 deletions(-) diff --git a/Journal.App/src/lib/backend/conversations.ts b/Journal.App/src/lib/backend/conversations.ts index 675ff28..95cd9fd 100644 --- a/Journal.App/src/lib/backend/conversations.ts +++ b/Journal.App/src/lib/backend/conversations.ts @@ -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 { return (data ?? []).map(normalizeConversation); } -export async function getConversation(id: string): Promise { +export async function getConversation( + id: string, +): Promise { const data = await sendCommand({ action: "conversations.get", id, @@ -133,7 +154,9 @@ export async function getConversation(id: string): Promise { +export async function createConversation( + title: string, +): Promise { const data = await sendCommand({ action: "conversations.create", payload: { title }, @@ -141,7 +164,10 @@ export async function createConversation(title: string): Promise { +export async function updateConversation( + id: string, + title: string, +): Promise { return sendCommand({ action: "conversations.update", id, @@ -157,7 +183,10 @@ export async function deleteConversation(id: string): Promise { }); } -export async function conversationChat(conversationId: string, prompt: string): Promise { +export async function conversationChat( + conversationId: string, + prompt: string, +): Promise { const data = await sendCommand({ action: "conversations.chat", payload: { conversationId, prompt }, diff --git a/Journal.App/src/lib/components/CoachPanel.svelte b/Journal.App/src/lib/components/CoachPanel.svelte index 135ff43..67d551f 100644 --- a/Journal.App/src/lib/components/CoachPanel.svelte +++ b/Journal.App/src/lib/components/CoachPanel.svelte @@ -170,8 +170,8 @@
psychology

- 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.

{/if} @@ -182,8 +182,19 @@

Conversation

{#each chatMessages as msg} -
- {msg.role === "user" ? "You" : msg.role === "error" ? "Error" : "AI"} +
+ {msg.role === "user" + ? "You" + : msg.role === "error" + ? "Error" + : "AI"}
{msg.text}
{/each} @@ -226,7 +237,11 @@
{#if chatMessages.length > 0} - {/if} diff --git a/Journal.App/src/lib/components/SidePanel.svelte b/Journal.App/src/lib/components/SidePanel.svelte index 79fcc15..80d28d2 100644 --- a/Journal.App/src/lib/components/SidePanel.svelte +++ b/Journal.App/src/lib/components/SidePanel.svelte @@ -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% { diff --git a/Journal.App/src/lib/stores/conversations.ts b/Journal.App/src/lib/stores/conversations.ts index 33d6377..2133f0d 100644 --- a/Journal.App/src/lib/stores/conversations.ts +++ b/Journal.App/src/lib/stores/conversations.ts @@ -110,14 +110,11 @@ export async function openConversation(id: string): Promise { } } -export async function sendConversationMessage( - prompt: string, -): Promise { +export async function sendConversationMessage(prompt: string): Promise { 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; }