Skip to content

Commit 0d951aa

Browse files
author
Jicheng Lu
committed
Merge branch 'main' of https://github.com/SciSharp/BotSharp-UI into features/refine-template-config
2 parents db5b11e + 7a969eb commit 0d951aa

22 files changed

Lines changed: 488 additions & 60 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ PUBLIC_ALLOW_SIGNUP=true
2323
PUBLIC_AUTH_ENABLE_SSO=true
2424
PUBLIC_AUTH_ENABLE_FIND_PWD=true
2525
PUBLIC_ENVIRONMENTS=[]
26-
PUBLIC_PRIMARY_COLOR=#556ee6
26+
PUBLIC_PRIMARY_COLOR="#556ee6"
2727
PUBLIC_SECONDARY_COLOR=

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"svelte-codemirror-editor": "^2.1.0",
7474
"svelte-collapse": "^0.1.2",
7575
"svelte-file-dropzone": "^2.0.2",
76+
"svelte-hero-icons": "^5.2.0",
7677
"svelte-i18n": "^4.0.0",
7778
"svelte-json-tree": "^2.2.0",
7879
"svelte-jsoneditor": "^3.11.0",

src/lib/common/embedding/EmbeddingPage.svelte

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { onMount } from 'svelte';
33
import { page } from '$app/stores';
44
import { getUserStore, globalMenuStore } from '$lib/helpers/store';
5+
import { getCleanUrl } from '$lib/helpers/utils/common';
56
67
let {
78
htmlTagId = 'embedding-page',
@@ -12,6 +13,39 @@
1213
/** @type {string} */
1314
let curSlug = $state('');
1415
16+
/** @type {boolean} */
17+
let fullScreen = $state(false);
18+
19+
$effect(() => {
20+
const footer = document.querySelector('.footer');
21+
const pageContent = document.querySelector('.page-content');
22+
23+
if (fullScreen) {
24+
if (footer instanceof HTMLElement) {
25+
footer.style.display = 'none';
26+
}
27+
if (pageContent instanceof HTMLElement) {
28+
pageContent.style.paddingBottom = '0';
29+
}
30+
} else {
31+
if (footer instanceof HTMLElement) {
32+
footer.style.display = '';
33+
}
34+
if (pageContent instanceof HTMLElement) {
35+
pageContent.style.paddingBottom = '';
36+
}
37+
}
38+
39+
return () => {
40+
if (footer instanceof HTMLElement) {
41+
footer.style.display = '';
42+
}
43+
if (pageContent instanceof HTMLElement) {
44+
pageContent.style.paddingBottom = '';
45+
}
46+
};
47+
});
48+
1549
// @ts-ignore
1650
let slug = $derived($page.params[slugName]);
1751
@@ -25,14 +59,15 @@
2559
2660
onMount(() => {
2761
const menuUnsubscribe = globalMenuStore.subscribe((/** @type {import('$pluginTypes').PluginMenuDefModel[]} */ menu) => {
28-
const url = getPathUrl();
29-
let found = menu.find(x => x.link === url);
62+
const url = getCleanPath(getPathUrl());
63+
let found = menu.find(x => getCleanPath(x.link) === url);
3064
label = found?.label || '';
3165
if (!found?.embeddingInfo) {
32-
const subFound = menu.find(x => !!x.subMenu?.find(y => y.link === url));
33-
found = subFound?.subMenu?.find(x => x.link === url);
66+
const subFound = menu.find(x => !!x.subMenu?.find(y => getCleanPath(y.link) === url));
67+
found = subFound?.subMenu?.find(x => getCleanPath(x.link) === url);
3468
label = found?.label || '';
3569
}
70+
fullScreen = found?.embeddingInfo?.fullScreen || false;
3671
embed(found?.embeddingInfo || null);
3772
});
3873
@@ -77,9 +112,13 @@
77112
}
78113
}
79114
115+
/** @param {string} url */
116+
const getCleanPath = (url) => {
117+
return getCleanUrl((url || '').split('?')[0]);
118+
};
119+
80120
const getPathUrl = () => {
81-
const path = $page.url.pathname;
82-
return path?.startsWith('/') ? path.substring(1) : path;
121+
return $page.url.pathname || '';
83122
};
84123
</script>
85124

src/lib/common/modals/PlainModal.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@
3232
<!-- svelte-ignore a11y_no_static_element_interactions -->
3333
<!-- svelte-ignore a11y_click_events_have_key_events -->
3434
<div
35-
class="fixed inset-0 z-[9999] flex items-start justify-center pt-[10vh] bg-black/50"
35+
class={`fixed inset-0 z-[9999] flex items-start justify-center pt-[10vh] bg-black/50 ${containerClasses}`}
3636
transition:fade={{ duration: 150 }}
3737
onclick={handleBackdropClick}
3838
>
3939
<div
40-
class={`bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full ${sizeClasses[size] || 'max-w-lg'} mx-4 ${containerClasses}`}
40+
class={`bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full ${sizeClasses[size] || 'max-w-lg'} mx-4 modal-content`}
4141
style={containerStyles}
4242
>
4343
<!-- Header -->
4444
{#if title}
45-
<div class="flex items-center justify-between p-3 border-b border-gray-200 dark:border-gray-700">
45+
<div class="flex items-center justify-between p-3 border-b border-gray-200 dark:border-gray-700 modal-title">
4646
<div class="font-semibold text-lg">{title}</div>
4747
<button
4848
type="button"
@@ -56,7 +56,7 @@
5656
{/if}
5757

5858
<!-- Body -->
59-
<div class="p-3" style={bodyStyles}>
59+
<div class="p-3 modal-body" style={bodyStyles}>
6060
{@render children?.()}
6161
</div>
6262
</div>

src/lib/common/spinners/Loader.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
* disableDefaultStyles?: boolean,
77
* containerClasses?: string,
88
* containerStyles?: string,
9-
* size?: number
9+
* size?: number,
10+
* color?: string
1011
* }}
1112
*/
1213
let {
1314
disableDefaultStyles = false,
1415
containerClasses = '',
1516
containerStyles = '',
16-
size = 100
17+
size = 100,
18+
color = 'var(--bs-primary)'
1719
} = $props();
1820
</script>
1921

2022
<div
2123
class="{disableDefaultStyles ? '' : 'loader'} {containerClasses}"
2224
style={`${containerStyles}`}
2325
>
24-
<Circle {size} color="var(--bs-primary)" unit="px" duration="1s" />
26+
<Circle {size} {color} unit="px" duration="1s" />
2527
</div>

src/lib/helpers/enums.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const richType = {
2929
Generic: 'generic_template',
3030
Upload: 'upload_template',
3131
ProgramCode: 'program_code',
32+
Embedding: 'embedding_template'
3233
}
3334
export const RichType = Object.freeze(richType);
3435

src/lib/helpers/types/conversationTypes.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,33 @@ IRichContent.prototype.code_script;
127127
*/
128128
IRichContent.prototype.language;
129129

130+
/**
131+
* The URL of the embedding rich content.
132+
*
133+
* @name url
134+
* @type {string}
135+
* @instance
136+
*/
137+
IRichContent.prototype.url;
138+
139+
/**
140+
* The title of the embedding rich content.
141+
*
142+
* @name title
143+
* @type {string}
144+
* @instance
145+
*/
146+
IRichContent.prototype.title;
147+
148+
/**
149+
* The html tag of the embedding rich content.
150+
*
151+
* @name html_tag
152+
* @type {string}
153+
* @instance
154+
*/
155+
IRichContent.prototype.html_tag;
156+
130157

131158
/**
132159
* @typedef {Object} TextMessage
@@ -180,6 +207,8 @@ IRichContent.prototype.language;
180207
* @property {boolean} is_dummy
181208
* @property {boolean} is_appended
182209
* @property {string} [indication]
210+
* @property {any} [thought]
211+
* @property {any} [meta_data]
183212
*/
184213

185214
/**

src/lib/helpers/types/pluginTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @property {string?} [htmlTag]
3131
* @property {string?} [htmlStyle]
3232
* @property {string?} [appendTokenName]
33+
* @property {boolean} fullScreen
3334
*/
3435

3536
/**

src/lib/scss/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ File: Main Css File
4747
@import "custom/components/markdown";
4848
@import "custom/components/state";
4949
@import "custom/components/codeScript";
50+
@import "custom/components/rich_content";
5051

5152
/* Plugins */
5253
@import "custom/plugins/custom-scrollbar";

0 commit comments

Comments
 (0)