-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into markdown-support
- Loading branch information
Showing
8 changed files
with
224 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script lang="ts"> | ||
import { Modal, TabItem, Tabs } from 'flowbite-svelte'; | ||
import Chatroom from '$lib/components/Chatroom.svelte'; | ||
import Summary from './Summary.svelte'; | ||
import type { Conversation } from '$lib/schema/conversation'; | ||
let { | ||
open = $bindable(false), | ||
participant = null, | ||
conversation, | ||
readonly = true | ||
} = $props<{ | ||
open: boolean; | ||
participant: { | ||
displayName: string; | ||
history: Array<{ | ||
name: string; | ||
content: string; | ||
self?: boolean; | ||
audio?: string; | ||
avatar?: string; | ||
}>; | ||
} | null; | ||
conversation: { | ||
data: Conversation; | ||
id: string; | ||
}; | ||
readonly?: boolean; | ||
}>(); | ||
let loadingSummary = $state(false); | ||
</script> | ||
|
||
{#if open && participant} | ||
<Modal bind:open size="xl" outsideclose class="w-full"> | ||
<div class="mb-4"> | ||
<h3 class="text-xl font-semibold"> | ||
{participant.displayName} 的對話記錄 | ||
</h3> | ||
</div> | ||
|
||
<Tabs style="underline"> | ||
<TabItem open title="對話歷史"> | ||
<div class="messages h-[400px] overflow-y-auto rounded-lg border border-gray-200 p-4"> | ||
<Chatroom readonly conversations={participant.history} /> | ||
</div> | ||
</TabItem> | ||
<TabItem title="對話總結"> | ||
<div class="h-[400px] overflow-y-auto rounded-lg border border-gray-200 p-4"> | ||
<Summary | ||
{conversation} | ||
loading={loadingSummary} | ||
onRefresh={() => Promise.resolve()} | ||
{readonly} | ||
/> | ||
</div> | ||
</TabItem> | ||
</Tabs> | ||
</Modal> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<script lang="ts"> | ||
import type { Conversation } from '$lib/schema/conversation'; | ||
export let conversation: { | ||
data: Conversation; | ||
id: string; | ||
}; | ||
export let loading: boolean; | ||
export let onRefresh: () => Promise<void>; | ||
export let readonly = false; | ||
$: summaryData = conversation.data.summary | ||
? { | ||
summary: conversation.data.summary, | ||
keyPoints: conversation.data.keyPoints || [] | ||
} | ||
: null; | ||
</script> | ||
|
||
<div class="space-y-6 p-6"> | ||
<div class="flex items-center justify-between"> | ||
<h2 class="text-xl font-semibold">對話總結</h2> | ||
{#if !readonly} | ||
<button | ||
class="rounded-lg bg-blue-500 px-4 py-2 text-white hover:bg-blue-600 disabled:opacity-50" | ||
on:click={onRefresh} | ||
disabled={loading} | ||
> | ||
{#if loading} | ||
更新中... | ||
{:else} | ||
更新總結 | ||
{/if} | ||
</button> | ||
{/if} | ||
</div> | ||
|
||
{#if summaryData} | ||
<div class="space-y-4"> | ||
<div> | ||
<h3 class="mb-2 font-medium">總結內容:</h3> | ||
<p class="rounded-lg bg-gray-50 p-4 text-gray-700">{summaryData.summary}</p> | ||
</div> | ||
|
||
{#if summaryData.keyPoints.length > 0} | ||
<div> | ||
<h3 class="mb-2 font-medium">關鍵重點:</h3> | ||
<ul class="list-inside list-disc space-y-2"> | ||
{#each summaryData.keyPoints as point} | ||
<li class="text-gray-700">{point}</li> | ||
{/each} | ||
</ul> | ||
</div> | ||
{/if} | ||
</div> | ||
{:else if loading} | ||
<div class="text-center text-gray-600"> | ||
<p>正在生成總結,請稍候...</p> | ||
</div> | ||
{:else} | ||
<div class="text-center text-gray-600"> | ||
<p>點擊上方按鈕生成對話總結</p> | ||
</div> | ||
{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters