Skip to content

Commit 082d39e

Browse files
author
Jicheng Lu
committed
refine js interpreter styles
1 parent e9deee5 commit 082d39e

4 files changed

Lines changed: 22 additions & 7 deletions

File tree

src/lib/helpers/types/commonTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
* @typedef {Object} LlmModelSetting
5656
* @property {string} name
5757
* @property {string} type
58+
* @property {any} reasoning
5859
*/
5960

6061

src/routes/chat/[agentId]/[conversationId]/rich-content/rc-js-interpreter.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@
100100
<div class="mb-3">{message.text}</div>
101101
{/if}
102102
<div id={`${scrollbarId}`}>
103-
<div id={`chart-${message?.message_id}`} style="min-width: 1000px; max-height: 500px;"></div>
103+
<div id={`chart-${message?.message_id}`}></div>
104104
</div>
105105
</div>

src/routes/page/agent/[agentId]/agent-components/agent-llm-config.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
export let handleAgentChange = () => {};
1313
1414
export const fetchLlmConfig = () => {
15+
const reasoningEffort = models.find(x => x.name === config.model)?.reasoning != null ? config.reasoning_effort_level : null;
1516
return {
1617
...config,
17-
max_output_tokens: Number(config.max_output_tokens) > 0 ? Number(config.max_output_tokens) : null
18+
max_output_tokens: Number(config.max_output_tokens) > 0 ? Number(config.max_output_tokens) : null,
19+
reasoning_effort_level: reasoningEffort
1820
};
1921
}
2022
@@ -37,6 +39,8 @@
3739
/** @type {import('$commonTypes').LlmModelSetting[]} */
3840
let models = [];
3941
42+
$: isReasoningModel = models.find(x => x.name === config.model)?.reasoning != null;
43+
4044
onMount(async () =>{
4145
await init();
4246
});
@@ -63,6 +67,7 @@
6367
if (!!!provider) {
6468
models = [];
6569
config.model = null;
70+
config.reasoning_effort_level = null;
6671
handleAgentChange();
6772
return;
6873
}
@@ -181,6 +186,7 @@
181186
</div>
182187
</div>
183188
189+
{#if isReasoningModel}
184190
<div class="mb-3 row">
185191
<label for="example-text-input" class="col-md-3 col-form-label">
186192
Reasoning effort
@@ -195,5 +201,6 @@
195201
</Input>
196202
</div>
197203
</div>
204+
{/if}
198205
</CardBody>
199206
</Card>

src/routes/page/conversation/[conversationId]/conv-dialog-element.svelte

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script>
22
import Markdown from '$lib/common/markdown/Markdown.svelte';
33
import { Button } from '@sveltestrap/sveltestrap';
4+
import RcJsInterpreter from '../../../chat/[agentId]/[conversationId]/rich-content/rc-js-interpreter.svelte';
5+
import { RichType } from '$lib/helpers/enums';
46
57
/** @type {import('$conversationTypes').ChatResponseModel} */
68
export let dialog;
@@ -18,11 +20,16 @@
1820
class="fw-bold"
1921
class:text-collapse={!!is_collapsed}
2022
>
21-
<Markdown
22-
containerClasses={'dialog-item-text'}
23-
text={dialog?.rich_content?.message?.text || dialog?.text}
24-
rawText
25-
/>
23+
{#if dialog?.rich_content?.message?.rich_type === RichType.ProgramCode
24+
&& dialog?.rich_content?.message?.language === 'javascript'}
25+
<RcJsInterpreter message={dialog} scrollable />
26+
{:else}
27+
<Markdown
28+
containerClasses={'dialog-item-text'}
29+
text={dialog?.rich_content?.message?.text || dialog?.text}
30+
rawText
31+
/>
32+
{/if}
2633
</div>
2734

2835
<Button

0 commit comments

Comments
 (0)