alicemputer commited on
Commit
f84033a
·
1 Parent(s): 80d53e6

revizasyon

Browse files
.gitignore CHANGED
@@ -1 +1,6 @@
1
  echo "data/" >> .gitignore
 
 
 
 
 
 
1
  echo "data/" >> .gitignore
2
+ .venv
3
+ data/credentials.json
4
+ /data/
5
+ data/token.pickle
6
+ data/token.json
.idea/workspace.xml CHANGED
@@ -5,7 +5,12 @@
5
  </component>
6
  <component name="ChangeListManager">
7
  <list default="true" id="96c7272a-4c8a-47ac-bf86-03c5be4b1fda" name="Changes" comment="">
 
8
  <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
 
 
 
 
9
  </list>
10
  <option name="SHOW_DIALOG" value="false" />
11
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -41,7 +46,7 @@
41
  &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
42
  &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
43
  &quot;git-widget-placeholder&quot;: &quot;main&quot;,
44
- &quot;last_opened_file_path&quot;: &quot;C:/Users/alcmd/Desktop/YAZILIM/AI_Agents&quot;,
45
  &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
46
  &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
47
  &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
@@ -135,6 +140,11 @@
135
  <workItem from="1746281533552" duration="17593000" />
136
  <workItem from="1746482078197" duration="47000" />
137
  <workItem from="1746482266213" duration="53000" />
 
 
 
 
 
138
  </task>
139
  <servers />
140
  </component>
@@ -152,8 +162,19 @@
152
  </map>
153
  </option>
154
  </component>
 
 
 
 
 
 
 
 
 
 
 
155
  <component name="com.intellij.coverage.CoverageDataManagerImpl">
156
- <SUITE FILE_PATH="coverage/Daily_Plan_Agent$app.coverage" NAME="app Coverage Results" MODIFIED="1746478808692" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
157
  <SUITE FILE_PATH="coverage/Daily_Plan_Agent$Python_Console.coverage" NAME="Python Console Coverage Results" MODIFIED="1746281551614" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
158
  </component>
159
  </project>
 
5
  </component>
6
  <component name="ChangeListManager">
7
  <list default="true" id="96c7272a-4c8a-47ac-bf86-03c5be4b1fda" name="Changes" comment="">
8
+ <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
9
  <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
10
+ <change beforePath="$PROJECT_DIR$/data/gecici.py" beforeDir="false" afterPath="$PROJECT_DIR$/data/gecici.py" afterDir="false" />
11
+ <change beforePath="$PROJECT_DIR$/tools/calendar_reader.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/calendar_reader.py" afterDir="false" />
12
+ <change beforePath="$PROJECT_DIR$/tools/gmail_sender.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/gmail_sender.py" afterDir="false" />
13
+ <change beforePath="$PROJECT_DIR$/tools/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/planner.py" afterDir="false" />
14
  </list>
15
  <option name="SHOW_DIALOG" value="false" />
16
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
 
46
  &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
47
  &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
48
  &quot;git-widget-placeholder&quot;: &quot;main&quot;,
49
+ &quot;last_opened_file_path&quot;: &quot;C:/Users/alcmd/Desktop/YAZILIM/AI_Agents/smolagents&quot;,
50
  &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
51
  &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
52
  &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
 
140
  <workItem from="1746281533552" duration="17593000" />
141
  <workItem from="1746482078197" duration="47000" />
142
  <workItem from="1746482266213" duration="53000" />
143
+ <workItem from="1746482351417" duration="898000" />
144
+ <workItem from="1746553994718" duration="7038000" />
145
+ <workItem from="1746625910321" duration="21000" />
146
+ <workItem from="1746654966069" duration="12794000" />
147
+ <workItem from="1746904499805" duration="1935000" />
148
  </task>
149
  <servers />
150
  </component>
 
162
  </map>
163
  </option>
164
  </component>
165
+ <component name="XDebuggerManager">
166
+ <breakpoint-manager>
167
+ <breakpoints>
168
+ <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
169
+ <url>file://$PROJECT_DIR$/tools/planner.py</url>
170
+ <line>1</line>
171
+ <option name="timeStamp" value="2" />
172
+ </line-breakpoint>
173
+ </breakpoints>
174
+ </breakpoint-manager>
175
+ </component>
176
  <component name="com.intellij.coverage.CoverageDataManagerImpl">
177
+ <SUITE FILE_PATH="coverage/Daily_Plan_Agent$app.coverage" NAME="app Coverage Results" MODIFIED="1746723169508" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
178
  <SUITE FILE_PATH="coverage/Daily_Plan_Agent$Python_Console.coverage" NAME="Python Console Coverage Results" MODIFIED="1746281551614" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
179
  </component>
180
  </project>
data/gecici.py CHANGED
@@ -1,26 +1,27 @@
1
- """
2
- BU DOSYA TAKVİMİ OKUMAK İÇİN Yetkilendirme izni verir ve token.json dosyasını olşturur. Bir defa çalıştırmak yeterlidir.
3
- """
4
-
5
- from google.oauth2.credentials import Credentials
6
  from google_auth_oauthlib.flow import InstalledAppFlow
7
  from googleapiclient.discovery import build
8
  import os
9
-
10
- credentials_path = os.path.join("data", "credentials.json")
11
-
12
- # Sadece takvimi okuma izni veriyoruz
13
- SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
14
-
15
- def main():
16
- flow = InstalledAppFlow.from_client_secrets_file(credentials_path, SCOPES)
17
-
18
- creds = flow.run_local_server(port=0)
19
-
20
- with open('token.json', 'w') as token:
21
- token.write(creds.to_json())
22
-
23
- print("Yetkilendirme başarılı, token.json oluşturuldu.")
24
-
 
 
25
  if __name__ == '__main__':
26
- main()
 
 
 
 
 
 
 
 
 
 
1
  from google_auth_oauthlib.flow import InstalledAppFlow
2
  from googleapiclient.discovery import build
3
  import os
4
+ import pickle
5
+
6
+ SCOPES = ['https://www.googleapis.com/auth/calendar']
7
+
8
+ def authorize_google_calendar():
9
+ creds = None
10
+ if os.path.exists('token.pickle'):
11
+ with open('token.pickle', 'rb') as token:
12
+ creds = pickle.load(token)
13
+ if not creds or not creds.valid:
14
+ flow = InstalledAppFlow.from_client_secrets_file('data/credentials.json', SCOPES)
15
+ creds = flow.run_local_server(port=0)
16
+ with open('token.pickle', 'wb') as token:
17
+ pickle.dump(creds, token)
18
+ service = build('calendar', 'v3', credentials=creds)
19
+ return service
20
+
21
+ # Test: etkinlikleri listele
22
  if __name__ == '__main__':
23
+ service = authorize_google_calendar()
24
+ events_result = service.events().list(calendarId='primary').execute()
25
+ events = events_result.get('items', [])
26
+ for event in events:
27
+ print(event['summary'], event['start'])
tools/__pycache__/calendar_reader.cpython-310.pyc CHANGED
Binary files a/tools/__pycache__/calendar_reader.cpython-310.pyc and b/tools/__pycache__/calendar_reader.cpython-310.pyc differ
 
tools/__pycache__/gmail_sender.cpython-310.pyc CHANGED
Binary files a/tools/__pycache__/gmail_sender.cpython-310.pyc and b/tools/__pycache__/gmail_sender.cpython-310.pyc differ
 
tools/__pycache__/planner.cpython-310.pyc CHANGED
Binary files a/tools/__pycache__/planner.cpython-310.pyc and b/tools/__pycache__/planner.cpython-310.pyc differ
 
tools/calendar_reader.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from google.oauth2.credentials import Credentials
2
  from googleapiclient.discovery import build
3
  import datetime
@@ -44,4 +45,4 @@ def get_todays_events() -> list[str]:
44
  formatted = f"{summary}. ({start_dt.strftime('%H : %M')} - {end_dt.strftime('%H : %M')} / {start_dt.strftime('%d - %m - %Y')})"
45
  formatted_events.append(formatted)
46
 
47
- return formatted_events
 
1
+ #calendar_reader.py
2
  from google.oauth2.credentials import Credentials
3
  from googleapiclient.discovery import build
4
  import datetime
 
45
  formatted = f"{summary}. ({start_dt.strftime('%H : %M')} - {end_dt.strftime('%H : %M')} / {start_dt.strftime('%d - %m - %Y')})"
46
  formatted_events.append(formatted)
47
 
48
+ return formatted_events
tools/gmail_sender.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import smtplib
2
  from email.mime.text import MIMEText
3
  from email.mime.multipart import MIMEMultipart
 
1
+ #gmail_sender.py
2
  import smtplib
3
  from email.mime.text import MIMEText
4
  from email.mime.multipart import MIMEMultipart
tools/planner.py CHANGED
@@ -1,7 +1,9 @@
 
1
  from tools.calendar_reader import get_todays_events
2
  import json
3
  import datetime
4
-
 
5
  def generate_daily_plan() -> str:
6
  """
7
  Generate a daily plan based on class schedule and today's calendar events.
 
1
+ #planner.py
2
  from tools.calendar_reader import get_todays_events
3
  import json
4
  import datetime
5
+ from smolagents import tool
6
+ @tool
7
  def generate_daily_plan() -> str:
8
  """
9
  Generate a daily plan based on class schedule and today's calendar events.