Skip to content

Commit ce3976f

Browse files
fix: 修复自定义小助手颜色问题
1 parent 0e7ac12 commit ce3976f

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

ui/src/utils/theme.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,13 @@ export const defaultPlatformSetting = {
4646
showProject: true,
4747
projectUrl: 'https://github.com/1Panel-dev/MaxKB'
4848
}
49+
50+
export function hexToRgba(hex: string, alpha: number) {
51+
// 将16进制颜色值的两个字符一起转换成十进制
52+
const r = parseInt(hex.slice(1, 3), 16)
53+
const g = parseInt(hex.slice(3, 5), 16)
54+
const b = parseInt(hex.slice(5, 7), 16)
55+
56+
// 返回RGBA格式的字符串
57+
return `rgba(${r}, ${g}, ${b}, ${alpha})`
58+
}

ui/src/views/chat/embed/index.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<div
33
class="chat-embed layout-bg"
44
v-loading="loading"
5-
:style="{ '--el-color-primary': applicationDetail?.custom_theme?.theme_color }"
5+
:style="{
6+
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
7+
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1)
8+
}"
69
>
710
<div class="chat-embed__header" :style="customStyle">
811
<div class="chat-width flex align-center">
@@ -73,6 +76,7 @@
7376
<el-scrollbar max-height="300">
7477
<div class="p-8">
7578
<common-list
79+
:style="{ '--el-color-primary': applicationDetail?.custom_theme?.theme_color }"
7680
:data="chatLogData"
7781
v-loading="left_loading"
7882
:defaultActive="currentChatId"
@@ -111,8 +115,8 @@
111115
</template>
112116
<script setup lang="ts">
113117
import { ref, onMounted, reactive, nextTick, computed } from 'vue'
114-
115118
import { isAppIcon } from '@/utils/application'
119+
import { hexToRgba } from '@/utils/theme'
116120
import useStore from '@/stores'
117121
118122
const { user, log } = useStore()
@@ -252,6 +256,7 @@ const init = () => {
252256
getChatLog(applicationDetail.value.id)
253257
}
254258
}
259+
255260
onMounted(() => {
256261
init()
257262
})

ui/src/views/chat/pc/index.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
class="chat-pc layout-bg"
44
:class="classObj"
55
v-loading="loading"
6-
:style="{ '--el-color-primary': applicationDetail?.custom_theme?.theme_color }"
6+
:style="{
7+
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
8+
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1)
9+
}"
710
>
811
<div class="chat-pc__header" :style="customStyle">
912
<div class="flex align-center">
@@ -43,6 +46,13 @@
4346
<el-scrollbar>
4447
<div class="p-8 pt-0">
4548
<common-list
49+
:style="{
50+
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
51+
'--el-color-primary-light-9': hexToRgba(
52+
applicationDetail?.custom_theme?.theme_color,
53+
0.1
54+
)
55+
}"
4656
:data="chatLogData"
4757
class="mt-8"
4858
v-loading="left_loading"
@@ -135,6 +145,7 @@ import { saveAs } from 'file-saver'
135145
import { isAppIcon } from '@/utils/application'
136146
import useStore from '@/stores'
137147
import useResize from '@/layout/hooks/useResize'
148+
import { hexToRgba } from '@/utils/theme'
138149
139150
useResize()
140151

ui/src/workflow/nodes/search-dataset-node/index.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@
3838
<AppAvatar v-else class="mr-8 avatar-blue" shape="square" :size="20">
3939
<img src="@/assets/icon_document.svg" style="width: 58%" alt="" />
4040
</AppAvatar>
41-
<div class="ellipsis">
41+
42+
<auto-tooltip
43+
:content="relatedObject(datasetList, item, 'id')?.name"
44+
style="width: 80%"
45+
>
4246
{{ relatedObject(datasetList, item, 'id')?.name }}
43-
</div>
47+
</auto-tooltip>
4448
</div>
4549
<el-button text @click="removeDataset(item)">
4650
<el-icon><Close /></el-icon>

0 commit comments

Comments
 (0)