Skip to content

Commit 131ec53

Browse files
authored
Merge pull request #320 from iceljc/features/refine-chat-window
refine instruction log
2 parents c0e4c4b + c78893a commit 131ec53

File tree

9 files changed

+33
-21
lines changed

9 files changed

+33
-21
lines changed

src/lib/common/markdown/Markdown.svelte

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
1717
let innerText = '';
1818
$: {
19+
if (typeof text !== 'string') {
20+
text = `${JSON.stringify(text)}`;
21+
}
1922
const markedText = !rawText ? replaceNewLine(marked(replaceMarkdown(text || ''))?.toString()) : marked(text || '')?.toString();
2023
if (!!markedText && markedText.endsWith('<br>')) {
2124
const idx = markedText.lastIndexOf('<br>');

src/lib/helpers/types/instructTypes.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* @property {string} provider
3434
* @property {string} model
3535
* @property {string?} [template_name]
36+
* @property {string?} [user_name]
3637
* @property {string} user_message
3738
* @property {string?} [system_instruction]
3839
* @property {string} completion_text

src/lib/scss/custom/pages/_instruction.scss

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
padding: 10px 5px;
9696

9797
.instruction-log-message {
98+
margin-top: 10px;
9899
overflow-y: auto;
99100
max-height: 350px;
100101
scrollbar-width: none;

src/routes/page/conversation/+page.svelte

+6-2
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,12 @@
374374
</div>
375375
</CardBody>
376376
{#if showStateSearch}
377-
<CardBody class="border-bottom" style="display: flex; justify-content: flex-end;">
378-
<StateSearch bind:states={states} onSearch={q => handleStateSearch(q)}/>
377+
<CardBody class="border-bottom">
378+
<Row class="g-3 justify-content-end">
379+
<Col lg="6">
380+
<StateSearch bind:states={states} onSearch={q => handleStateSearch(q)}/>
381+
</Col>
382+
</Row>
379383
</CardBody>
380384
{/if}
381385
<CardBody class="border-bottom">

src/routes/page/conversation/state-search.svelte

+12-11
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
>
3737
{#each states as state, idx}
3838
<div class="state-search-item">
39-
<div>
39+
<div style="flex: 1;">
4040
<RemoteSearchInput
4141
bind:value={state.key}
4242
maxLength={maxLength}
4343
onSearch={e => onSearch(e)}
4444
placeholder="Search States"
4545
/>
4646
</div>
47-
<div>
47+
<div style="flex: 1;">
4848
<Input
4949
type="text"
5050
bind:value={state.value}
@@ -67,15 +67,16 @@
6767
</div>
6868
{/each}
6969
{#if states.length < limit}
70-
<div>
71-
<Button
72-
color="link"
73-
style="padding-left: 0px;"
74-
on:click={() => addState()}
75-
>
76-
Add +
77-
</Button>
78-
</div>
70+
<div class="d-flex justify-content-end">
71+
<Button
72+
color="link"
73+
style="padding-left: 0px;"
74+
on:click={() => addState()}
75+
>
76+
Add +
77+
</Button>
78+
<div style="flex: 0 0 13px;"></div>
79+
</div>
7980
{/if}
8081
</div>
8182

src/routes/page/instruction/log/+page.svelte

+4-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
202202
203203
<HeadTitle title="{$_('Instruction Log')}" />
204-
<Breadcrumb pagetitle="{$_('Instruction Log')}" title="{$_('Instruction')}"/>
204+
<Breadcrumb pagetitle="{$_('Log')}" title="{$_('Instruction')}"/>
205205
<LoadingToComplete isLoading={isLoading} />
206206
207207
<Row>
@@ -260,9 +260,10 @@
260260
<thead>
261261
<tr>
262262
<th scope="col" class="instruction-log-col ellipsis">{$_('Agent')}</th>
263-
<th scope="col" class="instruction-log-col ellipsis">{$_('Provider')}</th>
264-
<th scope="col" class="instruction-log-col ellipsis">{$_('Model')}</th>
263+
<th scope="col" class="instruction-log-col ellipsis">{$_('Llm Provider')}</th>
264+
<th scope="col" class="instruction-log-col ellipsis">{$_('Llm Model')}</th>
265265
<th scope="col" class="instruction-log-col ellipsis">{$_('Template')}</th>
266+
<th scope="col" class="instruction-log-col ellipsis">{$_('Caller')}</th>
266267
<th scope="col" class="instruction-log-col ellipsis">{$_('Created Time')}</th>
267268
<th scope="col">{$_('')}</th>
268269
</tr>

src/routes/page/instruction/log/log-item.svelte

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<td class="instruction-log-col ellipsis">{item.provider}</td>
2121
<td class="instruction-log-col ellipsis">{item.model}</td>
2222
<td class="instruction-log-col ellipsis">{item.template_name || 'N/A'}</td>
23+
<td class="instruction-log-col ellipsis">{item.user_name || 'N/A'}</td>
2324
<td class="instruction-log-col ellipsis">{utcToLocal(item.created_time)}</td>
2425
<td>
2526
<ul class="list-unstyled hstack gap-1 mb-0" style="justify-content: center;">

src/routes/page/instruction/+page.svelte src/routes/page/instruction/testing/+page.svelte

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
import HeadTitle from '$lib/common/HeadTitle.svelte';
99
import Breadcrumb from '$lib/common/Breadcrumb.svelte';
1010
import Markdown from '$lib/common/markdown/Markdown.svelte';
11-
import InstructionState from './instruction-components/instruction-state.svelte';
11+
import InstructionState from '../instruction-components/instruction-state.svelte';
1212
import { getAgents } from '$lib/services/agent-service';
1313
import LoadingToComplete from '$lib/common/LoadingToComplete.svelte';
1414
import { sendChatCompletion } from '$lib/services/instruct-service';
1515
import { getLlmConfigs } from '$lib/services/llm-provider-service';
1616
import { LlmModelType } from '$lib/helpers/enums';
1717
import NavBar from '$lib/common/nav-bar/NavBar.svelte';
1818
import NavItem from '$lib/common/nav-bar/NavItem.svelte';
19-
import InstructionTemplate from './instruction-components/instruction-template.svelte';
20-
import InstructionLlm from './instruction-components/instruction-llm.svelte';
19+
import InstructionTemplate from '../instruction-components/instruction-template.svelte';
20+
import InstructionLlm from '../instruction-components/instruction-llm.svelte';
2121
2222
const maxLength = 64000;
2323
const DEFAULT_PROVIDER = 'openai';
@@ -165,7 +165,7 @@
165165
</script>
166166
167167
<HeadTitle title="{$_('Instruction')}" />
168-
<Breadcrumb pagetitle="{$_('Instruction')}" title="{$_('Instruction')}"/>
168+
<Breadcrumb pagetitle="{$_('Testing')}" title="{$_('Instruction')}"/>
169169
<LoadingToComplete isLoading={isLoading} />
170170
171171
<div class="d-xl-flex">

svelte.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const config = {
5252
"/page/agent/[agentId]",
5353
"/page/agent/[agentId]/build",
5454
"/page/agent/[agentId]/train",
55-
"/page/instruction",
55+
"/page/instruction/testing",
5656
"/page/instruction/log",
5757
"/page/conversation",
5858
"/page/conversation/[conversationId]",

0 commit comments

Comments
 (0)