Skip to content

Commit 4075d0b

Browse files
author
Jicheng Lu
committed
refine instruction log
1 parent 7e59ba3 commit 4075d0b

File tree

7 files changed

+15
-8
lines changed

7 files changed

+15
-8
lines changed

src/lib/common/markdown/Markdown.svelte

Lines changed: 3 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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/instruction/log/+page.svelte

Lines changed: 4 additions & 3 deletions
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

Lines changed: 1 addition & 0 deletions
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 renamed to src/routes/page/instruction/testing/+page.svelte

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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)