Skip to content

Commit

Permalink
Merge pull request #194 from iceljc/features/refine-chat-window
Browse files Browse the repository at this point in the history
refine knowledge page and agent page
  • Loading branch information
iceljc authored Aug 15, 2024
2 parents 74732ef + a55cfeb commit a869467
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
5 changes: 1 addition & 4 deletions src/lib/scss/custom/pages/_agent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,10 @@

.agent-detail-sections {
.section-min-width {
min-width: 200px;
min-width: 300px;
}

.agent-detail-section {
height: 800px;
margin-top: 10px;

@media (max-width: 423px) {
height: fit-content;
}
Expand Down
24 changes: 11 additions & 13 deletions src/routes/page/agent/[agentId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,26 @@
{#if agent}
<Row class="agent-detail-sections">
<Col class="section-min-width" style="flex: 30%;">
<div class="agent-detail-section agent-detail-overflow">
<Col class="section-min-width agent-overview" style="flex: 35%;">
<div class="agent-detail-section">
<AgentOverview agent={agent} profiles={agent.profiles || []} utilities={agent.utilities || []} />
</div>
</Col>
<Col class="section-min-width" style="flex: 40%; ">
<div class="agent-detail-section">
<AgentPrompt agent={agent} />
</div>
</Col>
<Col class="section-min-width" style="flex: 30%;">
<div class="agent-detail-section agent-detail-overflow">
<AgentLlmConfig agent={agent} />
{#if agent.routing_rules?.length > 0}
<AgentRouting agent={agent} />
{/if}
</div>
</Col>
</Row>
<Row class="mt-3">
<AgentFunction bind:this={agentFunctionCmp} agent={agent} />
<Col class="section-min-width" style="flex: 65%;">
<div class="agent-detail-section">
<AgentPrompt agent={agent} />
</div>
<div class="agent-detail-section">
<AgentFunction bind:this={agentFunctionCmp} agent={agent} />
</div>
</Col>
</Row>
{#if !!agent?.editable}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/page/agent/[agentId]/agent-function.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { JSONEditor } from 'svelte-jsoneditor';
import { JSONEditor, Mode } from 'svelte-jsoneditor';
import { onMount } from 'svelte';
/** @type {import('$types').AgentModel} */
Expand Down Expand Up @@ -35,7 +35,7 @@
</script>

<div class="my-json-editor">
<JSONEditor content={content} onChange={handleChange} />
<JSONEditor mode={Mode.table} content={content} onChange={handleChange} />
</div>

<style>
Expand Down
8 changes: 6 additions & 2 deletions src/routes/page/knowledge-base/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
let text = "";
let isSearching = false;
let searchDone = false;
let isFromSearch = false;
let successText = "Done";
let errorText = "Error";
Expand Down Expand Up @@ -58,11 +59,13 @@
items = [];
isSearching = true;
searchDone = false;
isFromSearch = false;
searchKnowledge({
text: util.trim(text),
confidence: confidence
}, selectedCollection).then(res => {
items = res || [];
isFromSearch = true;
}).finally(() => {
isSearching = false;
searchDone = true;
Expand All @@ -88,6 +91,7 @@
nextId = null;
isSearching = false;
searchDone = false;
isFromSearch = false;
initData(nextId, true);
}
Expand Down Expand Up @@ -324,8 +328,8 @@
</tr>
</thead>
<tbody>
{#each items as item}
<KnowledgeItem data={item} on:delete={(e) => afterKnowledgeDeleted(e)} />
{#each items as item, idx (idx)}
<KnowledgeItem data={item} open={isFromSearch && idx === 0} on:delete={(e) => afterKnowledgeDeleted(e)} />
{/each}
</tbody>
</Table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
export let data;
/** @type {boolean} */
let open = false;
export let open = false;
let isLoading = false;
function toggleItem() {
Expand Down Expand Up @@ -102,28 +103,28 @@
{#if open}
<tr in:fly={{ y: -5, duration: 800 }} out:fly={{ y: -5, duration: 300 }}>
<td colspan="3">
<div class="knowledge-detail">
<ul>
{#if data?.data?.question || data?.data?.text}
<li>
<div class="wrappable fw-bold text-primary">Question:</div>
<div class="wrappable">{data?.data?.question || data?.data?.text || ''}</div>
</li>
{/if}
{#if data?.data?.answer}
<li>
<div class="wrappable fw-bold text-primary">Answer:</div>
<div class="wrappable">{data?.data?.answer || ''}</div>
</li>
{/if}
{#if data?.score}
<li>
<div class="wrappable fw-bold text-primary">Score:</div>
<div class="wrappable">{data?.score?.toFixed(3)}</div>
</li>
{/if}
</ul>
</div>
<div class="knowledge-detail">
<ul>
{#if data?.data?.question || data?.data?.text}
<li>
<div class="wrappable fw-bold text-primary">Question:</div>
<div class="wrappable">{data?.data?.question || data?.data?.text || ''}</div>
</li>
{/if}
{#if data?.data?.answer}
<li>
<div class="wrappable fw-bold text-primary">Answer:</div>
<div class="wrappable">{data?.data?.answer || ''}</div>
</li>
{/if}
{#if data?.score}
<li>
<div class="wrappable fw-bold text-primary">Score:</div>
<div class="wrappable">{data?.score?.toFixed(3)}</div>
</li>
{/if}
</ul>
</div>
</td>
</tr>
{/if}

0 comments on commit a869467

Please sign in to comment.