-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
998114d
commit 6e0c6fa
Showing
1 changed file
with
1 addition
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,77 +15,6 @@ | |
{% endblock %} | ||
{% block content %} | ||
{% include "overrides/partials/content.html" %} | ||
<div | ||
id="chatbot" | ||
class="w-12 h-12 rounded-full fixed bottom-5 right-5 transition-all duration-300 overflow-hidden cursor-pointer z-[1000]" | ||
> | ||
<img | ||
id="logo" | ||
src="https://console.d.run/minio/drun/userAvatar/2024-10-30/%E6%9C%BA%E5%99%A8%E4%BA%BA1%201.png" | ||
alt="" | ||
/> | ||
<div | ||
id="chatContent" | ||
class="hidden w-full h-full bg-white box-border relative" | ||
> | ||
<!-- 关闭按钮 --> | ||
<button | ||
id="closeBtn" | ||
class="absolute top-2 right-2 text-gray-600 hover:text-gray-800 font-bold text-lg z-[1100]" | ||
> | ||
<svg | ||
id="closeBtn" | ||
xmlns="http://www.w3.org/2000/svg" | ||
class="h-6 w-6 text-gray-600 hover:text-gray-800 z-[1100]" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
stroke-width="2" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
d="M6 18L18 6M6 6l12 12" | ||
/> | ||
</svg> | ||
</button> | ||
|
||
<!-- 嵌入 iframe 的内容 --> | ||
<div class="w-full h-full"> | ||
<iframe | ||
class="w-full h-full border-none rounded-lg" | ||
src="https://console.d.run/ai-chat-app/ai-chat?mode=mobile&ws=302&token=N2ZlNjFkZDItNDkyMy00Y2I1LWJlM2QtZDJlMzQ2YWM5OTE5" | ||
></iframe> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
const chatbot = document.getElementById('chatbot'); | ||
const chatContent = document.getElementById('chatContent'); | ||
const closeBtn = document.getElementById('closeBtn'); | ||
const logo = document.getElementById('logo'); | ||
|
||
// 点击聊天机器人图标展开 | ||
chatbot.addEventListener('click', () => { | ||
chatbot.classList.toggle('w-[460px]'); | ||
chatbot.classList.toggle('rounded-lg'); | ||
chatbot.style.height = chatbot.classList.contains('rounded-lg') | ||
? 'calc(100vh - 40px)' | ||
: '48px'; | ||
chatContent.classList.toggle('hidden'); | ||
logo.classList.toggle('hidden'); | ||
}); | ||
|
||
// 点击关闭按钮回到初始状态 | ||
closeBtn.addEventListener('click', event => { | ||
event.stopPropagation(); // 阻止事件冒泡,防止触发聊天机器人点击事件 | ||
chatbot.style.height = '48px'; | ||
chatbot.classList.remove('w-[460px]', 'rounded-lg'); | ||
chatContent.classList.add('hidden'); | ||
logo.classList.remove('hidden'); | ||
}); | ||
</script> | ||
{% endblock %} | ||
{% block scripts %} | ||
{{ super() }} | ||
|
@@ -102,4 +31,5 @@ | |
<script type="module"> | ||
import mermaid from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm' | ||
</script> | ||
<script src="https://console.d.run/ui/ai-chat-app/chatbot-sdk.js?ws=302&token=N2ZlNjFkZDItNDkyMy00Y2I1LWJlM2QtZDJlMzQ2YWM5OTE5"></script> | ||
{% endblock %} |