M17idd commited on
Commit
5b0f7c7
·
verified ·
1 Parent(s): 6a58328

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +66 -63
app.py CHANGED
@@ -10,12 +10,12 @@ from langchain.chat_models import ChatOpenAI
10
  from typing import List
11
  from together import Together
12
 
13
- # ----------------- تنظیمات صفحه -----------------
14
  import streamlit as st
15
 
 
16
  st.set_page_config(page_title="رزم یار ارتش", page_icon="🪖", layout="wide")
17
 
18
- # استایل سفارشی
19
  st.markdown("""
20
  <style>
21
  @import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');
@@ -25,103 +25,106 @@ st.markdown("""
25
  direction: rtl;
26
  text-align: right;
27
  }
28
-
29
- /* بکگراند اصلی */
30
  .stApp {
31
- background: linear-gradient(135deg, #f2f6fc, #d9e4f5);
32
- min-height: 100vh;
33
- padding: 0;
34
- margin: 0;
35
  }
36
-
37
- /* استایل پیام‌های چت */
38
- .stChatMessage {
39
- background: #ffffff;
40
- border: 1px solid #d1d5db;
41
- border-radius: 14px;
42
- padding: 16px;
43
- margin-bottom: 20px;
44
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
45
- animation: fadeIn 0.4s ease-in-out;
46
  }
47
-
48
- /* فیلدهای ورودی */
49
- .stTextInput > div > input, .stTextArea textarea {
50
- background: #f9fafb !important;
51
- border-radius: 8px !important;
52
- direction: rtl;
53
- text-align: right;
54
- font-family: 'Vazirmatn', Tahoma;
55
  }
56
-
57
- /* دکمه‌ها */
58
  .stButton>button {
59
- background: linear-gradient(90deg, #4e8a3e, #5cb85c) !important;
60
  color: white !important;
61
  font-weight: bold;
62
- border-radius: 12px;
63
- padding: 10px 24px;
64
- transition: all 0.3s ease;
65
- border: none;
66
  }
67
  .stButton>button:hover {
68
- background: linear-gradient(90deg, #3c6d30, #4cae4c) !important;
69
- transform: scale(1.03);
70
  }
71
-
72
- /* هدر صفحه */
73
  .header-text {
74
  text-align: center;
75
  margin-top: 20px;
76
- margin-bottom: 30px;
77
- background: rgba(255, 255, 255, 0.85);
78
- padding: 25px;
79
  border-radius: 20px;
80
- box-shadow: 0 6px 16px rgba(0,0,0,0.1);
81
  }
82
  .header-text h1 {
83
- font-size: 38px;
84
  color: #2c3e50;
85
- margin-bottom: 10px;
86
  font-weight: bold;
87
  }
88
  .subtitle {
89
  font-size: 18px;
90
  color: #34495e;
91
- margin-top: 5px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
93
-
94
- /* انیمیشن fadeIn */
95
  @keyframes fadeIn {
96
  from { opacity: 0; transform: translateY(10px); }
97
  to { opacity: 1; transform: translateY(0); }
98
  }
99
-
100
- /* منوی کناری */
101
- [data-testid="stSidebar"] {
102
- background: #ffffff;
103
- border-left: 1px solid #e6e6e6;
104
- padding: 20px;
105
- }
106
- [data-testid="stSidebar"] .css-1d391kg {
107
- gap: 10px;
108
- }
109
  </style>
110
  """, unsafe_allow_html=True)
111
 
112
- # لوگوی وسط
113
- col1, col2, col3 = st.columns([1, 0.2, 1])
114
- with col2:
115
- st.image("log.png", width=240)
116
-
117
- # هدر اصلی
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  st.markdown("""
119
  <div class="header-text">
120
  <h1>رزم یار ارتش</h1>
121
- <div class="subtitle">دستیار هوشمند و همراه شما در مسیر موفقیت</div>
122
  </div>
123
  """, unsafe_allow_html=True)
124
 
 
 
 
 
 
 
 
125
 
126
  # ----------------- لود PDF و ساخت ایندکس -----------------
127
  class TogetherEmbeddings(Embeddings):
 
10
  from typing import List
11
  from together import Together
12
 
 
13
  import streamlit as st
14
 
15
+ # ----------------- تنظیمات صفحه -----------------
16
  st.set_page_config(page_title="رزم یار ارتش", page_icon="🪖", layout="wide")
17
 
18
+ # ----------------- استایل سفارشی -----------------
19
  st.markdown("""
20
  <style>
21
  @import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');
 
25
  direction: rtl;
26
  text-align: right;
27
  }
 
 
28
  .stApp {
29
+ background: linear-gradient(to left, #f0f4f7, #d9e2ec);
 
 
 
30
  }
31
+ .sidebar .sidebar-content {
32
+ background-color: #ffffff;
33
+ border-left: 2px solid #4e8a3e;
34
+ padding-top: 20px;
 
 
 
 
 
 
35
  }
36
+ .sidebar .sidebar-content div {
37
+ margin-bottom: 20px;
38
+ font-weight: bold;
39
+ color: #2c3e50;
 
 
 
 
40
  }
 
 
41
  .stButton>button {
42
+ background-color: #4e8a3e !important;
43
  color: white !important;
44
  font-weight: bold;
45
+ border-radius: 10px;
46
+ padding: 8px 20px;
47
+ transition: 0.3s;
 
48
  }
49
  .stButton>button:hover {
50
+ background-color: #3c6d30 !important;
 
51
  }
 
 
52
  .header-text {
53
  text-align: center;
54
  margin-top: 20px;
55
+ margin-bottom: 40px;
56
+ background-color: rgba(255, 255, 255, 0.8);
57
+ padding: 20px;
58
  border-radius: 20px;
59
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
60
  }
61
  .header-text h1 {
62
+ font-size: 42px;
63
  color: #2c3e50;
64
+ margin: 0;
65
  font-weight: bold;
66
  }
67
  .subtitle {
68
  font-size: 18px;
69
  color: #34495e;
70
+ margin-top: 8px;
71
+ }
72
+ .chat-message {
73
+ background-color: rgba(255, 255, 255, 0.9);
74
+ border: 1px solid #4e8a3e;
75
+ border-radius: 12px;
76
+ padding: 16px;
77
+ margin-bottom: 15px;
78
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
79
+ }
80
+ .stTextInput>div>input, .stTextArea textarea {
81
+ background-color: rgba(255,255,255,0.9) !important;
82
+ border-radius: 8px !important;
83
+ direction: rtl;
84
+ text-align: right;
85
+ font-family: 'Vazirmatn', Tahoma;
86
  }
 
 
87
  @keyframes fadeIn {
88
  from { opacity: 0; transform: translateY(10px); }
89
  to { opacity: 1; transform: translateY(0); }
90
  }
 
 
 
 
 
 
 
 
 
 
91
  </style>
92
  """, unsafe_allow_html=True)
93
 
94
+ # ----------------- بدنه اصلی -----------------
95
+ with st.sidebar:
96
+ st.image("log.png", width=180)
97
+ st.markdown("### 🛡️ منو")
98
+ st.button("گفتگوی جدید")
99
+ st.button("تاریخچه")
100
+ st.markdown("---")
101
+ st.markdown("### 📚 مدل‌های هوش مصنوعی")
102
+ st.button("مدل ها")
103
+ st.markdown("### ✍️ تولید محتوا")
104
+ st.button("متن و تصویر")
105
+ st.markdown("### 🧭 دستیارها")
106
+ st.button("دستیار ویژه")
107
+ st.markdown("### 🛠️ ابزارها")
108
+ st.button("ابزار مالی")
109
+ st.markdown("---")
110
+ st.button("⚙️ تنظیمات")
111
+ st.button("❓ پشتیبانی")
112
+
113
+ # محتوای اصلی
114
  st.markdown("""
115
  <div class="header-text">
116
  <h1>رزم یار ارتش</h1>
117
+ <div class="subtitle">دستیار هوشمند ارتشی برای پشتیبانی و راهبری</div>
118
  </div>
119
  """, unsafe_allow_html=True)
120
 
121
+ st.markdown('<div class="chat-message">👋 سلام! چطور میتونم کمکتون کنم؟</div>', unsafe_allow_html=True)
122
+
123
+ # کادر چت کاربر
124
+ user_input = st.text_input("پیام خود را وارد کنید...")
125
+
126
+ if user_input:
127
+ st.markdown(f'<div class="chat-message">📩 شما: {user_input}</div>', unsafe_allow_html=True)
128
 
129
  # ----------------- لود PDF و ساخت ایندکس -----------------
130
  class TogetherEmbeddings(Embeddings):