TechitoTamani commited on
Commit
8debeb6
·
verified ·
1 Parent(s): 4303ce9

Upload 4 files

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. src/IMG_1358.jpg +3 -0
  3. src/streamlit_app.py +449 -40
  4. src/style.css +86 -0
  5. src/tools.json +105 -0
.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  IMG_1358.jpg filter=lfs diff=lfs merge=lfs -text
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  IMG_1358.jpg filter=lfs diff=lfs merge=lfs -text
37
+ src/IMG_1358.jpg filter=lfs diff=lfs merge=lfs -text
src/IMG_1358.jpg ADDED

Git LFS Details

  • SHA256: d38ac1274f2ddc0ed304fa12676766328aaa3b0f4a1abf926ce0ee1bcf6eb87e
  • Pointer size: 131 Bytes
  • Size of remote file: 463 kB
src/streamlit_app.py CHANGED
@@ -1,40 +1,449 @@
1
- import altair as alt
2
- import numpy as np
3
- import pandas as pd
4
- import streamlit as st
5
-
6
- """
7
- # Welcome to Streamlit!
8
-
9
- Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:.
10
- If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
11
- forums](https://discuss.streamlit.io).
12
-
13
- In the meantime, below is an example of what you can do with just a few lines of code:
14
- """
15
-
16
- num_points = st.slider("Number of points in spiral", 1, 10000, 1100)
17
- num_turns = st.slider("Number of turns in spiral", 1, 300, 31)
18
-
19
- indices = np.linspace(0, 1, num_points)
20
- theta = 2 * np.pi * num_turns * indices
21
- radius = indices
22
-
23
- x = radius * np.cos(theta)
24
- y = radius * np.sin(theta)
25
-
26
- df = pd.DataFrame({
27
- "x": x,
28
- "y": y,
29
- "idx": indices,
30
- "rand": np.random.randn(num_points),
31
- })
32
-
33
- st.altair_chart(alt.Chart(df, height=700, width=700)
34
- .mark_point(filled=True)
35
- .encode(
36
- x=alt.X("x", axis=None),
37
- y=alt.Y("y", axis=None),
38
- color=alt.Color("idx", legend=None, scale=alt.Scale()),
39
- size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])),
40
- ))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from datetime import datetime, timedelta
3
+ import pytz
4
+ from google_auth_oauthlib.flow import Flow
5
+ from google.oauth2.credentials import Credentials
6
+ from googleapiclient.discovery import build
7
+ from googleapiclient.errors import HttpError
8
+ from transformers import AutoModelForCausalLM, AutoTokenizer
9
+ import torch
10
+ import json
11
+ import re
12
+ import ast
13
+ import base64
14
+ import smtplib
15
+ from email.mime.text import MIMEText
16
+ from email.mime.multipart import MIMEMultipart
17
+
18
+ st.set_page_config(page_title="ChronoCall-Q", page_icon="🗓️")
19
+
20
+ st.markdown("""
21
+ <style>
22
+ /* เปลี่ยนกรอบหลักให้เป็นสีม่วง */
23
+ div[data-baseweb="input"] > div {
24
+ border: 2px solid #a020f0 !important;
25
+ border-radius: 6px;
26
+ padding: 2px;
27
+ box-shadow: none !important;
28
+ }
29
+
30
+ /* ตอน focus แล้ว */
31
+ div[data-baseweb="input"] > div:focus-within {
32
+ border: 2px solid #a020f0 !important;
33
+ box-shadow: 0 0 0 2px rgba(160, 32, 240, 0.3) !important;
34
+ }
35
+
36
+ /* input ด้านในไม่ให้แสดงเงาสีแดงเลย */
37
+ input {
38
+ border: none !important;
39
+ outline: none !important;
40
+ box-shadow: none !important;
41
+ }
42
+
43
+ /* ลบพวกกรอบแดงที่แอบซ่อนอยู่ */
44
+ .css-1cpxqw2, .css-1d391kg, .css-1y4p8pa {
45
+ border: 2px solid #a020f0 !important;
46
+ box-shadow: none !important;
47
+ }
48
+
49
+ /* force กล่อง input ให้ไม่ใช้สีแดงแม้จะ error */
50
+ div:has(input:focus) {
51
+ border-color: #a020f0 !important;
52
+ }
53
+
54
+ /* เปลี่ยนสีข้อความหัวข้อเป็นม่วงเมื่อ hover */
55
+ details:hover > summary {
56
+ color: #9D00FF !important;
57
+ font-weight: bold;
58
+ }
59
+
60
+ /* เปลี่ยนสี caret ^ (ไอคอนสามเหลี่ยม) ตอน hover */
61
+ details:hover summary::-webkit-details-marker {
62
+ color: #9D00FF !important;
63
+ }
64
+ </style>
65
+ """, unsafe_allow_html=True)
66
+
67
+
68
+ # --- Model ---
69
+
70
+ def convert_to_dict(text):
71
+ match = re.search(r"<tool_call>\n(.*?)\n</tool_call>", text)
72
+
73
+ if match:
74
+ tool_dict_str = match.group(1)
75
+ try:
76
+ result = ast.literal_eval(tool_dict_str)
77
+ return(result)
78
+ except Exception as e:
79
+ return({})
80
+ else:
81
+ return({})
82
+
83
+ # --- Model ---
84
+
85
+ model_name_or_path = "TechitoTamani/Qwen3-0.6B_FinetuneWithMyData-Merged"
86
+
87
+ with open('tools.json', 'r', encoding='utf-8') as f:
88
+ TOOLS = json.load(f)
89
+
90
+ @st.cache_resource
91
+ def load_model_and_tokenizer():
92
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
93
+ model = AutoModelForCausalLM.from_pretrained(
94
+ model_name_or_path,
95
+ torch_dtype=torch.bfloat16,
96
+ device_map="auto",
97
+ trust_remote_code=True,
98
+ )
99
+ return tokenizer, model
100
+
101
+ tokenizer, model = load_model_and_tokenizer()
102
+
103
+ def get_model_answer(messages):
104
+ text = tokenizer.apply_chat_template(
105
+ messages,
106
+ tokenize=False,
107
+ add_generation_prompt=True,
108
+ tools=TOOLS,
109
+ enable_thinking=False
110
+ )
111
+ inputs = tokenizer(text, return_tensors="pt").to(model.device)
112
+ with torch.no_grad():
113
+ outputs = model.generate(**inputs, max_new_tokens=128)
114
+ output_text = tokenizer.batch_decode(outputs)[0][len(text):]
115
+ return output_text
116
+
117
+ # --- Calendar ---
118
+
119
+ SCOPES = ['https://www.googleapis.com/auth/calendar']
120
+
121
+ with open("style.css") as f:
122
+ st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
123
+
124
+ def get_base64_image(image_path):
125
+ with open(image_path, "rb") as img_file:
126
+ b64_data = base64.b64encode(img_file.read()).decode()
127
+ return b64_data
128
+
129
+ def create_flow():
130
+ return Flow.from_client_config(
131
+ {
132
+ "web": {
133
+ "client_id": st.secrets["client_id"],
134
+ "client_secret": st.secrets["client_secret"],
135
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
136
+ "token_uri": "https://oauth2.googleapis.com/token",
137
+ "redirect_uris": [st.secrets["redirect_uri"]],
138
+ }
139
+ },
140
+ scopes=SCOPES,
141
+ redirect_uri=st.secrets["redirect_uri"]
142
+ )
143
+
144
+ def generate_auth_url(flow):
145
+ auth_url, _ = flow.authorization_url(prompt='consent', access_type='offline', include_granted_scopes='true')
146
+ return auth_url
147
+
148
+ def create_service(creds):
149
+ return build("calendar", "v3", credentials=creds)
150
+
151
+ # --- Adding ---
152
+
153
+ def extract_time_or_dash(iso_time: str) -> str:
154
+ try:
155
+ dt = datetime.fromisoformat(iso_time)
156
+
157
+ if "T" in iso_time:
158
+ return dt.strftime("%H:%M")
159
+ else:
160
+ return "-"
161
+ except ValueError:
162
+ return "-"
163
+
164
+ def handle_calendar_action(service, action_data):
165
+ name = action_data.get("name")
166
+ args = action_data.get("arguments", {})
167
+
168
+ if name == "add_event_date":
169
+ date_str = args["date"]
170
+ time_str = args["time"]
171
+ title = args["title"]
172
+
173
+ dt_start = datetime.strptime(f"{date_str} {time_str}", "%Y-%m-%d %H:%M")
174
+ dt_end = dt_start + timedelta(hours=1)
175
+
176
+ event = {
177
+ 'summary': title,
178
+ 'start': {
179
+ 'dateTime': dt_start.isoformat(),
180
+ 'timeZone': 'Asia/Bangkok',
181
+ },
182
+ 'end': {
183
+ 'dateTime': dt_end.isoformat(),
184
+ 'timeZone': 'Asia/Bangkok',
185
+ },
186
+ }
187
+
188
+ created = service.events().insert(calendarId='primary', body=event).execute()
189
+ st.success(f"✅ เพิ่มกิจกรรม: {title} [ดูใน Calendar]({created.get('htmlLink')})")
190
+
191
+ elif name == "delete_event_date":
192
+ date_str = args["date"]
193
+ title = args["title"]
194
+ events = get_events_by_date_and_title(service, date_str, title)
195
+ if events:
196
+ for event in events:
197
+ service.events().delete(calendarId='primary', eventId=event['id']).execute()
198
+ st.success(f"🗑 ลบนัด: {title} ในวันที่ {date_str} แล้ว")
199
+ else:
200
+ st.warning(f"ไม่พบนัด: {title} ในวันที่ {date_str}")
201
+
202
+ elif name == "update_event":
203
+ date_str = args["date"]
204
+ new_time_str = args["time"]
205
+ title = args["title"]
206
+ events = get_events_by_date_and_title(service, date_str, title)
207
+
208
+ if events:
209
+ for event in events:
210
+ new_start = datetime.strptime(f"{date_str} {new_time_str}", "%Y-%m-%d %H:%M")
211
+ new_end = new_start + timedelta(hours=1)
212
+ event["start"]["dateTime"] = new_start.isoformat()
213
+ event["end"]["dateTime"] = new_end.isoformat()
214
+ service.events().update(calendarId='primary', eventId=event["id"], body=event).execute()
215
+ st.success(f"✏️ เปลี่ยนเวลานัด: {title} เป็น {new_time_str}")
216
+ else:
217
+ st.warning(f"ไม่พบนัด: {title} ในวันที่ {date_str}")
218
+
219
+ elif name == "view_event_date":
220
+ date_str = args["date"]
221
+ events = get_events_by_date(service, date_str)
222
+ if not events:
223
+ st.info("ไม่มีนัดในวันนี้")
224
+ else:
225
+ st.write(f"📅 นัดทั้งหมดในวันที่ {date_str}:")
226
+ for e in events:
227
+ date = e['start'].get('dateTime', e['start'].get('date'))
228
+ time = extract_time_or_dash(date)
229
+ st.write(f"- {e['summary']} เวลา: {time}")
230
+
231
+ def get_events_by_date(service, date_str):
232
+ date_obj = datetime.strptime(date_str, "%Y-%m-%d")
233
+ start = date_obj.strftime("%Y-%m-%dT00:00:00Z")
234
+ end = (date_obj + timedelta(days=1)).strftime("%Y-%m-%dT00:00:00Z")
235
+
236
+ # # DEBUG
237
+ # st.write(f"Fetching events for date: {date_str}")
238
+ # st.write(f"timeMin = {start}, timeMax = {end}")
239
+
240
+ try:
241
+ events_result = service.events().list(
242
+ calendarId='primary',
243
+ timeMin=start,
244
+ timeMax=end,
245
+ singleEvents=True,
246
+ orderBy='startTime'
247
+ ).execute()
248
+ return events_result.get('items', [])
249
+
250
+ except HttpError as error:
251
+ st.error(f"❌ Google Calendar API error: {error}")
252
+ return []
253
+
254
+ except Exception as e:
255
+ st.error(f"❌ Unknown error: {e}")
256
+ return []
257
+
258
+ def get_events_by_date_and_title(service, date_str, title):
259
+ events = get_events_by_date(service, date_str)
260
+ return [e for e in events if e.get("summary") == title]
261
+
262
+ # --- Email ---
263
+
264
+ sender = st.secrets["email"]["sender"]
265
+ receiver = st.secrets["email"]["receiver"]
266
+ password = st.secrets["email"]["password"]
267
+
268
+ def send_email(user_email):
269
+ subject = "New Beta Tester - ChronoCall-Q"
270
+ body = f"""\
271
+ มีผู้สนใจเข้าร่วม Beta Test
272
+ อีเมล: {user_email}
273
+ """
274
+
275
+ msg = MIMEMultipart()
276
+ msg["From"] = sender
277
+ msg["To"] = receiver
278
+ msg["Subject"] = subject
279
+ msg.attach(MIMEText(body, "plain"))
280
+
281
+ try:
282
+ with smtplib.SMTP_SSL("smtp.gmail.com", 465) as server:
283
+ server.login(sender, password)
284
+ server.sendmail(sender, receiver, msg.as_string())
285
+ return True
286
+ except Exception as e:
287
+ st.error(f"เกิดข้อผิดพลาด: {e}")
288
+ return False
289
+
290
+ # --- Streamlit ---
291
+
292
+ def main():
293
+
294
+ # ดึง query params
295
+ params = st.query_params
296
+ code = params.get("code", None)
297
+
298
+ # ถ้ายังไม่ได้ login
299
+ if "credentials" not in st.session_state:
300
+ if code:
301
+ flow = create_flow()
302
+ try:
303
+ flow.fetch_token(code=code)
304
+ creds = flow.credentials
305
+ st.session_state["credentials"] = {
306
+ "token": creds.token,
307
+ "refresh_token": creds.refresh_token,
308
+ "token_uri": creds.token_uri,
309
+ "client_id": creds.client_id,
310
+ "client_secret": creds.client_secret,
311
+ "scopes": creds.scopes
312
+ }
313
+ st.success("🎉 ล็อกอินสำเร็จ! พร้อมใช้งานแล้ว")
314
+ st.rerun()
315
+ except Exception as e:
316
+ st.error(f"เกิดข้อผิดพลาด: {e}")
317
+ return
318
+ else:
319
+ flow = create_flow()
320
+ auth_url = generate_auth_url(flow)
321
+
322
+ # --- Title + Login ---
323
+
324
+ st.markdown(f"""
325
+ <!-- ชื่อ -->
326
+ <div class="fade-in-title custom-title">ChronoCall-Q</div>
327
+
328
+ <!-- ปุ่ม ล่าช้า -->
329
+ <div class="fade-in-button login-button">
330
+ <a href="{auth_url}" target="_blank" rel="noopener noreferrer">
331
+ <button>Login with Google</button>
332
+ </a>
333
+ </div>
334
+ """, unsafe_allow_html=True)
335
+
336
+ # --- Emali sender ---
337
+
338
+ st.markdown("""
339
+ <div class="fade-in-up">
340
+ <p>ถ้า <strong>Login ไม่ได้ใช่ไหม?</strong><br>ไม่เป็นไร! ส่งคำขอเข้าร่วม Beta Test มาให้เราก่อนได้เลย</p>
341
+ </div>
342
+ """, unsafe_allow_html=True)
343
+
344
+ email = st.text_input("กรอกอีเมลของคุณที่นี่")
345
+
346
+ if st.button("ส่งคำขอเข้าร่วม Beta Test"):
347
+ if email:
348
+ if send_email(email):
349
+ st.success("ส่งคำขอเรียบร้อยแล้ว!")
350
+ else:
351
+ st.error("เกิดข้อผิดพลาดในการส่ง กรุณาลองใหม่อีกครั้ง")
352
+ else:
353
+ st.warning("กรุณากรอกอีเมลก่อนกดส่ง")
354
+
355
+ # --- pic ---
356
+
357
+ img_b64 = get_base64_image("IMG_1358.jpg")
358
+
359
+ st.markdown(f'''
360
+ <img src="data:image/jpeg;base64,{img_b64}" class="fade-in-image">
361
+ ''', unsafe_allow_html=True)
362
+
363
+ st.stop()
364
+
365
+ # Logged in
366
+ creds = Credentials(**st.session_state["credentials"])
367
+ service = create_service(creds)
368
+
369
+ st.title("ChronoCall-Q")
370
+ st.caption("วิธีใช้งาน")
371
+
372
+ with st.expander("การเพิ่มเหตุการณ์ (Add Event)"):
373
+ st.markdown("""
374
+ เพื่อเพิ่มเหตุการณ์ใหม่ ต้องระบุ:
375
+ - **ชื่อเหตุการณ์**
376
+ - **วันที่**
377
+ - **เวลา**
378
+
379
+ > **ตัวอย่าง:** เพิ่มนัดประชุมพรุ่งนี้ตอนสิบโมง
380
+ """)
381
+
382
+ with st.expander("การลบเหตุการณ์ (Delete Event)"):
383
+ st.markdown("""
384
+ เพื่อทำการลบเหตุการณ์ ต้องระบุ:
385
+ - **ชื��อเหตุการณ์**
386
+ - **วันที่**
387
+
388
+ > **ตัวอย่าง:** เพิ่มนัดประชุมพรุ่งนี้ตอนสิบโมง
389
+ """)
390
+
391
+ with st.expander("การอัปเดตเหตุการณ์ (Update Event)"):
392
+ st.markdown("""
393
+ เพื่อเปลี่ยนเวลาเหตุการณ์ในวันเดียวกัน ต้องระบุ:
394
+ - **ชื่อเหตุการณ์**
395
+ - **วันที่**
396
+ - **เวลาใหม่**
397
+
398
+ > **ตัวอย่าง:** เปลี่ยนนัดประชุมพรุ่งนี้เป็นสิบเอ็ดโมง
399
+ """)
400
+
401
+ with st.expander("การดูเหตุการณ์ (View Events)"):
402
+ st.markdown("""
403
+ เพื่อดูรายการเหตุการณ์ในวันใดวันหนึ่ง ต้องระบุ:
404
+ - **วันที่ที่ต้องการดู**
405
+
406
+ > **ตัวอย่าง:** พรุ่งนี้มีนัดอะไรบ้าง
407
+ """)
408
+
409
+ if "user_input" not in st.session_state:
410
+ st.session_state.user_input = ""
411
+
412
+ messages = [
413
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.\n\nCurrent Date: 2025-06-07.\n\nCurrent Day: Saturday."},
414
+ ]
415
+
416
+
417
+ user_input = st.text_input("พิมพ์คำสั่งที่นี่ แล้วกด Enter หรือกดปุ่มยืนยัน", value=st.session_state.user_input, key="input")
418
+
419
+ submit_button = st.button("ยืนยัน")
420
+
421
+ if (user_input and user_input != st.session_state.user_input) or submit_button:
422
+
423
+ bangkok_tz = pytz.timezone("Asia/Bangkok")
424
+ now = datetime.now(bangkok_tz)
425
+ current_date = now.strftime("%Y-%m-%d")
426
+ current_day = now.strftime("%A")
427
+
428
+ messages = [
429
+ {
430
+ "role": "system",
431
+ "content": f"You are Qwen, created by Alibaba Cloud. You are a helpful assistant.\n\nCurrent Date: {current_date}.\n\nCurrent Day: {current_day}."
432
+ },
433
+ {
434
+ "role": "user",
435
+ "content": user_input
436
+ }
437
+ ]
438
+
439
+ with st.spinner("โมเดลกำลังคิด..."):
440
+ response = get_model_answer(messages)
441
+
442
+ st.success(f"Chrono: {response}")
443
+ func_call_dict = convert_to_dict(response)
444
+ handle_calendar_action(service, func_call_dict)
445
+
446
+ st.session_state.user_input = ""
447
+
448
+ if __name__ == "__main__":
449
+ main()
src/style.css ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @keyframes fadeInTitle {
2
+ from { opacity: 0; transform: translateY(-20px); }
3
+ to { opacity: 1; transform: translateY(0); }
4
+ }
5
+
6
+ @keyframes fadeInButton {
7
+ from { opacity: 0; transform: translateY(20px); }
8
+ to { opacity: 1; transform: translateY(0); }
9
+ }
10
+
11
+ .fade-in-title {
12
+ animation: fadeInTitle 1s ease-out;
13
+ }
14
+
15
+ .fade-in-button {
16
+ animation: fadeInButton 1s ease-out;
17
+ animation-delay: 1s;
18
+ animation-fill-mode: both;
19
+ }
20
+
21
+ .custom-title {
22
+ font-size: 60px;
23
+ font-weight: 800;
24
+ color: #ffffff;
25
+ text-align: center;
26
+ margin-bottom: 30px;
27
+ }
28
+
29
+ .login-button {
30
+ display: flex;
31
+ justify-content: center;
32
+ }
33
+
34
+ .login-button a button {
35
+ background-color: #663399;
36
+ border: none;
37
+ color: white;
38
+ padding: 10px 24px;
39
+ font-size: 16px;
40
+ border-radius: 8px;
41
+ cursor: pointer;
42
+ font-weight: bold;
43
+ box-shadow: 0 4px 10px rgba(106, 13, 173, 0.5);
44
+ transition: background-color 0.3s ease, box-shadow 0.3s ease;
45
+ }
46
+
47
+ .login-button a button:hover {
48
+ background-color: #7b29e1;
49
+ box-shadow: 0 6px 14px rgba(123, 41, 225, 0.7);
50
+ }
51
+
52
+ @keyframes fadeIn {
53
+ from {opacity: 0;}
54
+ to {opacity: 1;}
55
+ }
56
+
57
+ .fade-in-image {
58
+ animation: fadeIn 1.5s ease-in forwards;
59
+ width: 100%;
60
+ max-width: 600px;
61
+ border-radius: 15px;
62
+ box-shadow: 0 4px 15px rgba(0,0,0,0.2);
63
+ display: block;
64
+ margin: 40px auto 40px auto; /* เพิ่ม margin-top 40px */
65
+ }
66
+
67
+ @keyframes fadeInUp {
68
+ from {
69
+ opacity: 0;
70
+ transform: translateY(20px);
71
+ }
72
+ to {
73
+ opacity: 1;
74
+ transform: translateY(0);
75
+ }
76
+ }
77
+ .fade-in-up {
78
+ opacity: 0;
79
+ animation: fadeInUp 1s ease forwards;
80
+ animation-delay: 1.5s;
81
+ margin-top: 40px;
82
+ margin-bottom: 20px;
83
+ color: #ffffff;
84
+ font-size: 16px;
85
+ text-align: center;
86
+ }
src/tools.json ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "function",
4
+ "function": {
5
+ "name": "add_event_date",
6
+ "description": "Add event by title and date.",
7
+ "parameters": {
8
+ "type": "object",
9
+ "properties": {
10
+ "title": {
11
+ "type": "string",
12
+ "description": "The title of event ."
13
+ },
14
+ "date": {
15
+ "type": "string",
16
+ "description": "The date to add events for, in the format \"Year-Month-Day\". The selected date must be within one year from Current Date."
17
+ },
18
+ "time": {
19
+ "type": "string",
20
+ "description": "Optional. The time to add events at, in the format \"HH:MM\". Leave blank if not applicable."
21
+ }
22
+ },
23
+ "required": [
24
+ "title",
25
+ "date"
26
+ ]
27
+ }
28
+ }
29
+ },
30
+ {
31
+ "type": "function",
32
+ "function": {
33
+ "name": "delete_event_date",
34
+ "description": "Delete event by title and date.",
35
+ "parameters": {
36
+ "type": "object",
37
+ "properties": {
38
+ "title": {
39
+ "type": "string",
40
+ "description": "The title of event that want to delete."
41
+ },
42
+ "date": {
43
+ "type": "string",
44
+ "description": "The date to delete events for, in the format \"Year-Month-Day\". The selected date must be within one year from Current Date."
45
+ }
46
+ },
47
+ "required": [
48
+ "title",
49
+ "date"
50
+ ]
51
+ }
52
+ }
53
+ },
54
+ {
55
+ "type": "function",
56
+ "function": {
57
+ "name": "update_event",
58
+ "description": "update event by title and date.",
59
+ "parameters": {
60
+ "type": "object",
61
+ "properties": {
62
+ "title": {
63
+ "type": "string",
64
+ "description": "The title of event that want to update."
65
+ },
66
+ "date": {
67
+ "type": "string",
68
+ "description": "The date to update events for, in the format \"Year-Month-Day\". The selected date must be within one year from Current Date."
69
+ },
70
+ "time": {
71
+ "type": "string",
72
+ "description": "Optional. The time to update events at, in the format \"HH:MM\". Leave blank if not applicable."
73
+ }
74
+ },
75
+ "required": [
76
+ "title",
77
+ "date"
78
+ ]
79
+ }
80
+ }
81
+ },
82
+ {
83
+ "type": "function",
84
+ "function": {
85
+ "name": "view_event_date",
86
+ "description": "view event by date.",
87
+ "parameters": {
88
+ "type": "object",
89
+ "properties": {
90
+ "date": {
91
+ "type": "string",
92
+ "description": "The date to view events for, in the format \"Year-Month-Day\". The selected date must be within one year from Current Date."
93
+ },
94
+ "time": {
95
+ "type": "string",
96
+ "description": "Optional. The time to view events at, in the format \"HH:MM\". Leave blank if not applicable."
97
+ }
98
+ },
99
+ "required": [
100
+ "date"
101
+ ]
102
+ }
103
+ }
104
+ }
105
+ ]