diff --git a/ui/index.html b/ui/index.html index c6b14cc72..4e8168e01 100644 --- a/ui/index.html +++ b/ui/index.html @@ -1,9 +1,9 @@ - + - - - + + + %VITE_APP_TITLE% diff --git a/ui/public/embeb.js b/ui/public/embeb.js new file mode 100644 index 000000000..f8c3ea147 --- /dev/null +++ b/ui/public/embeb.js @@ -0,0 +1,66 @@ +// async function embedChatbot() { +// const t = window.difyChatbotConfig +// if (t && t.token) { +// var e = !!t.isDev +// const o = t.baseUrl || `https://${e ? 'dev.' : ''}udify.app`, +// n = ` +// +// `, +// i = ` +// +// ` +// if (!document.getElementById('dify-chatbot-bubble-button')) { +// e = document.createElement('div') +// ;(e.id = 'dify-chatbot-bubble-button'), +// (e.style.cssText = +// 'position: fixed; bottom: 1rem; right: 1rem; width: 50px; height: 50px; border-radius: 25px; background-color: #155EEF; box-shadow: rgba(0, 0, 0, 0.2) 0px 4px 8px 0px; cursor: pointer; z-index: 2147483647; transition: all 0.2s ease-in-out 0s; left: unset; transform: scale(1); :hover {transform: scale(1.1);}') +// const d = document.createElement('div') +// ;(d.style.cssText = +// 'display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; z-index: 2147483647;'), +// (d.innerHTML = n), +// e.appendChild(d), +// document.body.appendChild(e), +// e.addEventListener('click', function () { +// var e = document.getElementById('dify-chatbot-bubble-window') +// e +// ? 'none' === e.style.display +// ? ((e.style.display = 'block'), (d.innerHTML = i)) +// : ((e.style.display = 'none'), (d.innerHTML = n)) +// : (((e = document.createElement('iframe')).allow = 'fullscreen;microphone'), +// (e.title = 'dify chatbot bubble window'), +// (e.id = 'dify-chatbot-bubble-window'), +// (e.src = o + '/chatbot/' + t.token), +// (e.style.cssText = +// 'border: none; position: fixed; flex-direction: column; justify-content: space-between; box-shadow: rgba(150, 150, 150, 0.2) 0px 10px 30px 0px, rgba(150, 150, 150, 0.2) 0px 0px 0px 1px; bottom: 5rem; right: 1rem; width: 24rem; max-width: calc(100vw - 2rem); height: 40rem; max-height: calc(100vh - 6rem);border-radius: 0.75rem; display: flex; z-index: 2147483647; overflow: hidden; left: unset; background-color: #F3F4F6;'), +// document.body.appendChild(e), +// (d.innerHTML = i)) +// }) +// } +// } else console.error('difyChatbotConfig is empty or token is not provided') +// } +// document.body.onload = embedChatbot diff --git a/ui/src/assets/window1.png b/ui/src/assets/window1.png new file mode 100644 index 000000000..a96b907f6 Binary files /dev/null and b/ui/src/assets/window1.png differ diff --git a/ui/src/assets/window2.png b/ui/src/assets/window2.png new file mode 100644 index 000000000..02d1ec979 Binary files /dev/null and b/ui/src/assets/window2.png differ diff --git a/ui/src/components/ai-dialog/index.vue b/ui/src/components/ai-dialog/index.vue index 8db070a26..471331977 100644 --- a/ui/src/components/ai-dialog/index.vue +++ b/ui/src/components/ai-dialog/index.vue @@ -92,7 +92,6 @@ import { ref, nextTick, onUpdated, computed } from 'vue' import applicationApi from '@/api/application' import { ChatManage, type chatType } from '@/api/type/application' import { randomId } from '@/utils/utils' -import MarkdownRenderer from '@/components/markdown-renderer/index.vue' const props = defineProps({ data: { type: Object, diff --git a/ui/src/components/dynamics-form/index.vue b/ui/src/components/dynamics-form/index.vue index c1bb3908d..0abdd60c0 100644 --- a/ui/src/components/dynamics-form/index.vue +++ b/ui/src/components/dynamics-form/index.vue @@ -38,6 +38,9 @@ import type { FormInstance } from 'element-plus' import triggerApi from '@/api/provider' import type Result from '@/request/Result' import _ from 'lodash' + +defineOptions({ name: 'dynamicsForm' }) + const props = withDefaults( defineProps<{ // 页面渲染数据 diff --git a/ui/src/components/index.ts b/ui/src/components/index.ts index 4f1114a73..0fe5caa96 100644 --- a/ui/src/components/index.ts +++ b/ui/src/components/index.ts @@ -12,7 +12,8 @@ import AppTable from './app-table/index.vue' import ReadWrite from './read-write/index.vue' import TagEllipsis from './tag-ellipsis/index.vue' import CommonList from './common-list/index.vue' -import dynamicsForm from './dynamics-form' +import dynamicsForm from './dynamics-form/index.vue' +import MarkdownRenderer from './markdown-renderer/index.vue' export default { install(app: App) { app.component(AppIcon.name, AppIcon) @@ -28,6 +29,7 @@ export default { app.component(ReadWrite.name, ReadWrite) app.component(TagEllipsis.name, TagEllipsis) app.component(CommonList.name, CommonList) - app.use(dynamicsForm) + app.component(dynamicsForm.name, dynamicsForm) + app.component(MarkdownRenderer.name, MarkdownRenderer) } } diff --git a/ui/src/components/markdown-renderer/index.vue b/ui/src/components/markdown-renderer/index.vue index c9a462211..e2175ae91 100644 --- a/ui/src/components/markdown-renderer/index.vue +++ b/ui/src/components/markdown-renderer/index.vue @@ -12,6 +12,9 @@ import MarkdownItTasklists from 'markdown-it-task-lists' import MarkdownItSub from 'markdown-it-sub' import MarkdownItSup from 'markdown-it-sup' import MarkdownItTOC from 'markdown-it-toc-done-right' + +defineOptions({ name: 'MarkdownRenderer' }) + const markdownIt = MarkdownIt({ html: true, // 允许HTML语法 typographer: true, // 启用Typographer插件,可以更好地处理中文字符和标点符号 diff --git a/ui/src/styles/app.scss b/ui/src/styles/app.scss index 229583ea0..e4851da77 100644 --- a/ui/src/styles/app.scss +++ b/ui/src/styles/app.scss @@ -189,6 +189,10 @@ h4 { vertical-align: middle; } +.border { + border: 1px solid var(--el-border-color); +} + .border-l { border-left: 1px solid var(--el-border-color); } diff --git a/ui/src/views/application/AppOverview.vue b/ui/src/views/application/AppOverview.vue index 1714adb30..c58a496fc 100644 --- a/ui/src/views/application/AppOverview.vue +++ b/ui/src/views/application/AppOverview.vue @@ -57,21 +57,24 @@
演示 - 嵌入第三方 + 嵌入第三方
+ +