fix ask-AI
This commit is contained in:
@ -16,7 +16,7 @@ auto_translate = false
|
|||||||
comment_moderation = false
|
comment_moderation = false
|
||||||
ask_ai = true
|
ask_ai = true
|
||||||
provider = "ollama"
|
provider = "ollama"
|
||||||
model = "gemma3:2b"
|
model = "gemma3:4b"
|
||||||
host = "https://ollama.syui.ai"
|
host = "https://ollama.syui.ai"
|
||||||
system_prompt = "you are a helpful ai assistant trained on this blog's content. you can answer questions about the articles, provide insights, and help users understand the topics discussed."
|
system_prompt = "you are a helpful ai assistant trained on this blog's content. you can answer questions about the articles, provide insights, and help users understand the topics discussed."
|
||||||
ai_did = "did:plc:4hqjfn7m6n5hno3doamuhgef"
|
ai_did = "did:plc:4hqjfn7m6n5hno3doamuhgef"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/css/*
|
/css/*
|
||||||
Content-Type: text/css
|
Content-Type: text/css
|
||||||
Cache-Control: public, max-age=60
|
Cache-Control: no-cache
|
||||||
|
|
||||||
/*.js
|
/*.js
|
||||||
Content-Type: application/javascript
|
Content-Type: application/javascript
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
# Ask-AI機能をOllamaにプロキシ
|
|
||||||
/api/ask https://ollama.syui.ai/api/generate 200
|
|
||||||
|
|
||||||
# OAuth routes
|
# OAuth routes
|
||||||
/oauth/* /oauth/index.html 200
|
/oauth/* /oauth/index.html 200
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ a.view-markdown:any-link {
|
|||||||
.container {
|
.container {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto auto 1fr auto;
|
grid-template-rows: auto 0fr 1fr auto;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"header"
|
"header"
|
||||||
"ask-ai"
|
"ask-ai"
|
||||||
@ -158,6 +158,15 @@ a.view-markdown:any-link {
|
|||||||
background: #f6f8fa;
|
background: #f6f8fa;
|
||||||
border-bottom: 1px solid #d1d9e0;
|
border-bottom: 1px solid #d1d9e0;
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ask-ai-panel[style*="block"] {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container:has(.ask-ai-panel[style*="block"]) {
|
||||||
|
grid-template-rows: auto auto 1fr auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ask-ai-content {
|
.ask-ai-content {
|
||||||
@ -193,13 +202,15 @@ a.view-markdown:any-link {
|
|||||||
grid-area: main;
|
grid-area: main;
|
||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 24px;
|
/* padding: 24px; */
|
||||||
|
padding-top: 80px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1000px) {
|
@media (max-width: 1000px) {
|
||||||
.main-content {
|
.main-content {
|
||||||
padding: 20px;
|
/* padding: 20px; */
|
||||||
|
padding: 0px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,6 +335,10 @@ a.view-markdown:any-link {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
article.article-content {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.article-meta {
|
.article-meta {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
@ -818,13 +833,13 @@ a.view-markdown:any-link {
|
|||||||
justify-self: end;
|
justify-self: end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ask AI button mobile style */
|
/* Ask AI button mobile style - icon only */
|
||||||
.ask-ai-btn {
|
.ask-ai-btn {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
min-width: 40px;
|
min-width: 40px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 0;
|
|
||||||
gap: 0;
|
gap: 0;
|
||||||
|
font-size: 0; /* Hide all text content */
|
||||||
}
|
}
|
||||||
|
|
||||||
.ask-ai-btn .ai-icon {
|
.ask-ai-btn .ai-icon {
|
||||||
|
@ -186,12 +186,7 @@ function updateAskAIButton() {
|
|||||||
const button = document.getElementById('askAiButton');
|
const button = document.getElementById('askAiButton');
|
||||||
if (!button) return;
|
if (!button) return;
|
||||||
|
|
||||||
const iconSpan = button.querySelector('.ai-icon');
|
// Only update text, never modify the icon
|
||||||
|
|
||||||
if (aiProfileData && aiProfileData.avatar && iconSpan) {
|
|
||||||
iconSpan.innerHTML = `<img src="${aiProfileData.avatar}" alt="${aiProfileData.displayName || 'AI'}" class="ai-avatar-small">`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aiProfileData && aiProfileData.displayName) {
|
if (aiProfileData && aiProfileData.displayName) {
|
||||||
const textNode = button.childNodes[2] || button.lastChild;
|
const textNode = button.childNodes[2] || button.lastChild;
|
||||||
if (textNode && textNode.nodeType === Node.TEXT_NODE) {
|
if (textNode && textNode.nodeType === Node.TEXT_NODE) {
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
<div id="chatForm" class="ask-ai-form" style="display: none;">
|
<div id="chatForm" class="ask-ai-form" style="display: none;">
|
||||||
<input type="text" id="aiQuestion" placeholder="What would you like to know?" />
|
<input type="text" id="aiQuestion" placeholder="What would you like to know?" />
|
||||||
<button onclick="AskAI.ask()" id="askButton">Ask</button>
|
<button onclick="askQuestion()" id="askButton">Ask</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="chatHistory" class="chat-history" style="display: none;"></div>
|
<div id="chatHistory" class="chat-history" style="display: none;"></div>
|
||||||
|
@ -18,7 +18,7 @@ AILOG_COLLECTION_CHAT=ai.syui.log.chat
|
|||||||
VITE_AI_ENABLED=true
|
VITE_AI_ENABLED=true
|
||||||
VITE_AI_ASK_AI=true
|
VITE_AI_ASK_AI=true
|
||||||
VITE_AI_PROVIDER=ollama
|
VITE_AI_PROVIDER=ollama
|
||||||
VITE_AI_MODEL=gemma3:2b
|
VITE_AI_MODEL=gemma3:4b
|
||||||
VITE_AI_HOST=https://ollama.syui.ai
|
VITE_AI_HOST=https://ollama.syui.ai
|
||||||
VITE_AI_SYSTEM_PROMPT="you are a helpful ai assistant trained on this blog's content. you can answer questions about the articles, provide insights, and help users understand the topics discussed."
|
VITE_AI_SYSTEM_PROMPT="you are a helpful ai assistant trained on this blog's content. you can answer questions about the articles, provide insights, and help users understand the topics discussed."
|
||||||
VITE_AI_DID=did:plc:4hqjfn7m6n5hno3doamuhgef
|
VITE_AI_DID=did:plc:4hqjfn7m6n5hno3doamuhgef
|
||||||
|
Reference in New Issue
Block a user