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