Spaces:
Sleeping
Sleeping
Commit ·
8806dd4
1
Parent(s): be6e828
fix: refine scroll logic, mobile layout, and AI formatting tone
Browse files- frontend/src/App.tsx +22 -14
- main.py +13 -11
frontend/src/App.tsx
CHANGED
|
@@ -31,10 +31,17 @@ const App: React.FC = () => {
|
|
| 31 |
setVerse(VERSES[dayOfYear % VERSES.length]);
|
| 32 |
}, []);
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
const handleSend = async () => {
|
| 40 |
if (!input.trim() || isLoading) return;
|
|
@@ -70,27 +77,27 @@ const App: React.FC = () => {
|
|
| 70 |
};
|
| 71 |
|
| 72 |
return (
|
| 73 |
-
<div className="h-
|
| 74 |
{/* Dynamic Background Elements */}
|
| 75 |
<div className="absolute top-[-20%] left-[-10%] w-[60%] h-[60%] bg-[#007055]/20 rounded-full blur-[150px] animate-pulse pointer-events-none"></div>
|
| 76 |
<div className="absolute bottom-[-20%] right-[-10%] w-[60%] h-[60%] bg-[#FDFBD4]/5 rounded-full blur-[150px] pointer-events-none"></div>
|
| 77 |
|
| 78 |
-
<div className="w-full max-w-5xl h-
|
| 79 |
|
| 80 |
{/* Modern Sidebar-style Header (Desktop) / Top Header (Mobile) */}
|
| 81 |
-
<aside className="w-full md:w-80 bg-[#00362B]/80 p-
|
| 82 |
-
<div className="relative group">
|
| 83 |
-
<div className="absolute -inset-1 bg-gradient-to-tr from-[#FDFBD4] to-[#007055] rounded-3xl blur opacity-25 group-hover:opacity-50 transition duration-1000 group-hover:duration-200"></div>
|
| 84 |
-
<div className="relative w-
|
| 85 |
<img src="/assets/logo.jpg" alt="CLCC Logo" className="w-full h-full object-cover" />
|
| 86 |
</div>
|
| 87 |
</div>
|
| 88 |
-
<div className="
|
| 89 |
-
<h1 className="text-
|
| 90 |
Theo AI
|
| 91 |
</h1>
|
| 92 |
-
<div className="inline-flex items-center px-3 py-1 bg-[#FDFBD4]/10 rounded-full border border-[#FDFBD4]/20">
|
| 93 |
-
<span className="text-[
|
| 94 |
CLCC - TECHDISCIPLES
|
| 95 |
</span>
|
| 96 |
</div>
|
|
@@ -148,6 +155,7 @@ const App: React.FC = () => {
|
|
| 148 |
}`}>
|
| 149 |
<div className={`markdown-content prose prose-invert prose-sm max-w-none
|
| 150 |
prose-p:leading-relaxed prose-headings:text-[#FDFBD4] prose-strong:text-[#FDFBD4]
|
|
|
|
| 151 |
${msg.role === 'assistant' ? 'selection:bg-[#FDFBD4]/30' : 'selection:bg-white/20'}
|
| 152 |
`}>
|
| 153 |
<ReactMarkdown>{msg.content}</ReactMarkdown>
|
|
|
|
| 31 |
setVerse(VERSES[dayOfYear % VERSES.length]);
|
| 32 |
}, []);
|
| 33 |
|
| 34 |
+
const isFirstRender = useRef(true);
|
| 35 |
+
|
| 36 |
+
useEffect(() => {
|
| 37 |
+
if (isFirstRender.current) {
|
| 38 |
+
isFirstRender.current = false;
|
| 39 |
+
return;
|
| 40 |
+
}
|
| 41 |
+
if (messages.length > 0) {
|
| 42 |
+
chatEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
| 43 |
+
}
|
| 44 |
+
}, [messages]);
|
| 45 |
|
| 46 |
const handleSend = async () => {
|
| 47 |
if (!input.trim() || isLoading) return;
|
|
|
|
| 77 |
};
|
| 78 |
|
| 79 |
return (
|
| 80 |
+
<div className="h-[100dvh] bg-[#002B22] flex flex-col items-center justify-center p-0 md:p-4 font-outfit text-white overflow-hidden relative">
|
| 81 |
{/* Dynamic Background Elements */}
|
| 82 |
<div className="absolute top-[-20%] left-[-10%] w-[60%] h-[60%] bg-[#007055]/20 rounded-full blur-[150px] animate-pulse pointer-events-none"></div>
|
| 83 |
<div className="absolute bottom-[-20%] right-[-10%] w-[60%] h-[60%] bg-[#FDFBD4]/5 rounded-full blur-[150px] pointer-events-none"></div>
|
| 84 |
|
| 85 |
+
<div className="w-full max-w-5xl h-full md:h-[92vh] flex flex-col md:flex-row relative z-10 bg-black/20 backdrop-blur-2xl md:rounded-[2.5rem] overflow-hidden border border-white/5 shadow-[0_32px_64px_-12px_rgba(0,0,0,0.5)]">
|
| 86 |
|
| 87 |
{/* Modern Sidebar-style Header (Desktop) / Top Header (Mobile) */}
|
| 88 |
+
<aside className="w-full md:w-80 bg-[#00362B]/80 p-4 md:p-8 flex flex-row md:flex-col items-center md:items-start space-x-4 md:space-x-0 md:space-y-8 border-b md:border-b-0 md:border-r border-white/5 shrink-0">
|
| 89 |
+
<div className="relative group shrink-0">
|
| 90 |
+
<div className="absolute -inset-1 bg-gradient-to-tr from-[#FDFBD4] to-[#007055] rounded-2xl md:rounded-3xl blur opacity-25 group-hover:opacity-50 transition duration-1000 group-hover:duration-200"></div>
|
| 91 |
+
<div className="relative w-12 h-12 md:w-32 md:h-32 rounded-xl md:rounded-[2rem] overflow-hidden border border-white/10 shadow-2xl transform transition-transform group-hover:scale-105 duration-500">
|
| 92 |
<img src="/assets/logo.jpg" alt="CLCC Logo" className="w-full h-full object-cover" />
|
| 93 |
</div>
|
| 94 |
</div>
|
| 95 |
+
<div className="flex-1 md:flex-none text-left space-y-1 md:space-y-2">
|
| 96 |
+
<h1 className="text-xl md:text-4xl font-black tracking-tighter bg-clip-text text-transparent bg-gradient-to-br from-white via-[#FDFBD4] to-[#007055]">
|
| 97 |
Theo AI
|
| 98 |
</h1>
|
| 99 |
+
<div className="inline-flex items-center px-2 py-0.5 md:px-3 md:py-1 bg-[#FDFBD4]/10 rounded-full border border-[#FDFBD4]/20">
|
| 100 |
+
<span className="text-[8px] md:text-[10px] font-bold text-[#FDFBD4] uppercase tracking-widest whitespace-nowrap">
|
| 101 |
CLCC - TECHDISCIPLES
|
| 102 |
</span>
|
| 103 |
</div>
|
|
|
|
| 155 |
}`}>
|
| 156 |
<div className={`markdown-content prose prose-invert prose-sm max-w-none
|
| 157 |
prose-p:leading-relaxed prose-headings:text-[#FDFBD4] prose-strong:text-[#FDFBD4]
|
| 158 |
+
prose-li:text-white/90 prose-ul:my-2
|
| 159 |
${msg.role === 'assistant' ? 'selection:bg-[#FDFBD4]/30' : 'selection:bg-white/20'}
|
| 160 |
`}>
|
| 161 |
<ReactMarkdown>{msg.content}</ReactMarkdown>
|
main.py
CHANGED
|
@@ -65,21 +65,23 @@ search = DuckDuckGoSearchRun()
|
|
| 65 |
# =====================================================
|
| 66 |
# PROMPT TEMPLATE
|
| 67 |
# =====================================================
|
| 68 |
-
SYSTEM_PROMPT = """You are Theo — a warm,
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
CORE GUIDELINES:
|
| 72 |
-
1. BIBLICAL
|
| 73 |
-
2.
|
| 74 |
-
3.
|
| 75 |
-
4. FORMATTING: Use clean Markdown (bolding, lists, tables) to make your replies easy to read.
|
| 76 |
-
5. UNKNOWN TOPICS: If you encounter a question you cannot answer with your spiritual knowledge or if it's a factual query outside your training, you MUST conduct a web search to provide accurate information, while still maintaining your Christian tone.
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
Logo: [CLCC logo](https://raw.githubusercontent.com/Alasela/Theo/main/assests/logo.png)
|
| 81 |
|
| 82 |
-
Remember:
|
| 83 |
|
| 84 |
# =====================================================
|
| 85 |
# MEMORY
|
|
|
|
| 65 |
# =====================================================
|
| 66 |
# PROMPT TEMPLATE
|
| 67 |
# =====================================================
|
| 68 |
+
SYSTEM_PROMPT = """You are Theo — a warm, friendly, and deeply insightful Christian companion created by TechDisciples CLCC.
|
| 69 |
+
|
| 70 |
+
TONE & STYLE:
|
| 71 |
+
1. CHATTY & WARM: Speak like a loving friend or a caring elder. Use a conversational, "chatty" tone that feels personal and welcoming.
|
| 72 |
+
2. PARAGRAPHS: NEVER send a single wall of text. Break your thoughts into 2-4 short, readable paragraphs. Each point should have its own breathing space.
|
| 73 |
+
3. NIGERIAN HEARTBEAT: Use simple, relatable English with a gentle Nigerian inflection. Be clear and accessible to everyone.
|
| 74 |
|
| 75 |
CORE GUIDELINES:
|
| 76 |
+
1. BIBLICAL FOCUS: Root your wisdom and encouragement in the Holy Bible. Use scripture to offer hope, especially for those in distress.
|
| 77 |
+
2. FORMATTING: Use Markdown (bolding for emphasis, short lists if needed) to keep your replies professional yet approachable.
|
| 78 |
+
3. UNKNOWN TOPICS: If you lack specific knowledge, use your web search tool to find facts, then wrap that information in your warm Christian perspective.
|
|
|
|
|
|
|
| 79 |
|
| 80 |
+
Identity: Theo
|
| 81 |
+
Creators: TechDisciples CLCC
|
| 82 |
+
Logo: [CLCC logo](https://raw.githubusercontent.com/Alasela/Theo/main/assests/logo.png)
|
| 83 |
|
| 84 |
+
Remember: Be a beacon of God's love. Keep your messages structured with clear paragraphs so they are easy to read in a chat window."""
|
| 85 |
|
| 86 |
# =====================================================
|
| 87 |
# MEMORY
|