Skip to content

Commit f43fa46

Browse files
authored
Merge pull request #455 from iceljc/bugfix/fix-env-styling
Bugfix/fix env styling
2 parents 52a5847 + 96eb872 commit f43fa46

13 files changed

Lines changed: 86 additions & 263 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ PUBLIC_AUTH_ENABLE_SSO=true
2424
PUBLIC_AUTH_ENABLE_FIND_PWD=true
2525
PUBLIC_ENVIRONMENTS=[]
2626
PUBLIC_PRIMARY_COLOR="#556ee6"
27-
PUBLIC_SECONDARY_COLOR=
27+
PUBLIC_SECONDARY_COLOR=""

src/lib/helpers/http.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ function skipLoader(config) {
234234
new RegExp('http(s*)://(.*?)/agent/tasks', 'g'),
235235
new RegExp('http(s*)://(.*?)/agent/(.*?)/code-scripts', 'g'),
236236
new RegExp('http(s*)://(.*?)/rule/triggers', 'g'),
237-
new RegExp('http(s*)://(.*?)/rule/config/options', 'g'),
238237
new RegExp('http(s*)://(.*?)/conversation/state/keys', 'g'),
239238
new RegExp('http(s*)://(.*?)/conversation/(.*?)/files/(.*?)', 'g'),
240239
new RegExp('http(s*)://(.*?)/llm-configs', 'g'),

src/lib/scss/_variables-dark.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ $footer-color-dark: #a6b0cf;
101101
/* Horizontal nav */
102102
$topnav-bg-dark: #282e3f;
103103
$menu-item-color-dark: #a6b0cf;
104-
$menu-item-active-color-dark: #556ee6;
104+
$menu-item-active-color-dark: var(--#{$prefix}primary);
105105

106106
$boxed-body-bg-dark: #32394f;
107107

src/lib/scss/_variables.scss

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $sidebar-menu-item-color: #545a6d;
1010
$sidebar-menu-sub-item-color: #545a6d;
1111
$sidebar-menu-item-icon-color: #7f8387;
1212
$sidebar-menu-item-hover-color: #383c40;
13-
$sidebar-menu-item-active-color: #556ee6;
13+
$sidebar-menu-item-active-color: var(--#{$prefix}primary);
1414
$sidebar-width: 250px;
1515
$sidebar-collapsed-width: 70px;
1616
$sidebar-width-sm: 160px;
@@ -44,7 +44,7 @@ $footer-color: #74788d;
4444
$topnav-bg: $white;
4545

4646
$menu-item-color: #545a6d;
47-
$menu-item-active-color: #556ee6;
47+
$menu-item-active-color: var(--#{$prefix}primary);
4848

4949
/* Right Sidebar */
5050
$rightbar-width: 280px;
@@ -138,8 +138,17 @@ $colors: (
138138
/* scss-docs-end colors-map */
139139

140140
/* scss-docs-start theme-color-variables */
141-
$primary: $purple;
142-
$secondary: $gray-600;
141+
/* `env-vars` is a virtual partial served by a custom Sass importer in */
142+
/* vite.config.js. It exposes PUBLIC_PRIMARY_COLOR / PUBLIC_SECONDARY_COLOR */
143+
/* from .env as `$env-primary` / `$env-secondary`. When the env vars are */
144+
/* empty the import yields nothing and the `!default` fallbacks below */
145+
/* preserve the original theme. */
146+
@import "env-vars";
147+
$env-primary: $purple !default;
148+
$env-secondary: $gray-600 !default;
149+
150+
$primary: $env-primary;
151+
$secondary: $env-secondary;
143152
$success: $green;
144153
$info: $cyan;
145154
$warning: $yellow;

src/lib/scss/custom/pages/_chat.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@
670670
}
671671

672672
.state-delete {
673-
flex: 0.1;
673+
flex: 0.05;
674674
color: var(--bs-danger);
675675
font-size: 12px;
676676
}

src/lib/services/agent-service.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,6 @@ export async function getAgentRuleOptionsById(agentId) {
126126
return response.data;
127127
}
128128

129-
/**
130-
* Get agent rule config options
131-
* @returns {Promise<any>}
132-
*/
133-
export async function getAgentRuleConfigOptions() {
134-
const url = endpoints.agentRuleConfigOptionsUrl;
135-
const response = await axios.get(url);
136-
return response.data;
137-
}
138129

139130
/**
140131
* Get agent labels

src/lib/services/api-endpoints.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export const endpoints = {
4141
agentUtilityOptionsUrl: `${host}/agent/utility/options`,
4242
agentRuleOptionsUrl: `${host}/rule/triggers`,
4343
agentRuleOptionsByIdUrl: `${host}/rule/triggers/{agentId}`,
44-
agentRuleConfigOptionsUrl: `${host}/rule/config/options`,
4544
agentLabelsUrl: `${host}/agent/labels`,
4645

4746
// agent code script:

src/routes/+layout.svelte

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,14 @@
55
import '$lib/scss/icons.scss';
66
import { addMessages, init, getLocaleFromNavigator } from 'svelte-i18n';
77
import en from '$lib/langs/en.json';
8-
import {
9-
PUBLIC_PRIMARY_COLOR,
10-
PUBLIC_SECONDARY_COLOR
11-
} from '$env/static/public';
128
139
addMessages('en', en);
1410
1511
init({
1612
fallbackLocale: 'en',
1713
initialLocale: getLocaleFromNavigator()
1814
});
19-
20-
/** @type {Record<string, string>} */
21-
const colorOverrides = {
22-
...(PUBLIC_PRIMARY_COLOR ? { '--bs-primary': PUBLIC_PRIMARY_COLOR, '--bs-primary-rgb': hexToRgb(PUBLIC_PRIMARY_COLOR) } : {}),
23-
...(PUBLIC_SECONDARY_COLOR ? { '--bs-secondary': PUBLIC_SECONDARY_COLOR, '--bs-secondary-rgb': hexToRgb(PUBLIC_SECONDARY_COLOR) } : {}),
24-
};
25-
26-
const styleOverride = Object.entries(colorOverrides).map(([k, v]) => `${k}:${v}`).join(';');
27-
28-
/**
29-
* Convert a hex color string to an "r, g, b" string for Bootstrap's rgb variables.
30-
* @param {string} hex
31-
* @returns {string}
32-
*/
33-
function hexToRgb(hex) {
34-
const h = hex.replace('#', '');
35-
const n = parseInt(h, 16);
36-
return `${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}`;
37-
}
3815
</script>
3916

40-
<svelte:head>
41-
{#if styleOverride}
42-
{@html `<style>:root { ${styleOverride} }</style>`}
43-
{/if}
44-
</svelte:head>
45-
4617
<slot />
4718

src/routes/page/agent/[agentId]/+page.svelte

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import { AgentExtensions } from '$lib/helpers/utils/agent';
1212
import { globalEventStore } from '$lib/helpers/store';
1313
import { GlobalEvent } from '$lib/helpers/enums';
14-
import { myInfo } from '$lib/services/auth-service';
1514
import AgentInstruction from './agent-components/agent-instruction.svelte';
1615
import AgentOverview from './agent-components/agent-overview.svelte';
1716
import AgentTemplate from './agent-components/templates/agent-template.svelte';
@@ -28,8 +27,6 @@
2827
let agentTemplateCmp = $state(null);
2928
/** @type {any} */
3029
let agentTabsCmp = $state(null);
31-
/** @type {import('$userTypes').UserModel} */
32-
let user = $state(/** @type {any} */ (undefined));
3330
/** @type {any} */
3431
let unsubscriber;
3532
@@ -54,8 +51,6 @@
5451
}
5552
5653
onMount(async () => {
57-
user = await myInfo();
58-
5954
unsubscriber = globalEventStore.subscribe((/** @type {import('$commonTypes').GlobalEvent} */ event) => {
6055
if (event.name !== GlobalEvent.Search) return;
6156
@@ -214,7 +209,6 @@
214209
<AgentTabs
215210
bind:this={agentTabsCmp}
216211
agent={agent}
217-
user={user}
218212
/>
219213
</div>
220214
</div>

src/routes/page/agent/[agentId]/agent-components/rules/agent-rule-item.svelte

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,30 @@
11
<script>
2-
import { slide } from 'svelte/transition';
32
import Markdown from '$lib/common/markdown/Markdown.svelte';
43
import BotsharpTooltip from '$lib/common/tooltip/BotsharpTooltip.svelte';
5-
import { ADMIN_ROLES } from '$lib/helpers/constants';
6-
7-
const duration = 200;
84
95
/**
106
* @type {{
117
* rule: import('$agentTypes').AgentRule,
128
* ruleIndex: number,
139
* collapsed?: boolean,
14-
* user: import('$userTypes').UserModel,
1510
* ruleOptions?: any[],
16-
* configOptions?: any[],
1711
* windowWidth: number,
1812
* ontoggle?: (data: { ruleIdx: number, field: string, checked: boolean }) => void,
1913
* onchange?: (data: { ruleIdx: number, field: string, value: string }) => void,
2014
* ondelete?: (data: { ruleIdx: number, field: string }) => void,
21-
* oncollapse?: (data: { ruleIdx: number, collapsed: boolean }) => void,
22-
* onconfig?: (data: { ruleIdx: number }) => void
15+
* oncollapse?: (data: { ruleIdx: number, collapsed: boolean }) => void
2316
* }}
2417
*/
2518
let {
2619
rule,
2720
ruleIndex,
2821
collapsed = true,
29-
user,
3022
ruleOptions = [],
31-
configOptions = [],
3223
windowWidth,
3324
ontoggle,
3425
onchange,
3526
ondelete,
36-
oncollapse,
37-
onconfig
27+
oncollapse
3828
} = $props();
3929
4030
/**
@@ -77,12 +67,6 @@
7767
collapsed: !collapsed
7868
});
7969
}
80-
81-
function toggleConfig() {
82-
onconfig?.({
83-
ruleIdx: ruleIndex
84-
});
85-
}
8670
</script>
8771
8872
<div class="utility-wrapper">
@@ -138,22 +122,6 @@
138122
</BotsharpTooltip>
139123
</div>
140124
{/if}
141-
142-
{#if ADMIN_ROLES.includes(user?.role || '') && !!rule.trigger_name && rule.config?.topology_name}
143-
<div class="line-align-center">
144-
<i
145-
class="bx bx-cog text-primary fs-6 clickable"
146-
id={`rule-config-${ruleIndex}`}
147-
data-bs-toggle="tooltip"
148-
data-bs-placement="top"
149-
title="Rule config"
150-
role="button"
151-
tabindex="0"
152-
onkeydown={() => {}}
153-
onclick={() => toggleConfig()}
154-
></i>
155-
</div>
156-
{/if}
157125
</div>
158126
</div>
159127
<div class="utility-value">
@@ -181,36 +149,4 @@
181149
</div>
182150
</div>
183151
</div>
184-
185-
{#if !collapsed}
186-
<div class="utility-row utility-row-secondary" transition:slide={{ duration: duration }}>
187-
<div class="utility-content">
188-
<div class="utility-list-item">
189-
<div class="utility-label line-align-center">
190-
<div class="d-flex gap-1">
191-
<div class="line-align-center">
192-
{'Topology'}
193-
</div>
194-
<div class="line-align-center"></div>
195-
</div>
196-
</div>
197-
<div class="utility-value">
198-
<div class="utility-input line-align-center">
199-
<select
200-
class="form-select"
201-
onchange={e => changeRule(e, 'topology')}
202-
>
203-
{#each [...configOptions] as option}
204-
<option value={`${option.name}`} selected={option.name == rule.config?.topology_name}>
205-
{option.name}
206-
</option>
207-
{/each}
208-
</select>
209-
</div>
210-
<div class="utility-delete line-align-center"></div>
211-
</div>
212-
</div>
213-
</div>
214-
</div>
215-
{/if}
216152
</div>

0 commit comments

Comments
 (0)