Kunal
commited on
Commit
Β·
cee4c0c
1
Parent(s):
deb711d
added .env support and Readme.md
Browse files- .gitignore +5 -0
- README.md +117 -0
- example.env +7 -0
- requirements.txt +2 -1
- src/__pycache__/agent.cpython-313.pyc +0 -0
- src/__pycache__/auth.cpython-313.pyc +0 -0
- src/__pycache__/tools.cpython-313.pyc +0 -0
- src/agent.py +5 -2
- src/auth.py +8 -4
.gitignore
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.env
|
2 |
+
MAL_Agent\src\__pycache__
|
3 |
+
__pycache__
|
4 |
+
src\__pycache__
|
5 |
+
# Ignore Python cache files
|
README.md
CHANGED
@@ -18,3 +18,120 @@ Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :hear
|
|
18 |
|
19 |
If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
|
20 |
forums](https://discuss.streamlit.io).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
|
20 |
forums](https://discuss.streamlit.io).
|
21 |
+
|
22 |
+
# MAL Agent π
|
23 |
+
|
24 |
+
A Streamlit-powered assistant for managing your [MyAnimeList](https://myanimelist.net/) anime list, discovering new anime, and getting recommendationsβall in a friendly chat interface.
|
25 |
+
|
26 |
+
---
|
27 |
+
|
28 |
+
## Features
|
29 |
+
|
30 |
+
- **MyAnimeList Management:**
|
31 |
+
- View, add, and remove anime from your personal MAL list.
|
32 |
+
- Filter your list by status (Watching, Completed, etc.).
|
33 |
+
- **Anime Recommendations:**
|
34 |
+
- Get personalized anime suggestions.
|
35 |
+
- Display recommendations as visually appealing cards.
|
36 |
+
- **Web Search:**
|
37 |
+
- Search for additional anime info using DuckDuckGo.
|
38 |
+
- **Watch Links:**
|
39 |
+
- Get streaming links exclusively from HiAnime.
|
40 |
+
- **Secure Authentication:**
|
41 |
+
- OAuth2 login with your MAL account.
|
42 |
+
|
43 |
+
---
|
44 |
+
|
45 |
+
## Getting Started
|
46 |
+
|
47 |
+
### 1. Clone the Repository
|
48 |
+
|
49 |
+
```sh
|
50 |
+
# Using PowerShell
|
51 |
+
git clone https://github.com/yourusername/MAL-Agent.git
|
52 |
+
cd MAL_Agent
|
53 |
+
```
|
54 |
+
|
55 |
+
### 2. Set Up Environment Variables
|
56 |
+
|
57 |
+
Copy `example.env` to `.env` and fill in your API keys and MAL credentials:
|
58 |
+
|
59 |
+
```sh
|
60 |
+
Copy-Item example.env .env
|
61 |
+
```
|
62 |
+
|
63 |
+
Edit `.env` and provide your keys:
|
64 |
+
```
|
65 |
+
GEMINI_API_KEY=your_gemini_api_key
|
66 |
+
DEEPSEEK_API_KEY=your_deepseek_api_key
|
67 |
+
MAL_CLIENT_ID=your_mal_client_id
|
68 |
+
MAL_CLIENT_SECRET=your_mal_client_secret
|
69 |
+
MAL_REDIRECT_URI=http://localhost:8080/callback
|
70 |
+
MAL_PORT=8080
|
71 |
+
```
|
72 |
+
|
73 |
+
### 3. Install Dependencies
|
74 |
+
|
75 |
+
```sh
|
76 |
+
pip install -r requirements.txt
|
77 |
+
```
|
78 |
+
|
79 |
+
### 4. Run the App
|
80 |
+
|
81 |
+
```sh
|
82 |
+
streamlit run src/streamlit_app.py
|
83 |
+
```
|
84 |
+
|
85 |
+
The app will be available at [http://localhost:8501](http://localhost:8501).
|
86 |
+
|
87 |
+
---
|
88 |
+
|
89 |
+
## Project Structure
|
90 |
+
|
91 |
+
```
|
92 |
+
MAL_Agent/
|
93 |
+
βββ .env
|
94 |
+
βββ Dockerfile
|
95 |
+
βββ README.md
|
96 |
+
βββ requirements.txt
|
97 |
+
βββ src/
|
98 |
+
β βββ agent.py
|
99 |
+
β βββ auth.py
|
100 |
+
β βββ streamlit_app.py
|
101 |
+
β βββ tools.py
|
102 |
+
```
|
103 |
+
|
104 |
+
---
|
105 |
+
|
106 |
+
## Docker
|
107 |
+
|
108 |
+
You can also run the app in Docker:
|
109 |
+
|
110 |
+
```sh
|
111 |
+
docker build -t mal-agent .
|
112 |
+
docker run -p 8501:8501 --env-file .env mal-agent
|
113 |
+
```
|
114 |
+
|
115 |
+
---
|
116 |
+
|
117 |
+
## License
|
118 |
+
|
119 |
+
MIT
|
120 |
+
|
121 |
+
---
|
122 |
+
|
123 |
+
## Credits
|
124 |
+
|
125 |
+
- [Streamlit](https://streamlit.io/)
|
126 |
+
- [MyAnimeList API](https://myanimelist.net/apiconfig/references/api/v2)
|
127 |
+
- [smolagents](https://github.com/smol-ai/smol-agents)
|
128 |
+
|
129 |
+
---
|
130 |
+
|
131 |
+
## Support Me
|
132 |
+
|
133 |
+
If you like this project, consider supporting me on Ko-fi!
|
134 |
+
|
135 |
+
<a href="https://ko-fi.com/yourusername" target="_blank">
|
136 |
+
<img src="https://cdn.ko-fi.com/cdn/kofi_button.png?v=3" alt="Buy Me a Coffee at ko-fi.com" height="36" style="border:0px;height:36px;" />
|
137 |
+
</a>
|
example.env
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GEMINI_API_KEY = "AIzaSyDrSVoJnOEZclbciDf5hyor665iHG1nQsQ"
|
2 |
+
DEEPSEEK_API_KEY = "sk-5901a93f69824788a61a2bc68925a3a9"
|
3 |
+
|
4 |
+
CLIENT_ID = "e85f0329ae62138e962530f300c6549b"
|
5 |
+
CLIENT_SECRET = "6a2bb65ea4fb863507cf7cf0452aa5c59825f142eee3c6bd639846155dddcec0"
|
6 |
+
REDIRECT_URI = "http://localhost:8080/callback"
|
7 |
+
PORT = 8080
|
requirements.txt
CHANGED
@@ -7,4 +7,5 @@ streamlit
|
|
7 |
DuckDuckGoSearchTool
|
8 |
requests
|
9 |
smolagents[openai]
|
10 |
-
duckduckgo-search
|
|
|
|
7 |
DuckDuckGoSearchTool
|
8 |
requests
|
9 |
smolagents[openai]
|
10 |
+
duckduckgo-search
|
11 |
+
python-dotenv
|
src/__pycache__/agent.cpython-313.pyc
DELETED
Binary file (1.41 kB)
|
|
src/__pycache__/auth.cpython-313.pyc
DELETED
Binary file (6.26 kB)
|
|
src/__pycache__/tools.cpython-313.pyc
DELETED
Binary file (8.63 kB)
|
|
src/agent.py
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
from tools import add_anime, remove_anime, get_anime_list, search_anime, format_anime_list, display_anime_cards, hianime_watchlink, anime_suggestion
|
2 |
from smolagents import CodeAgent, OpenAIServerModel
|
3 |
from smolagents import DuckDuckGoSearchTool
|
|
|
|
|
4 |
|
|
|
5 |
|
6 |
-
GEMINI_API_KEY = "
|
7 |
-
DEEPSEEK_API_KEY = "
|
8 |
|
9 |
def initialize_agent():
|
10 |
"""
|
|
|
1 |
from tools import add_anime, remove_anime, get_anime_list, search_anime, format_anime_list, display_anime_cards, hianime_watchlink, anime_suggestion
|
2 |
from smolagents import CodeAgent, OpenAIServerModel
|
3 |
from smolagents import DuckDuckGoSearchTool
|
4 |
+
from dotenv import load_dotenv
|
5 |
+
import os
|
6 |
|
7 |
+
load_dotenv()
|
8 |
|
9 |
+
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
10 |
+
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
|
11 |
|
12 |
def initialize_agent():
|
13 |
"""
|
src/auth.py
CHANGED
@@ -7,12 +7,16 @@ import threading
|
|
7 |
import time
|
8 |
from http.server import HTTPServer, BaseHTTPRequestHandler
|
9 |
from urllib.parse import urlparse, parse_qs
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Configuration (move these to secrets.toml in production)
|
12 |
-
CLIENT_ID = "
|
13 |
-
CLIENT_SECRET = "
|
14 |
-
REDIRECT_URI = "http://localhost:
|
15 |
-
PORT =
|
16 |
|
17 |
class MALAuth:
|
18 |
def __init__(self):
|
|
|
7 |
import time
|
8 |
from http.server import HTTPServer, BaseHTTPRequestHandler
|
9 |
from urllib.parse import urlparse, parse_qs
|
10 |
+
from dotenv import load_dotenv
|
11 |
+
import os
|
12 |
+
|
13 |
+
load_dotenv()
|
14 |
|
15 |
# Configuration (move these to secrets.toml in production)
|
16 |
+
CLIENT_ID = os.getenv("MAL_CLIENT_ID")
|
17 |
+
CLIENT_SECRET = os.getenv("MAL_CLIENT_SECRET")
|
18 |
+
REDIRECT_URI = os.getenv("MAL_REDIRECT_URI", "http://localhost:8000/callback")
|
19 |
+
PORT = int(os.getenv("MAL_PORT", 8000))
|
20 |
|
21 |
class MALAuth:
|
22 |
def __init__(self):
|