AncViz commited on
Commit
72e5643
·
verified ·
1 Parent(s): a32eac9

Can you add working example files (so when you lick 'load example' on the examples tab, it loads the real example)? This may require adjusting the functionality of the drag-and-drop components

Browse files
Files changed (9) hide show
  1. README.md +8 -5
  2. about.html +163 -0
  3. components/footer.js +141 -0
  4. components/navbar.js +110 -0
  5. docs.html +163 -0
  6. examples.html +188 -0
  7. index.html +151 -19
  8. script.js +644 -0
  9. style.css +174 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Agentflow Studio Visual Ai Wizardry
3
- emoji: 🐢
4
- colorFrom: yellow
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: AgentFlow Studio - Visual AI Wizardry 🧙‍♂️
3
+ colorFrom: pink
4
+ colorTo: yellow
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
about.html ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>About - AgentFlow Studio</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <link rel="stylesheet" href="style.css">
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ </head>
13
+ <body class="bg-gray-900 text-white min-h-screen">
14
+ <custom-navbar></custom-navbar>
15
+
16
+ <main class="container mx-auto px-4 py-8 max-w-4xl">
17
+ <div class="bg-gray-800 rounded-xl p-8 mb-8 text-center">
18
+ <h1 class="text-4xl font-bold mb-4">About AgentFlow Studio</h1>
19
+ <p class="text-xl text-gray-300">Democratizing AI agent development through visual programming</p>
20
+ </div>
21
+
22
+ <div class="space-y-8">
23
+ <section class="bg-gray-800 rounded-xl p-8">
24
+ <h2 class="text-2xl font-semibold mb-4">Our Mission</h2>
25
+ <p class="text-gray-300 leading-relaxed">
26
+ AgentFlow Studio was born from the recognition that building sophisticated AI agents with Langchain
27
+ requires significant programming expertise. We believe that the power of AI should be accessible to
28
+ everyone, regardless of their coding background.
29
+ </p>
30
+ <p class="text-gray-300 leading-relaxed mt-4">
31
+ Our mission is to democratize AI agent development by providing an intuitive, visual interface that
32
+ allows developers, researchers, and businesses to create complex Langchain agents through simple
33
+ drag-and-drop interactions.
34
+ </p>
35
+ </section>
36
+
37
+ <section class="bg-gray-800 rounded-xl p-8">
38
+ <h2 class="text-2xl font-semibold mb-6">Key Features</h2>
39
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
40
+ <div class="flex items-start gap-4">
41
+ <div class="bg-blue-600 p-3 rounded-lg">
42
+ <i data-feather="mouse-pointer" class="w-6 h-6"></i>
43
+ </div>
44
+ <div>
45
+ <h3 class="text-lg font-semibold mb-2">Visual Builder</h3>
46
+ <p class="text-gray-300">Drag and drop components to create complex agent workflows without writing code.</p>
47
+ </div>
48
+ </div>
49
+
50
+ <div class="flex items-start gap-4">
51
+ <div class="bg-green-600 p-3 rounded-lg">
52
+ <i data-feather="download" class="w-6 h-6"></i>
53
+ </div>
54
+ <div>
55
+ <h3 class="text-lg font-semibold mb-2">Python Export</h3>
56
+ <p class="text-gray-300">Generate production-ready Python code that integrates seamlessly with your existing projects.</p>
57
+ </div>
58
+ </div>
59
+
60
+ <div class="flex items-start gap-4">
61
+ <div class="bg-purple-600 p-3 rounded-lg">
62
+ <i data-feather="layers" class="w-6 h-6"></i>
63
+ </div>
64
+ <div>
65
+ <h3 class="text-lg font-semibold mb-2">Component Library</h3>
66
+ <p class="text-gray-300">Pre-built components for common patterns and easy customization.</p>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="flex items-start gap-4">
71
+ <div class="bg-yellow-600 p-3 rounded-lg">
72
+ <i data-feather="users" class="w-6 h-6"></i>
73
+ </div>
74
+ <div>
75
+ <h3 class="text-lg font-semibold mb-2">Community Driven</h3>
76
+ <p class="text-gray-300">Built with and for the AI community, with regular updates and new features.</p>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ </section>
81
+
82
+ <section class="bg-gray-800 rounded-xl p-8">
83
+ <h2 class="text-2xl font-semibold mb-6">The Team</h2>
84
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
85
+ <div class="text-center">
86
+ <div class="bg-gradient-to-br from-blue-500 to-purple-600 w-24 h-24 rounded-full mx-auto mb-4 flex items-center justify-center">
87
+ <i data-feather="user" class="w-12 h-12"></i>
88
+ </div>
89
+ <h3 class="text-lg font-semibold">Alex Chen</h3>
90
+ <p class="text-blue-400">Lead Developer</p>
91
+ <p class="text-gray-300 text-sm mt-2">Full-stack developer with passion for AI and UX design</p>
92
+ </div>
93
+
94
+ <div class="text-center">
95
+ <div class="bg-gradient-to-br from-green-500 to-blue-600 w-24 h-24 rounded-full mx-auto mb-4 flex items-center justify-center">
96
+ <i data-feather="user" class="w-12 h-12"></i>
97
+ </div>
98
+ <h3 class="text-lg font-semibold">Maria Rodriguez</h3>
99
+ <p class="text-green-400">AI Researcher</p>
100
+ <p class="text-gray-300 text-sm mt-2">Specializes in language models and agent architectures</p>
101
+ </div>
102
+
103
+ <div class="text-center">
104
+ <div class="bg-gradient-to-br from-purple-500 to-pink-600 w-24 h-24 rounded-full mx-auto mb-4 flex items-center justify-center">
105
+ <i data-feather="user" class="w-12 h-12"></i>
106
+ </div>
107
+ <h3 class="text-lg font-semibold">David Kim</h3>
108
+ <p class="text-purple-400">Product Designer</p>
109
+ <p class="text-gray-300 text-sm mt-2">Creates intuitive interfaces for complex technical tools</p>
110
+ </div>
111
+ </div>
112
+ </section>
113
+
114
+ <section class="bg-gray-800 rounded-xl p-8">
115
+ <h2 class="text-2xl font-semibold mb-4">Technology Stack</h2>
116
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4 text-center">
117
+ <div class="bg-gray-700 p-4 rounded-lg">
118
+ <i data-feather="code" class="w-8 h-8 mx-auto mb-2 text-blue-400"></i>
119
+ <p class="font-semibold">HTML/CSS/JS</p>
120
+ </div>
121
+ <div class="bg-gray-700 p-4 rounded-lg">
122
+ <i data-feather="layers" class="w-8 h-8 mx-auto mb-2 text-green-400"></i>
123
+ <p class="font-semibold">TailwindCSS</p>
124
+ </div>
125
+ <div class="bg-gray-700 p-4 rounded-lg">
126
+ <i data-feather="cpu" class="w-8 h-8 mx-auto mb-2 text-purple-400"></i>
127
+ <p class="font-semibold">Web Components</p>
128
+ </div>
129
+ <div class="bg-gray-700 p-4 rounded-lg">
130
+ <i data-feather="zap" class="w-8 h-8 mx-auto mb-2 text-yellow-400"></i>
131
+ <p class="font-semibold">Vanta.js</p>
132
+ </div>
133
+ </div>
134
+ </section>
135
+
136
+ <section class="bg-gray-800 rounded-xl p-8 text-center">
137
+ <h2 class="text-2xl font-semibold mb-4">Join Our Community</h2>
138
+ <p class="text-gray-300 mb-6">We're building the future of visual AI development together</p>
139
+ <div class="flex justify-center gap-4">
140
+ <a href="#" class="bg-blue-600 hover:bg-blue-700 px-6 py-3 rounded-lg font-semibold inline-flex items-center gap-2">
141
+ <i data-feather="github"></i>GitHub
142
+ </a>
143
+ <a href="#" class="bg-green-600 hover:bg-green-700 px-6 py-3 rounded-lg font-semibold inline-flex items-center gap-2">
144
+ <i data-feather="message-circle"></i>Discord
145
+ </a>
146
+ <a href="#" class="bg-purple-600 hover:bg-purple-700 px-6 py-3 rounded-lg font-semibold inline-flex items-center gap-2">
147
+ <i data-feather="mail"></i>Newsletter
148
+ </a>
149
+ </div>
150
+ </section>
151
+ </div>
152
+ </main>
153
+
154
+ <custom-footer></custom-footer>
155
+
156
+ <script src="components/navbar.js"></script>
157
+ <script src="components/footer.js"></script>
158
+ <script src="script.js"></script>
159
+ <script>
160
+ feather.replace();
161
+ </script>
162
+ </body>
163
+ </html>
components/footer.js ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ footer {
7
+ background: #111827;
8
+ color: #9ca3af;
9
+ padding: 3rem 2rem 2rem;
10
+ margin-top: 4rem;
11
+ border-top: 1px solid #374151;
12
+ }
13
+
14
+ .footer-content {
15
+ max-width: 1200px;
16
+ margin: 0 auto;
17
+ display: grid;
18
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
19
+ gap: 2rem;
20
+ }
21
+
22
+ .footer-section h3 {
23
+ color: white;
24
+ margin-bottom: 1rem;
25
+ font-size: 1.125rem;
26
+ font-weight: 600;
27
+ }
28
+
29
+ .footer-links {
30
+ list-style: none;
31
+ padding: 0;
32
+ margin: 0;
33
+ }
34
+
35
+ .footer-links li {
36
+ margin-bottom: 0.5rem;
37
+ }
38
+
39
+ .footer-links a {
40
+ color: #9ca3af;
41
+ text-decoration: none;
42
+ transition: color 0.2s;
43
+ display: flex;
44
+ align-items: center;
45
+ gap: 0.5rem;
46
+ }
47
+
48
+ .footer-links a:hover {
49
+ color: #3b82f6;
50
+ }
51
+
52
+ .footer-icon {
53
+ width: 16px;
54
+ height: 16px;
55
+ }
56
+
57
+ .footer-bottom {
58
+ max-width: 1200px;
59
+ margin: 2rem auto 0;
60
+ padding-top: 2rem;
61
+ border-top: 1px solid #374151;
62
+ text-align: center;
63
+ color: #6b7280;
64
+ }
65
+
66
+ .social-links {
67
+ display: flex;
68
+ gap: 1rem;
69
+ margin-top: 1rem;
70
+ }
71
+
72
+ .social-links a {
73
+ color: #9ca3af;
74
+ transition: color 0.2s;
75
+ }
76
+
77
+ .social-links a:hover {
78
+ color: #3b82f6;
79
+ }
80
+
81
+ @media (max-width: 768px) {
82
+ footer {
83
+ padding: 2rem 1rem;
84
+ }
85
+
86
+ .footer-content {
87
+ grid-template-columns: 1fr;
88
+ text-align: center;
89
+ }
90
+ }
91
+ </style>
92
+ <footer>
93
+ <div class="footer-content">
94
+ <div class="footer-section">
95
+ <h3>AgentFlow Studio</h3>
96
+ <p>Build Langchain agents visually with our intuitive drag-and-drop interface. No coding experience required.</p>
97
+ <div class="social-links">
98
+ <a href="#"><i data-feather="github" class="footer-icon"></i></a>
99
+ <a href="#"><i data-feather="twitter" class="footer-icon"></i></a>
100
+ <a href="#"><i data-feather="linkedin" class="footer-icon"></i></a>
101
+ <a href="#"><i data-feather="mail" class="footer-icon"></i></a>
102
+ </div>
103
+ </div>
104
+
105
+ <div class="footer-section">
106
+ <h3>Resources</h3>
107
+ <ul class="footer-links">
108
+ <li><a href="/docs.html"><i data-feather="book" class="footer-icon"></i>Documentation</a></li>
109
+ <li><a href="/examples.html"><i data-feather="code" class="footer-icon"></i>Examples</a></li>
110
+ <li><a href="/tutorials.html"><i data-feather="play" class="footer-icon"></i>Tutorials</a></li>
111
+ <li><a href="/api.html"><i data-feather="database" class="footer-icon"></i>API Reference</a></li>
112
+ </ul>
113
+ </div>
114
+
115
+ <div class="footer-section">
116
+ <h3>Support</h3>
117
+ <ul class="footer-links">
118
+ <li><a href="/help.html"><i data-feather="help-circle" class="footer-icon"></i>Help Center</a></li>
119
+ <li><a href="/community.html"><i data-feather="users" class="footer-icon"></i>Community</a></li>
120
+ <li><a href="/contact.html"><i data-feather="mail" class="footer-icon"></i>Contact Us</a></li>
121
+ <li><a href="/status.html"><i data-feather="activity" class="footer-icon"></i>System Status</a></li>
122
+ </ul>
123
+ </div>
124
+ </div>
125
+
126
+ <div class="footer-bottom">
127
+ <p>&copy; 2024 AgentFlow Studio. Built with ❤️ for the AI community.</p>
128
+ </div>
129
+ </footer>
130
+ `;
131
+
132
+ // Initialize Feather icons after component is rendered
133
+ setTimeout(() => {
134
+ if (typeof feather !== 'undefined') {
135
+ feather.replace();
136
+ }
137
+ }, 100);
138
+ }
139
+ }
140
+
141
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ nav {
7
+ background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
8
+ padding: 1rem 2rem;
9
+ display: flex;
10
+ justify-content: space-between;
11
+ align-items: center;
12
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
13
+ }
14
+
15
+ .logo {
16
+ color: white;
17
+ font-weight: bold;
18
+ font-size: 1.5rem;
19
+ display: flex;
20
+ align-items: center;
21
+ gap: 0.5rem;
22
+ }
23
+
24
+ .logo-icon {
25
+ width: 24px;
26
+ height: 24px;
27
+ }
28
+
29
+ ul {
30
+ display: flex;
31
+ gap: 2rem;
32
+ list-style: none;
33
+ margin: 0;
34
+ padding: 0;
35
+ align-items: center;
36
+ }
37
+
38
+ a {
39
+ color: white;
40
+ text-decoration: none;
41
+ transition: opacity 0.2s;
42
+ display: flex;
43
+ align-items: center;
44
+ gap: 0.5rem;
45
+ padding: 0.5rem 1rem;
46
+ border-radius: 0.375rem;
47
+ }
48
+
49
+ a:hover {
50
+ opacity: 0.8;
51
+ background: rgba(255, 255, 255, 0.1);
52
+ }
53
+
54
+ .nav-icon {
55
+ width: 18px;
56
+ height: 18px;
57
+ }
58
+
59
+ @media (max-width: 768px) {
60
+ nav {
61
+ padding: 1rem;
62
+ flex-direction: column;
63
+ gap: 1rem;
64
+ }
65
+
66
+ ul {
67
+ gap: 1rem;
68
+ }
69
+
70
+ a span {
71
+ display: none;
72
+ }
73
+ }
74
+ </style>
75
+ <nav>
76
+ <a href="/" class="logo">
77
+ <i data-feather="cpu" class="logo-icon"></i>
78
+ <span>AgentFlow Studio</span>
79
+ </a>
80
+ <ul>
81
+ <li><a href="/">
82
+ <i data-feather="home" class="nav-icon"></i>
83
+ <span>Home</span>
84
+ </a></li>
85
+ <li><a href="/docs.html">
86
+ <i data-feather="book" class="nav-icon"></i>
87
+ <span>Documentation</span>
88
+ </a></li>
89
+ <li><a href="/examples.html">
90
+ <i data-feather="code" class="nav-icon"></i>
91
+ <span>Examples</span>
92
+ </a></li>
93
+ <li><a href="/about.html">
94
+ <i data-feather="info" class="nav-icon"></i>
95
+ <span>About</span>
96
+ </a></li>
97
+ </ul>
98
+ </nav>
99
+ `;
100
+
101
+ // Initialize Feather icons after component is rendered
102
+ setTimeout(() => {
103
+ if (typeof feather !== 'undefined') {
104
+ feather.replace();
105
+ }
106
+ }, 100);
107
+ }
108
+ }
109
+
110
+ customElements.define('custom-navbar', CustomNavbar);
docs.html ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Documentation - AgentFlow Studio</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <link rel="stylesheet" href="style.css">
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ </head>
13
+ <body class="bg-gray-900 text-white min-h-screen">
14
+ <custom-navbar></custom-navbar>
15
+
16
+ <main class="container mx-auto px-4 py-8 max-w-6xl">
17
+ <div class="bg-gray-800 rounded-xl p-8 mb-8">
18
+ <h1 class="text-4xl font-bold mb-4">Documentation</h1>
19
+ <p class="text-xl text-gray-300">Learn how to build Langchain agents visually with AgentFlow Studio</p>
20
+ </div>
21
+
22
+ <div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
23
+ <!-- Sidebar -->
24
+ <aside class="lg:col-span-1">
25
+ <nav class="bg-gray-800 rounded-xl p-6 sticky top-8">
26
+ <h2 class="text-lg font-semibold mb-4">Contents</h2>
27
+ <ul class="space-y-2">
28
+ <li><a href="#getting-started" class="text-blue-400 hover:text-blue-300 block py-2">Getting Started</a></li>
29
+ <li><a href="#components" class="text-blue-400 hover:text-blue-300 block py-2">Components</a></li>
30
+ <li><a href="#react-agent" class="text-blue-400 hover:text-blue-300 block py-2">React Agent</a></li>
31
+ <li><a href="#tools" class="text-blue-400 hover:text-blue-300 block py-2">Tools</a></li>
32
+ <li><a href="#prompts" class="text-blue-400 hover:text-blue-300 block py-2">Prompts</a></li>
33
+ <li><a href="#memory" class="text-blue-400 hover:text-blue-300 block py-2">Memory</a></li>
34
+ <li><a href="#exporting" class="text-blue-400 hover:text-blue-300 block py-2">Exporting</a></li>
35
+ </ul>
36
+ </nav>
37
+ </aside>
38
+
39
+ <!-- Main content -->
40
+ <div class="lg:col-span-3 space-y-8">
41
+ <section id="getting-started" class="bg-gray-800 rounded-xl p-8">
42
+ <h2 class="text-2xl font-semibold mb-4">Getting Started</h2>
43
+ <div class="prose prose-invert max-w-none">
44
+ <p>AgentFlow Studio allows you to build Langchain agents through a visual interface. Follow these steps to create your first agent:</p>
45
+
46
+ <h3 class="text-xl font-semibold mt-6 mb-3">1. Create a New Project</h3>
47
+ <p>Click the "New Project" button on the homepage to start with a clean canvas.</p>
48
+
49
+ <h3 class="text-xl font-semibold mt-6 mb-3">2. Add Components</h3>
50
+ <p>Drag components from the toolbox onto the canvas. Available components include:</p>
51
+ <ul class="list-disc list-inside mt-2 space-y-1">
52
+ <li><strong>React Agent</strong>: The core reasoning engine</li>
53
+ <li><strong>Tools</strong>: Custom functions your agent can use</li>
54
+ <li><strong>Prompt Templates</strong>: Define how your agent communicates</li>
55
+ <li><strong>Memory</strong>: Manage conversation history and state</li>
56
+ </ul>
57
+
58
+ <h3 class="text-xl font-semibold mt-6 mb-3">3. Configure Properties</h3>
59
+ <p>Double-click any component to open its properties panel and configure its behavior.</p>
60
+ </div>
61
+ </section>
62
+
63
+ <section id="components" class="bg-gray-800 rounded-xl p-8">
64
+ <h2 class="text-2xl font-semibold mb-4">Component Overview</h2>
65
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
66
+ <div class="bg-gray-700 p-4 rounded-lg">
67
+ <div class="flex items-center gap-3 mb-3">
68
+ <div class="bg-blue-600 p-2 rounded-lg">
69
+ <i data-feather="cpu" class="w-6 h-6"></i>
70
+ </div>
71
+ <h3 class="text-lg font-semibold">React Agent</h3>
72
+ </div>
73
+ <p class="text-gray-300">The core reasoning component that processes inputs and decides which tools to use.</p>
74
+ </div>
75
+
76
+ <div class="bg-gray-700 p-4 rounded-lg">
77
+ <div class="flex items-center gap-3 mb-3">
78
+ <div class="bg-purple-600 p-2 rounded-lg">
79
+ <i data-feather="tool" class="w-6 h-6"></i>
80
+ </div>
81
+ <h3 class="text-lg font-semibold">Tools</h3>
82
+ </div>
83
+ <p class="text-gray-300">Custom functions that extend your agent's capabilities with external APIs or calculations.</p>
84
+ </div>
85
+
86
+ <div class="bg-gray-700 p-4 rounded-lg">
87
+ <div class="flex items-center gap-3 mb-3">
88
+ <div class="bg-green-600 p-2 rounded-lg">
89
+ <i data-feather="message-square" class="w-6 h-6"></i>
90
+ </div>
91
+ <h3 class="text-lg font-semibold">Prompt Templates</h3>
92
+ </div>
93
+ <p class="text-gray-300">Define the conversation structure and system prompts for your agent.</p>
94
+ </div>
95
+
96
+ <div class="bg-gray-700 p-4 rounded-lg">
97
+ <div class="flex items-center gap-3 mb-3">
98
+ <div class="bg-yellow-600 p-2 rounded-lg">
99
+ <i data-feather="database" class="w-6 h-6"></i>
100
+ </div>
101
+ <h3 class="text-lg font-semibold">Memory</h3>
102
+ </div>
103
+ <p class="text-gray-300">Manage conversation history and maintain state across interactions.</p>
104
+ </div>
105
+ </div>
106
+ </section>
107
+
108
+ <section id="exporting" class="bg-gray-800 rounded-xl p-8">
109
+ <h2 class="text-2xl font-semibold mb-4">Exporting Your Agent</h2>
110
+ <div class="prose prose-invert max-w-none">
111
+ <p>Once you've built your agent, you can export it as ready-to-use Python code:</p>
112
+
113
+ <ol class="list-decimal list-inside mt-4 space-y-2">
114
+ <li>Click the "Export Python" button</li>
115
+ <li>Review the generated code in the modal</li>
116
+ <li>Copy to clipboard or download as a .py file</li>
117
+ <li>Use the code in your existing Langchain projects</li>
118
+ </ol>
119
+
120
+ <div class="bg-gray-900 p-4 rounded-lg mt-4">
121
+ <pre><code class="language-python"># Example exported code structure
122
+ from langchain.agents import create_react_agent
123
+ from langgraph.graph import StateGraph
124
+
125
+ # Your custom components
126
+ agent = create_react_agent(model="gpt-4")
127
+ # ... more components
128
+
129
+ # Build and compile the graph
130
+ graph_builder = StateGraph()
131
+ # ... graph construction
132
+ final_agent = graph_builder.compile()</code></pre>
133
+ </div>
134
+ </div>
135
+ </section>
136
+ </div>
137
+ </div>
138
+ </main>
139
+
140
+ <custom-footer></custom-footer>
141
+
142
+ <script src="components/navbar.js"></script>
143
+ <script src="components/footer.js"></script>
144
+ <script src="script.js"></script>
145
+ <script>
146
+ feather.replace();
147
+
148
+ // Smooth scrolling for anchor links
149
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
150
+ anchor.addEventListener('click', function (e) {
151
+ e.preventDefault();
152
+ const target = document.querySelector(this.getAttribute('href'));
153
+ if (target) {
154
+ target.scrollIntoView({
155
+ behavior: 'smooth',
156
+ block: 'start'
157
+ });
158
+ }
159
+ });
160
+ });
161
+ </script>
162
+ </body>
163
+ </html>
examples.html ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Examples - AgentFlow Studio</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <link rel="stylesheet" href="style.css">
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ </head>
13
+ <body class="bg-gray-900 text-white min-h-screen">
14
+ <custom-navbar></custom-navbar>
15
+
16
+ <main class="container mx-auto px-4 py-8">
17
+ <div class="bg-gray-800 rounded-xl p-8 mb-8 text-center">
18
+ <h1 class="text-4xl font-bold mb-4">Example Projects</h1>
19
+ <p class="text-xl text-gray-300">Explore pre-built agent templates to get started quickly</p>
20
+ </div>
21
+
22
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mb-12">
23
+ <!-- Example 1 -->
24
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:transform hover:scale-105 transition-all duration-300">
25
+ <div class="bg-blue-600 p-6">
26
+ <i data-feather="search" class="w-12 h-12 mb-4"></i>
27
+ <h3 class="text-xl font-semibold">Research Assistant</h3>
28
+ </div>
29
+ <div class="p-6">
30
+ <p class="text-gray-300 mb-4">An agent that can search the web and summarize information for research purposes.</p>
31
+ <ul class="text-sm text-gray-400 space-y-1 mb-4">
32
+ <li>• Web search tool integration</li>
33
+ <li>• Summarization capabilities</li>
34
+ <li>• Citation management</li>
35
+ </ul>
36
+ <button onclick="loadExample('research')" class="w-full bg-blue-600 hover:bg-blue-700 py-2 rounded-lg font-semibold">
37
+ Load Example
38
+ </button>
39
+ </div>
40
+ </div>
41
+
42
+ <!-- Example 2 -->
43
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:transform hover:scale-105 transition-all duration-300">
44
+ <div class="bg-green-600 p-6">
45
+ <i data-feather="shopping-cart" class="w-12 h-12 mb-4"></i>
46
+ <h3 class="text-xl font-semibold">E-commerce Assistant</h3>
47
+ </div>
48
+ <div class="p-6">
49
+ <p class="text-gray-300 mb-4">Helps customers find products, compare prices, and make purchasing decisions.</p>
50
+ <ul class="text-sm text-gray-400 space-y-1 mb-4">
51
+ <li>• Product catalog search</li>
52
+ <li>• Price comparison</li>
53
+ <li>• Recommendation engine</li>
54
+ </ul>
55
+ <button onclick="loadExample('ecommerce')" class="w-full bg-green-600 hover:bg-green-700 py-2 rounded-lg font-semibold">
56
+ Load Example
57
+ </button>
58
+ </div>
59
+ </div>
60
+
61
+ <!-- Example 3 -->
62
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:transform hover:scale-105 transition-all duration-300">
63
+ <div class="bg-purple-600 p-6">
64
+ <i data-feather="code" class="w-12 h-12 mb-4"></i>
65
+ <h3 class="text-xl font-semibold">Code Assistant</h3>
66
+ </div>
67
+ <div class="p-6">
68
+ <p class="text-gray-300 mb-4">A programming assistant that can write, debug, and explain code.</p>
69
+ <ul class="text-sm text-gray-400 space-y-1 mb-4">
70
+ <li>• Code generation</li>
71
+ <li>• Debugging tools</li>
72
+ <li>• Documentation lookup</li>
73
+ </ul>
74
+ <button onclick="loadExample('code')" class="w-full bg-purple-600 hover:bg-purple-700 py-2 rounded-lg font-semibold">
75
+ Load Example
76
+ </button>
77
+ </div>
78
+ </div>
79
+
80
+ <!-- Example 4 -->
81
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:transform hover:scale-105 transition-all duration-300">
82
+ <div class="bg-yellow-600 p-6">
83
+ <i data-feather="message-circle" class="w-12 h-12 mb-4"></i>
84
+ <h3 class="text-xl font-semibold">Customer Support</h3>
85
+ </div>
86
+ <div class="p-6">
87
+ <p class="text-gray-300 mb-4">Automated customer service agent with FAQ knowledge and ticket management.</p>
88
+ <ul class="text-sm text-gray-400 space-y-1 mb-4">
89
+ <li>• FAQ database</li>
90
+ <li>• Ticket creation</li>
91
+ <li>• Escalation protocols</li>
92
+ </ul>
93
+ <button onclick="loadExample('support')" class="w-full bg-yellow-600 hover:bg-yellow-700 py-2 rounded-lg font-semibold">
94
+ Load Example
95
+ </button>
96
+ </div>
97
+ </div>
98
+
99
+ <!-- Example 5 -->
100
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:transform hover:scale-105 transition-all duration-300">
101
+ <div class="bg-red-600 p-6">
102
+ <i data-feather="bar-chart" class="w-12 h-12 mb-4"></i>
103
+ <h3 class="text-xl font-semibold">Data Analyst</h3>
104
+ </div>
105
+ <div class="p-6">
106
+ <p class="text-gray-300 mb-4">Analyzes datasets, generates insights, and creates visualizations.</p>
107
+ <ul class="text-sm text-gray-400 space-y-1 mb-4">
108
+ <li>• Data processing</li>
109
+ <li>• Statistical analysis</li>
110
+ <li>• Visualization generation</li>
111
+ </ul>
112
+ <button onclick="loadExample('analyst')" class="w-full bg-red-600 hover:bg-red-700 py-2 rounded-lg font-semibold">
113
+ Load Example
114
+ </button>
115
+ </div>
116
+ </div>
117
+
118
+ <!-- Example 6 -->
119
+ <div class="bg-gray-800 rounded-xl overflow-hidden hover:transform hover:scale-105 transition-all duration-300">
120
+ <div class="bg-indigo-600 p-6">
121
+ <i data-feather="globe" class="w-12 h-12 mb-4"></i>
122
+ <h3 class="text-xl font-semibold">Multi-language Translator</h3>
123
+ </div>
124
+ <div class="p-6">
125
+ <p class="text-gray-300 mb-4">Translates text between multiple languages with context awareness.</p>
126
+ <ul class="text-sm text-gray-400 space-y-1 mb-4">
127
+ <li>• Multi-language support</li>
128
+ <li>• Context preservation</li>
129
+ <li>• Cultural adaptation</li>
130
+ </ul>
131
+ <button onclick="loadExample('translator')" class="w-full bg-indigo-600 hover:bg-indigo-700 py-2 rounded-lg font-semibold">
132
+ Load Example
133
+ </button>
134
+ </div>
135
+ </div>
136
+ </div>
137
+
138
+ <section class="bg-gray-800 rounded-xl p-8">
139
+ <h2 class="text-2xl font-semibold mb-6 text-center">How to Use Examples</h2>
140
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
141
+ <div class="text-center">
142
+ <div class="bg-blue-600 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
143
+ <i data-feather="download" class="w-8 h-8"></i>
144
+ </div>
145
+ <h3 class="text-lg font-semibold mb-2">1. Load Example</h3>
146
+ <p class="text-gray-300">Click any example to load it into the builder canvas</p>
147
+ </div>
148
+ <div class="text-center">
149
+ <div class="bg-green-600 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
150
+ <i data-feather="edit" class="w-8 h-8"></i>
151
+ </div>
152
+ <h3 class="text-lg font-semibold mb-2">2. Customize</h3>
153
+ <p class="text-gray-300">Modify the components to fit your specific needs</p>
154
+ </div>
155
+ <div class="text-center">
156
+ <div class="bg-purple-600 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
157
+ <i data-feather="code" class="w-8 h-8"></i>
158
+ </div>
159
+ <h3 class="text-lg font-semibold mb-2">3. Export</h3>
160
+ <p class="text-gray-300">Generate Python code and integrate into your project</p>
161
+ </div>
162
+ </div>
163
+ </section>
164
+ </main>
165
+
166
+ <custom-footer></custom-footer>
167
+
168
+ <script src="components/navbar.js"></script>
169
+ <script src="components/footer.js"></script>
170
+ <script src="script.js"></script>
171
+ <script>
172
+ feather.replace();
173
+
174
+ function loadExample(exampleType) {
175
+ // Redirect to main page with example parameter
176
+ window.location.href = `/?example=${exampleType}`;
177
+ }
178
+
179
+ // Check if we have an example parameter in URL
180
+ const urlParams = new URLSearchParams(window.location.search);
181
+ const example = urlParams.get('example');
182
+ if (example) {
183
+ // This would be handled by the main page script
184
+ console.log('Loading example:', example);
185
+ }
186
+ </script>
187
+ </body>
188
+ </html>
index.html CHANGED
@@ -1,19 +1,151 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AgentFlow Studio - Visual Langchain Builder</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <link rel="stylesheet" href="style.css">
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script>
13
+ </head>
14
+ <body class="bg-gray-900 text-white min-h-screen">
15
+ <custom-navbar></custom-navbar>
16
+
17
+ <main class="container mx-auto px-4 py-8">
18
+ <!-- Hero Section -->
19
+ <section class="text-center mb-12">
20
+ <h1 class="text-5xl font-bold mb-4 bg-gradient-to-r from-blue-400 to-purple-600 bg-clip-text text-transparent">
21
+ AgentFlow Studio
22
+ </h1>
23
+ <p class="text-xl text-gray-300 mb-8">Build Langchain Agents Visually - No Code Required</p>
24
+ <div class="flex gap-4 justify-center">
25
+ <button onclick="startNewProject()" class="bg-blue-600 hover:bg-blue-700 px-6 py-3 rounded-lg font-semibold transition-colors">
26
+ <i data-feather="plus" class="inline mr-2"></i>New Project
27
+ </button>
28
+ <button onclick="loadSample()" class="bg-purple-600 hover:bg-purple-700 px-6 py-3 rounded-lg font-semibold transition-colors">
29
+ <i data-feather="play" class="inline mr-2"></i>Load Sample
30
+ </button>
31
+ </div>
32
+ </section>
33
+
34
+ <!-- Canvas Area -->
35
+ <section class="bg-gray-800 rounded-xl p-6 mb-8">
36
+ <div class="flex justify-between items-center mb-6">
37
+ <h2 class="text-2xl font-semibold">Agent Builder Canvas</h2>
38
+ <div class="flex gap-2">
39
+ <button onclick="exportAgent()" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg flex items-center">
40
+ <i data-feather="download" class="mr-2"></i>Export Python
41
+ </button>
42
+ <button onclick="clearCanvas()" class="bg-red-600 hover:bg-red-700 px-4 py-2 rounded-lg flex items-center">
43
+ <i data-feather="trash-2" class="mr-2"></i>Clear
44
+ </button>
45
+ </div>
46
+ </div>
47
+
48
+ <div id="canvas" class="min-h-96 border-2 border-dashed border-gray-600 rounded-lg p-4 relative">
49
+ <div class="absolute inset-0 flex items-center justify-center">
50
+ <p class="text-gray-500 text-lg">Drag components from the toolbox to start building</p>
51
+ </div>
52
+ </div>
53
+ </section>
54
+
55
+ <!-- Toolbox -->
56
+ <section class="bg-gray-800 rounded-xl p-6">
57
+ <h2 class="text-2xl font-semibold mb-6">Component Toolbox</h2>
58
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
59
+ <!-- Agent Components -->
60
+ <div class="toolbox-item" data-type="react-agent" draggable="true">
61
+ <div class="bg-blue-600 p-4 rounded-lg cursor-move">
62
+ <i data-feather="cpu" class="w-8 h-8 mb-2"></i>
63
+ <h3 class="font-semibold">React Agent</h3>
64
+ <p class="text-sm text-blue-200">Core reasoning agent</p>
65
+ </div>
66
+ </div>
67
+
68
+ <div class="toolbox-item" data-type="tool" draggable="true">
69
+ <div class="bg-purple-600 p-4 rounded-lg cursor-move">
70
+ <i data-feather="tool" class="w-8 h-8 mb-2"></i>
71
+ <h3 class="font-semibold">Tool</h3>
72
+ <p class="text-sm text-purple-200">Custom function tool</p>
73
+ </div>
74
+ </div>
75
+
76
+ <div class="toolbox-item" data-type="prompt" draggable="true">
77
+ <div class="bg-green-600 p-4 rounded-lg cursor-move">
78
+ <i data-feather="message-square" class="w-8 h-8 mb-2"></i>
79
+ <h3 class="font-semibold">Prompt Template</h3>
80
+ <p class="text-sm text-green-200">Chat prompt setup</p>
81
+ </div>
82
+ </div>
83
+
84
+ <div class="toolbox-item" data-type="memory" draggable="true">
85
+ <div class="bg-yellow-600 p-4 rounded-lg cursor-move">
86
+ <i data-feather="database" class="w-8 h-8 mb-2"></i>
87
+ <h3 class="font-semibold">Memory</h3>
88
+ <p class="text-sm text-yellow-200">State management</p>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </section>
93
+
94
+ <!-- Quick Examples Section -->
95
+ <section class="bg-gray-800 rounded-xl p-6 mt-8">
96
+ <h2 class="text-2xl font-semibold mb-6">Quick Examples</h2>
97
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
98
+ <button onclick="loadExample('research')" class="bg-gradient-to-r from-blue-600 to-purple-600 p-4 rounded-lg hover:from-blue-700 hover:to-purple-700 transition-all">
99
+ <i data-feather="search" class="w-6 h-6 mb-2"></i>
100
+ <h3 class="font-semibold">Research Assistant</h3>
101
+ <p class="text-sm opacity-80 mt-1">Web search & summarization</p>
102
+ </button>
103
+
104
+ <button onclick="loadExample('ecommerce')" class="bg-gradient-to-r from-green-600 to-blue-600 p-4 rounded-lg hover:from-green-700 hover:to-blue-700 transition-all">
105
+ <i data-feather="shopping-cart" class="w-6 h-6 mb-2"></i>
106
+ <h3 class="font-semibold">E-commerce Assistant</h3>
107
+ <p class="text-sm opacity-80 mt-1">Product search & price comparison</p>
108
+ </button>
109
+
110
+ <button onclick="loadExample('code')" class="bg-gradient-to-r from-purple-600 to-pink-600 p-4 rounded-lg hover:from-purple-700 hover:to-pink-700 transition-all">
111
+ <i data-feather="code" class="w-6 h-6 mb-2"></i>
112
+ <h3 class="font-semibold">Code Assistant</h3>
113
+ <p class="text-sm opacity-80 mt-1">Code generation & debugging</p>
114
+ </button>
115
+ </div>
116
+ </section>
117
+ <!-- Properties Panel -->
118
+ <section id="properties-panel" class="bg-gray-800 rounded-xl p-6 mt-8 hidden">
119
+ <h2 class="text-2xl font-semibold mb-6">Component Properties</h2>
120
+ <div id="properties-content">
121
+ <!-- Dynamic content will be loaded here -->
122
+ </div>
123
+ </section>
124
+ </main>
125
+
126
+ <custom-footer></custom-footer>
127
+
128
+ <!-- Scripts -->
129
+ <script src="components/navbar.js"></script>
130
+ <script src="components/footer.js"></script>
131
+ <script src="script.js"></script>
132
+ <script>
133
+ // Initialize Vanta.js background
134
+ VANTA.NET({
135
+ el: "body",
136
+ mouseControls: true,
137
+ touchControls: true,
138
+ gyroControls: false,
139
+ minHeight: 200.00,
140
+ minWidth: 200.00,
141
+ scale: 1.00,
142
+ scaleMobile: 1.00,
143
+ color: 0x3b82f6,
144
+ backgroundColor: 0x111827
145
+ });
146
+
147
+ feather.replace();
148
+ </script>
149
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
150
+ </body>
151
+ </html>
script.js ADDED
@@ -0,0 +1,644 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Shared JavaScript across all pages
2
+ class AgentBuilder {
3
+ constructor() {
4
+ this.components = [];
5
+ this.connections = [];
6
+ this.selectedComponent = null;
7
+ this.dragging = false;
8
+ this.dragOffset = { x: 0, y: 0 };
9
+
10
+ this.initializeEventListeners();
11
+ }
12
+
13
+ initializeEventListeners() {
14
+ const canvas = document.getElementById('canvas');
15
+
16
+ // Drag start from toolbox
17
+ document.querySelectorAll('.toolbox-item').forEach(item => {
18
+ item.addEventListener('dragstart', (e) => {
19
+ e.dataTransfer.setData('text/plain', e.target.closest('.toolbox-item').dataset.type);
20
+ });
21
+ });
22
+
23
+ // Drop on canvas
24
+ canvas.addEventListener('dragover', (e) => {
25
+ e.preventDefault();
26
+ canvas.classList.add('border-blue-500');
27
+ });
28
+
29
+ canvas.addEventListener('dragleave', () => {
30
+ canvas.classList.remove('border-blue-500');
31
+ });
32
+
33
+ canvas.addEventListener('drop', (e) => {
34
+ e.preventDefault();
35
+ canvas.classList.remove('border-blue-500');
36
+
37
+ const type = e.dataTransfer.getData('text/plain');
38
+ const rect = canvas.getBoundingClientRect();
39
+ const x = e.clientX - rect.left;
40
+ const y = e.clientY - rect.top;
41
+
42
+ this.addComponent(type, x, y);
43
+ });
44
+
45
+ // Canvas interactions
46
+ canvas.addEventListener('mousedown', (e) => {
47
+ const component = e.target.closest('.canvas-component');
48
+ if (component) {
49
+ this.selectComponent(component);
50
+ if (e.target.classList.contains('component-handle')) {
51
+ this.startDragging(component, e);
52
+ }
53
+ } else {
54
+ this.deselectComponent();
55
+ }
56
+ });
57
+
58
+ document.addEventListener('mousemove', (e) => {
59
+ if (this.dragging) {
60
+ this.dragComponent(e);
61
+ }
62
+ });
63
+
64
+ document.addEventListener('mouseup', () => {
65
+ this.dragging = false;
66
+ });
67
+ }
68
+
69
+ addComponent(type, x, y) {
70
+ const id = `comp-${Date.now()}`;
71
+ const component = {
72
+ id,
73
+ type,
74
+ x,
75
+ y,
76
+ properties: this.getDefaultProperties(type)
77
+ };
78
+
79
+ const element = document.createElement('div');
80
+ element.className = 'canvas-component';
81
+ element.id = id;
82
+ element.style.left = `${x}px`;
83
+ element.style.top = `${y}px`;
84
+ element.innerHTML = this.getComponentHTML(type, id);
85
+
86
+ document.getElementById('canvas').appendChild(element);
87
+ this.components.push(component);
88
+
89
+ // Add event listeners to the new component
90
+ element.addEventListener('dblclick', () => this.showProperties(component));
91
+
92
+ this.addConnectionPoints(element, id);
93
+ }
94
+
95
+ getComponentHTML(type, id) {
96
+ const templates = {
97
+ 'react-agent': `
98
+ <div class="component-handle flex items-center justify-between">
99
+ <i data-feather="cpu" class="w-4 h-4"></i>
100
+ <span class="text-sm font-semibold">React Agent</span>
101
+ </div>
102
+ <div class="text-xs text-gray-300">Reasoning engine</div>
103
+ `,
104
+ 'tool': `
105
+ <div class="component-handle flex items-center justify-between">
106
+ <i data-feather="tool" class="w-4 h-4"></i>
107
+ <span class="text-sm font-semibold">Tool</span>
108
+ </div>
109
+ <div class="text-xs text-gray-300">Function tool</div>
110
+ `,
111
+ 'prompt': `
112
+ <div class="component-handle flex items-center justify-between">
113
+ <i data-feather="message-square" class="w-4 h-4"></i>
114
+ <span class="text-sm font-semibold">Prompt Template</span>
115
+ </div>
116
+ <div class="text-xs text-gray-300">Chat setup</div>
117
+ `,
118
+ 'memory': `
119
+ <div class="component-handle flex items-center justify-between">
120
+ <i data-feather="database" class="w-4 h-4"></i>
121
+ <span class="text-sm font-semibold">Memory</span>
122
+ </div>
123
+ <div class="text-xs text-gray-300">State storage</div>
124
+ `
125
+ };
126
+
127
+ return templates[type] || '<div>Unknown Component</div>';
128
+ }
129
+
130
+ addConnectionPoints(element, id) {
131
+ const inputPoint = document.createElement('div');
132
+ inputPoint.className = 'connection-point input';
133
+ inputPoint.dataset.component = id;
134
+ inputPoint.dataset.type = 'input';
135
+
136
+ const outputPoint = document.createElement('div');
137
+ outputPoint.className = 'connection-point output';
138
+ outputPoint.dataset.component = id;
139
+ outputPoint.dataset.type = 'output';
140
+
141
+ element.appendChild(inputPoint);
142
+ element.appendChild(outputPoint);
143
+ }
144
+
145
+ getDefaultProperties(type) {
146
+ const defaults = {
147
+ 'react-agent': {
148
+ name: 'react_agent',
149
+ model: 'gpt-4',
150
+ temperature: 0.7
151
+ },
152
+ 'tool': {
153
+ name: 'custom_tool',
154
+ description: 'A custom function tool',
155
+ function: 'def tool_function(input):\n return "processed: " + input'
156
+ },
157
+ 'prompt': {
158
+ template: 'You are a helpful assistant. Answer the following question: {question}',
159
+ variables: ['question']
160
+ },
161
+ 'memory': {
162
+ type: 'MemorySaver',
163
+ checkpoint_ttl: 3600
164
+ }
165
+ };
166
+
167
+ return defaults[type] || {};
168
+ }
169
+
170
+ selectComponent(componentElement) {
171
+ this.deselectComponent();
172
+ componentElement.classList.add('selected');
173
+ this.selectedComponent = this.components.find(c => c.id === componentElement.id);
174
+ this.showProperties(this.selectedComponent);
175
+ }
176
+
177
+ deselectComponent() {
178
+ document.querySelectorAll('.canvas-component.selected').forEach(el => {
179
+ el.classList.remove('selected');
180
+ });
181
+ this.selectedComponent = null;
182
+ this.hideProperties();
183
+ }
184
+
185
+ startDragging(componentElement, e) {
186
+ this.dragging = true;
187
+ const rect = componentElement.getBoundingClientRect();
188
+ const canvasRect = document.getElementById('canvas').getBoundingClientRect();
189
+
190
+ this.dragOffset = {
191
+ x: e.clientX - rect.left + canvasRect.left,
192
+ y: e.clientY - rect.top + canvasRect.top
193
+ };
194
+ }
195
+
196
+ dragComponent(e) {
197
+ if (!this.selectedComponent) return;
198
+
199
+ const canvasRect = document.getElementById('canvas').getBoundingClientRect();
200
+ const x = e.clientX - this.dragOffset.x;
201
+ const y = e.clientY - this.dragOffset.y;
202
+
203
+ const componentElement = document.getElementById(this.selectedComponent.id);
204
+ componentElement.style.left = `${x}px`;
205
+ componentElement.style.top = `${y}px`;
206
+
207
+ this.selectedComponent.x = x;
208
+ this.selectedComponent.y = y;
209
+ }
210
+
211
+ showProperties(component) {
212
+ const panel = document.getElementById('properties-panel');
213
+ const content = document.getElementById('properties-content');
214
+
215
+ panel.classList.remove('hidden');
216
+ content.innerHTML = this.generatePropertiesForm(component);
217
+
218
+ // Update properties on input change
219
+ content.querySelectorAll('input, textarea').forEach(input => {
220
+ input.addEventListener('change', (e) => {
221
+ component.properties[e.target.name] = e.target.value;
222
+ });
223
+ });
224
+ }
225
+
226
+ hideProperties() {
227
+ document.getElementById('properties-panel').classList.add('hidden');
228
+ }
229
+
230
+ generatePropertiesForm(component) {
231
+ const properties = component.properties;
232
+ let html = `<h3 class="text-lg font-semibold mb-4 capitalize">${component.type.replace('-', ' ')} Properties</h3>`;
233
+
234
+ Object.keys(properties).forEach(key => {
235
+ const value = properties[key];
236
+ const isTextarea = typeof value === 'string' && value.includes('\n');
237
+
238
+ html += `
239
+ <div class="property-group">
240
+ <label class="property-label capitalize">${key.replace('_', ' ')}</label>
241
+ ${isTextarea ?
242
+ `<textarea name="${key}" class="property-input h-24">${value}</textarea>` :
243
+ `<input type="text" name="${key}" value="${value}" class="property-input">`
244
+ }
245
+ </div>
246
+ `;
247
+ });
248
+
249
+ return html;
250
+ }
251
+
252
+ exportToPython() {
253
+ let code = `# Generated by AgentFlow Studio\n`;
254
+ code += `from langchain_core.messages import HumanMessage, ToolMessage\n`;
255
+ code += `from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder\n`;
256
+ code += `from langgraph.graph import StateGraph, END\n`;
257
+ code += `from langgraph.checkpoint.memory import MemorySaver\n`;
258
+ code += `from pydantic import BaseModel, Field\n`;
259
+ code += `from langchain.agents import create_react_agent\n\n`;
260
+
261
+ // Add component definitions
262
+ this.components.forEach(comp => {
263
+ code += `# ${comp.type} component\n`;
264
+ switch(comp.type) {
265
+ case 'react-agent':
266
+ code += `agent = create_react_agent(\n`;
267
+ code += ` model="${comp.properties.model}",\n`;
268
+ code += ` temperature=${comp.properties.temperature}\n`;
269
+ code += `)\n\n`;
270
+ break;
271
+ case 'tool':
272
+ code += `class ${comp.properties.name.replace('_', ' ').title().replace(' ', '')}Tool(BaseModel):\n`;
273
+ code += ` \"\"\"${comp.properties.description}\"\"\"\n\n`;
274
+ code += ` def execute(self, input: str) -> str:\n`;
275
+ code += ` ${comp.properties.function.replace('\n', '\n ')}\n\n`;
276
+ break;
277
+ case 'prompt':
278
+ code += `prompt_template = ChatPromptTemplate.from_template(\n`;
279
+ code += ` \"\"\"${comp.properties.template}\"\"\"\n`;
280
+ code += `)\n\n`;
281
+ break;
282
+ case 'memory':
283
+ code += `memory = MemorySaver()\n\n`;
284
+ break;
285
+ }
286
+ });
287
+
288
+ // Add graph construction
289
+ code += `# Build the agent graph\n`;
290
+ code += `graph_builder = StateGraph()\n\n`;
291
+
292
+ code += `# Export the final agent\n`;
293
+ code += `def get_agent():\n`;
294
+ code += ` return graph_builder.compile()\n`;
295
+
296
+ return code;
297
+ }
298
+ }
299
+ // Global functions for UI interactions
300
+ function startNewProject() {
301
+ const builder = new AgentBuilder();
302
+ window.agentBuilder = builder;
303
+ document.getElementById('canvas').innerHTML = '';
304
+ document.getElementById('properties-panel').classList.add('hidden');
305
+ }
306
+
307
+ function loadSample() {
308
+ startNewProject();
309
+ // Add sample components
310
+ window.agentBuilder.addComponent('react-agent', 100, 100);
311
+ window.agentBuilder.addComponent('tool', 300, 100);
312
+ window.agentBuilder.addComponent('prompt', 100, 200);
313
+ window.agentBuilder.addComponent('memory', 300, 200);
314
+ }
315
+
316
+ function loadExample(exampleType) {
317
+ startNewProject();
318
+
319
+ switch(exampleType) {
320
+ case 'research':
321
+ // Research Assistant Example
322
+ const researchAgent = window.agentBuilder.addComponent('react-agent', 100, 100);
323
+ const webSearchTool = window.agentBuilder.addComponent('tool', 300, 100);
324
+ const researchPrompt = window.agentBuilder.addComponent('prompt', 100, 200);
325
+ const researchMemory = window.agentBuilder.addComponent('memory', 300, 200);
326
+
327
+ // Configure components
328
+ const researchComponents = window.agentBuilder.components;
329
+ researchComponents.find(c => c.id === researchAgent).properties = {
330
+ name: 'research_assistant',
331
+ model: 'gpt-4',
332
+ temperature: 0.3,
333
+ max_tokens: 2000
334
+ };
335
+ researchComponents.find(c => c.id === webSearchTool).properties = {
336
+ name: 'web_search',
337
+ description: 'Search the web for current information',
338
+ function: 'def web_search(query):\n # Implementation for web search\n return f"Searched for: {query}"'
339
+ };
340
+ researchComponents.find(c => c.id === researchPrompt).properties = {
341
+ template: 'You are a research assistant. Search for information about: {topic}. Provide detailed, well-sourced answers.',
342
+ variables: ['topic']
343
+ };
344
+ researchComponents.find(c => c.id === researchMemory).properties = {
345
+ type: 'MemorySaver',
346
+ checkpoint_ttl: 7200
347
+ };
348
+ break;
349
+
350
+ case 'ecommerce':
351
+ // E-commerce Assistant Example
352
+ const ecomAgent = window.agentBuilder.addComponent('react-agent', 100, 100);
353
+ const productSearch = window.agentBuilder.addComponent('tool', 300, 100);
354
+ const priceCompare = window.agentBuilder.addComponent('tool', 500, 100);
355
+ const ecomPrompt = window.agentBuilder.addComponent('prompt', 100, 200);
356
+ const ecomMemory = window.agentBuilder.addComponent('memory', 300, 200);
357
+
358
+ const ecomComponents = window.agentBuilder.components;
359
+ ecomComponents.find(c => c.id === ecomAgent).properties = {
360
+ name: 'ecommerce_assistant',
361
+ model: 'gpt-4',
362
+ temperature: 0.2,
363
+ max_tokens: 1500
364
+ };
365
+ ecomComponents.find(c => c.id === productSearch).properties = {
366
+ name: 'product_search',
367
+ description: 'Search for products in the catalog',
368
+ function: 'def product_search(category, keywords):\n # Search product database\n return f"Products in {category} matching {keywords}"'
369
+ };
370
+ ecomComponents.find(c => c.id === priceCompare).properties = {
371
+ name: 'price_comparison',
372
+ description: 'Compare prices across different vendors',
373
+ function: 'def price_comparison(product_id):\n # Get price comparisons\n return f"Price comparison for product {product_id}"'
374
+ };
375
+ ecomComponents.find(c => c.id === ecomPrompt).properties = {
376
+ template: 'You are an e-commerce assistant. Help customers find products and compare prices. Be helpful and concise.',
377
+ variables: ['user_query']
378
+ };
379
+ ecomComponents.find(c => c.id === ecomMemory).properties = {
380
+ type: 'MemorySaver',
381
+ checkpoint_ttl: 3600
382
+ };
383
+ break;
384
+
385
+ case 'code':
386
+ // Code Assistant Example
387
+ const codeAgent = window.agentBuilder.addComponent('react-agent', 100, 100);
388
+ const codeGenerator = window.agentBuilder.addComponent('tool', 300, 100);
389
+ const debuggerTool = window.agentBuilder.addComponent('tool', 500, 100);
390
+ const codePrompt = window.agentBuilder.addComponent('prompt', 100, 200);
391
+ const codeMemory = window.agentBuilder.addComponent('memory', 300, 200);
392
+
393
+ const codeComponents = window.agentBuilder.components;
394
+ codeComponents.find(c => c.id === codeAgent).properties = {
395
+ name: 'code_assistant',
396
+ model: 'gpt-4',
397
+ temperature: 0.1,
398
+ max_tokens: 3000
399
+ };
400
+ codeComponents.find(c => c.id === codeGenerator).properties = {
401
+ name: 'code_generation',
402
+ description: 'Generate code based on requirements',
403
+ function: 'def generate_code(language, requirements):\n # Generate code implementation\n return f"Generated {language} code for: {requirements}"'
404
+ };
405
+ codeComponents.find(c => c.id === debuggerTool).properties = {
406
+ name: 'debug_code',
407
+ description: 'Help debug and fix code issues',
408
+ function: 'def debug_code(code, error):\n # Debug code implementation\n return f"Debugged code with error: {error}"'
409
+ };
410
+ codeComponents.find(c => c.id === codePrompt).properties = {
411
+ template: 'You are a programming assistant. Help with code generation, debugging, and explanations. Provide clear, working code examples.',
412
+ variables: ['programming_task']
413
+ };
414
+ codeComponents.find(c => c.id === codeMemory).properties = {
415
+ type: 'MemorySaver',
416
+ checkpoint_ttl: 4800
417
+ };
418
+ break;
419
+
420
+ case 'support':
421
+ // Customer Support Example
422
+ const supportAgent = window.agentBuilder.addComponent('react-agent', 100, 100);
423
+ const faqSearch = window.agentBuilder.addComponent('tool', 300, 100);
424
+ const ticketCreator = window.agentBuilder.addComponent('tool', 500, 100);
425
+ const supportPrompt = window.agentBuilder.addComponent('prompt', 100, 200);
426
+ const supportMemory = window.agentBuilder.addComponent('memory', 300, 200);
427
+
428
+ const supportComponents = window.agentBuilder.components;
429
+ supportComponents.find(c => c.id === supportAgent).properties = {
430
+ name: 'support_agent',
431
+ model: 'gpt-4',
432
+ temperature: 0.4,
433
+ max_tokens: 1200
434
+ };
435
+ supportComponents.find(c => c.id === faqSearch).properties = {
436
+ name: 'faq_search',
437
+ description: 'Search the FAQ database for answers',
438
+ function: 'def search_faq(question):\n # Search FAQ database\n return f"FAQ results for: {question}"'
439
+ };
440
+ supportComponents.find(c => c.id === ticketCreator).properties = {
441
+ name: 'create_ticket',
442
+ description: 'Create a support ticket for escalation',
443
+ function: 'def create_ticket(issue, priority):\n # Create support ticket\n return f"Created {priority} ticket for: {issue}"'
444
+ };
445
+ supportComponents.find(c => c.id === supportPrompt).properties = {
446
+ template: 'You are a customer support agent. Be empathetic and helpful. Use FAQs when possible, escalate when needed.',
447
+ variables: ['customer_issue']
448
+ };
449
+ supportComponents.find(c => c.id === supportMemory).properties = {
450
+ type: 'MemorySaver',
451
+ checkpoint_ttl: 2400
452
+ };
453
+ break;
454
+
455
+ case 'analyst':
456
+ // Data Analyst Example
457
+ const analystAgent = window.agentBuilder.addComponent('react-agent', 100, 100);
458
+ const dataProcessor = window.agentBuilder.addComponent('tool', 300, 100);
459
+ const statsAnalyzer = window.agentBuilder.addComponent('tool', 500, 100);
460
+ const analystPrompt = window.agentBuilder.addComponent('prompt', 100, 200);
461
+ const analystMemory = window.agentBuilder.addComponent('memory', 300, 200);
462
+
463
+ const analystComponents = window.agentBuilder.components;
464
+ analystComponents.find(c => c.id === analystAgent).properties = {
465
+ name: 'data_analyst',
466
+ model: 'gpt-4',
467
+ temperature: 0.2,
468
+ max_tokens: 2500
469
+ };
470
+ analystComponents.find(c => c.id === dataProcessor).properties = {
471
+ name: 'process_data',
472
+ description: 'Process and clean datasets',
473
+ function: 'def process_data(dataset, operations):\n # Process data implementation\n return f"Processed dataset with: {operations}"'
474
+ };
475
+ analystComponents.find(c => c.id === statsAnalyzer).properties = {
476
+ name: 'analyze_statistics',
477
+ description: 'Perform statistical analysis on data',
478
+ function: 'def analyze_stats(data, metrics):\n # Statistical analysis\n return f"Analysis results for metrics: {metrics}"'
479
+ };
480
+ analystComponents.find(c => c.id === analystPrompt).properties = {
481
+ template: 'You are a data analyst. Help analyze datasets, generate insights, and create visualizations. Be precise and data-driven.',
482
+ variables: ['analysis_request']
483
+ };
484
+ analystComponents.find(c => c.id === analystMemory).properties = {
485
+ type: 'MemorySaver',
486
+ checkpoint_ttl: 6000
487
+ };
488
+ break;
489
+
490
+ case 'translator':
491
+ // Multi-language Translator Example
492
+ const translatorAgent = window.agentBuilder.addComponent('react-agent', 100, 100);
493
+ const translateTool = window.agentBuilder.addComponent('tool', 300, 100);
494
+ const contextTool = window.agentBuilder.addComponent('tool', 500, 100);
495
+ const translatorPrompt = window.agentBuilder.addComponent('prompt', 100, 200);
496
+ const translatorMemory = window.agentBuilder.addComponent('memory', 300, 200);
497
+
498
+ const translatorComponents = window.agentBuilder.components;
499
+ translatorComponents.find(c => c.id === translatorAgent).properties = {
500
+ name: 'translator',
501
+ model: 'gpt-4',
502
+ temperature: 0.3,
503
+ max_tokens: 1800
504
+ };
505
+ translatorComponents.find(c => c.id === translateTool).properties = {
506
+ name: 'translate_text',
507
+ description: 'Translate text between languages',
508
+ function: 'def translate(text, source_lang, target_lang):\n # Translation implementation\n return f"Translated from {source_lang} to {target_lang}: {text}"'
509
+ };
510
+ translatorComponents.find(c => c.id === contextTool).properties = {
511
+ name: 'preserve_context',
512
+ description: 'Maintain context and cultural nuances',
513
+ function: 'def preserve_context(translation, context):\n # Context preservation\n return f"Context-preserved translation: {translation}"'
514
+ };
515
+ translatorComponents.find(c => c.id === translatorPrompt).properties = {
516
+ template: 'You are a multilingual translator. Translate text while preserving meaning, context, and cultural nuances. Support multiple languages.',
517
+ variables: ['text_to_translate', 'target_language']
518
+ };
519
+ translatorComponents.find(c => c.id === translatorMemory).properties = {
520
+ type: 'MemorySaver',
521
+ checkpoint_ttl: 5400
522
+ };
523
+ break;
524
+ }
525
+
526
+ // Update the UI to show the loaded example
527
+ document.getElementById('properties-panel').classList.add('hidden');
528
+
529
+ // Show success message
530
+ showNotification(`Loaded ${exampleType.replace(/_/g, ' ')} example successfully!`, 'success');
531
+ }
532
+ function exportAgent() {
533
+ if (!window.agentBuilder || window.agentBuilder.components.length === 0) {
534
+ showNotification('Please add some components to the canvas first!', 'error');
535
+ return;
536
+ }
537
+
538
+ const code = window.agentBuilder.exportToPython();
539
+ showCodeModal(code);
540
+ }
541
+ function clearCanvas() {
542
+ if (confirm('Are you sure you want to clear the canvas?')) {
543
+ document.getElementById('canvas').innerHTML = '';
544
+ document.getElementById('properties-panel').classList.add('hidden');
545
+ if (window.agentBuilder) {
546
+ window.agentBuilder.components = [];
547
+ window.agentBuilder.connections = [];
548
+ }
549
+ showNotification('Canvas cleared successfully!', 'success');
550
+ }
551
+ }
552
+ function showCodeModal(code) {
553
+ const modal = document.createElement('div');
554
+ modal.className = 'modal-overlay';
555
+ modal.innerHTML = `
556
+ <div class="modal-content">
557
+ <div class="flex justify-between items-center mb-4">
558
+ <h3 class="text-xl font-semibold">Generated Python Code</h3>
559
+ <button onclick="this.closest('.modal-overlay').remove()" class="text-gray-400 hover:text-white">
560
+ <i data-feather="x"></i>
561
+ </button>
562
+ </div>
563
+ <pre class="bg-gray-900 p-4 rounded-lg overflow-auto max-h-96"><code class="language-python">${code}</code></pre>
564
+ <div class="flex gap-2 mt-4">
565
+ <button onclick="copyCode()" class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg flex-1">
566
+ <i data-feather="copy" class="mr-2"></i>Copy to Clipboard
567
+ </button>
568
+ <button onclick="downloadCode()" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg flex-1">
569
+ <i data-feather="download" class="mr-2"></i>Download .py
570
+ </button>
571
+ </div>
572
+ </div>
573
+ `;
574
+
575
+ document.body.appendChild(modal);
576
+ feather.replace();
577
+
578
+ window.copyCode = function() {
579
+ navigator.clipboard.writeText(code).then(() => {
580
+ alert('Code copied to clipboard!');
581
+ });
582
+ };
583
+
584
+ window.downloadCode = function() {
585
+ const blob = new Blob([code], { type: 'text/python' });
586
+ const url = URL.createObjectURL(blob);
587
+ const a = document.createElement('a');
588
+ a.href = url;
589
+ a.download = 'langchain_agent.py';
590
+ a.click();
591
+ URL.revokeObjectURL(url);
592
+ };
593
+ }
594
+ // Notification system
595
+ function showNotification(message, type = 'info') {
596
+ const notification = document.createElement('div');
597
+ notification.className = `fixed top-4 right-4 z-50 p-4 rounded-lg shadow-lg transition-all duration-300 transform translate-x-full ${
598
+ type === 'success' ? 'bg-green-600' :
599
+ type === 'error' ? 'bg-red-600' :
600
+ 'bg-blue-600'
601
+ } text-white`;
602
+ notification.innerHTML = `
603
+ <div class="flex items-center gap-2">
604
+ <i data-feather="${type === 'success' ? 'check-circle' : type === 'error' ? 'alert-circle' : 'info'}"></i>
605
+ <span>${message}</span>
606
+ </div>
607
+ `;
608
+
609
+ document.body.appendChild(notification);
610
+
611
+ // Animate in
612
+ setTimeout(() => {
613
+ notification.style.transform = 'translateX(0)';
614
+ }, 100);
615
+
616
+ // Animate out and remove
617
+ setTimeout(() => {
618
+ notification.style.transform = 'translateX(full)';
619
+ setTimeout(() => {
620
+ if (notification.parentNode) {
621
+ notification.parentNode.removeChild(notification);
622
+ }
623
+ }, 300);
624
+ }, 3000);
625
+
626
+ feather.replace();
627
+ }
628
+
629
+ // Initialize the app when page loads
630
+ document.addEventListener('DOMContentLoaded', () => {
631
+ window.agentBuilder = new AgentBuilder();
632
+ feather.replace();
633
+
634
+ // Check for example parameter in URL
635
+ const urlParams = new URLSearchParams(window.location.search);
636
+ const example = urlParams.get('example');
637
+ if (example && ['research', 'ecommerce', 'code', 'support', 'analyst', 'translator'].includes(example)) {
638
+ // Small delay to ensure everything is loaded
639
+ setTimeout(() => {
640
+ loadExample(example);
641
+ }, 500);
642
+ }
643
+ });
644
+ console.log('AgentFlow Studio loaded');
style.css CHANGED
@@ -1,28 +1,184 @@
 
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
 
 
 
 
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
28
  }
 
1
+ /* Shared styles across all pages */
2
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
3
+
4
  body {
5
+ font-family: 'Inter', sans-serif;
6
+ }
7
+
8
+ /* Custom scrollbar */
9
+ ::-webkit-scrollbar {
10
+ width: 8px;
11
+ }
12
+
13
+ ::-webkit-scrollbar-track {
14
+ background: #1f2937;
15
+ }
16
+
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #4b5563;
19
+ border-radius: 4px;
20
+ }
21
+
22
+ ::-webkit-scrollbar-thumb:hover {
23
+ background: #6b7280;
24
+ }
25
+
26
+ /* Drag and drop styles */
27
+ .toolbox-item {
28
+ transition: transform 0.2s ease;
29
+ }
30
+
31
+ .toolbox-item:hover {
32
+ transform: translateY(-2px);
33
+ }
34
+
35
+ .toolbox-item:active {
36
+ transform: translateY(0);
37
+ }
38
+
39
+ /* Canvas component styles */
40
+ .canvas-component {
41
+ background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
42
+ border: 2px solid #6b7280;
43
+ border-radius: 8px;
44
+ padding: 16px;
45
+ margin: 8px;
46
+ min-width: 200px;
47
+ cursor: move;
48
+ transition: all 0.3s ease;
49
+ position: relative;
50
+ }
51
+
52
+ .canvas-component:hover {
53
+ border-color: #3b82f6;
54
+ box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
55
+ }
56
+
57
+ .canvas-component.selected {
58
+ border-color: #10b981;
59
+ box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
60
+ }
61
+
62
+ .component-handle {
63
+ cursor: move;
64
+ padding: 8px;
65
+ background: rgba(0, 0, 0, 0.2);
66
+ border-radius: 4px;
67
+ margin-bottom: 8px;
68
+ }
69
+
70
+ .connection-point {
71
+ width: 12px;
72
+ height: 12px;
73
+ border-radius: 50%;
74
+ background: #6b7280;
75
+ position: absolute;
76
+ cursor: crosshair;
77
+ }
78
+
79
+ .connection-point.input {
80
+ top: 50%;
81
+ left: -6px;
82
+ transform: translateY(-50%);
83
+ }
84
+
85
+ .connection-point.output {
86
+ top: 50%;
87
+ right: -6px;
88
+ transform: translateY(-50%);
89
+ }
90
+
91
+ .connection-line {
92
+ stroke: #3b82f6;
93
+ stroke-width: 2;
94
+ fill: none;
95
+ }
96
+
97
+ /* Properties panel styles */
98
+ .property-group {
99
+ margin-bottom: 1.5rem;
100
+ }
101
+
102
+ .property-label {
103
+ display: block;
104
+ margin-bottom: 0.5rem;
105
+ font-weight: 500;
106
+ color: #d1d5db;
107
+ }
108
+
109
+ .property-input {
110
+ width: 100%;
111
+ padding: 0.5rem;
112
+ border-radius: 0.375rem;
113
+ background: #374151;
114
+ border: 1px solid #4b5563;
115
+ color: white;
116
+ }
117
+
118
+ .property-input:focus {
119
+ outline: none;
120
+ border-color: #3b82f6;
121
+ ring: 2px solid #3b82f6;
122
+ }
123
+
124
+ /* Code export modal */
125
+ .modal-overlay {
126
+ position: fixed;
127
+ top: 0;
128
+ left: 0;
129
+ right: 0;
130
+ bottom: 0;
131
+ background: rgba(0, 0, 0, 0.8);
132
+ display: flex;
133
+ align-items: center;
134
+ justify-content: center;
135
+ z-index: 1000;
136
+ }
137
+
138
+ .modal-content {
139
+ background: #1f2937;
140
+ border-radius: 12px;
141
+ padding: 2rem;
142
+ max-width: 90vw;
143
+ max-height: 90vh;
144
+ overflow: auto;
145
+ }
146
+ /* Quick Examples Section */
147
+ .quick-example {
148
+ transition: all 0.3s ease;
149
+ cursor: pointer;
150
+ }
151
+
152
+ .quick-example:hover {
153
+ transform: translateY(-2px);
154
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
155
  }
156
 
157
+ /* Notification styles */
158
+ .notification {
159
+ animation: slideIn 0.3s ease-out;
160
  }
161
 
162
+ @keyframes slideIn {
163
+ from {
164
+ transform: translateX(100%);
165
+ opacity: 0;
166
+ }
167
+ to {
168
+ transform: translateX(0);
169
+ opacity: 1;
170
+ }
171
  }
172
 
173
+ /* Responsive adjustments */
174
+ @media (max-width: 768px) {
175
+ .grid-cols-4 {
176
+ grid-template-columns: repeat(2, 1fr);
177
+ }
 
178
  }
179
 
180
+ @media (max-width: 480px) {
181
+ .grid-cols-4 {
182
+ grid-template-columns: 1fr;
183
+ }
184
  }