lwazi 1.6.7 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -148
- package/package.json +1 -1
- package/src/Console/AnalyzeProjectCommand.php +10 -0
- package/src/Console/SetupCommand.php +10 -0
- package/src/Http/Controllers/ChatController.php +1 -1
- package/src/Services/GraphVisualizer.php +1 -1
- package/src/Services/LwaziAgent.php +1 -1
- package/src/Services/LwaziService.php +2 -2
package/README.md
CHANGED
|
@@ -1,187 +1,62 @@
|
|
|
1
|
-
# Lwazi
|
|
1
|
+
# Lwazi
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
3
|
+
AI assistant for Laravel applications.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Features
|
|
9
|
-
|
|
10
|
-
- 🤖 **AI-Powered Chat**: Integrates with Ollama for local AI conversations
|
|
11
|
-
- 🎨 **Customizable UI**: Modern chat widget with theme customization
|
|
12
|
-
- 🔍 **Smart Navigation**: AI understands your app structure and helps users navigate
|
|
13
|
-
- 📱 **Responsive Design**: Works on desktop and mobile
|
|
14
|
-
- ⚡ **Easy Installation**: One-command setup for Laravel projects
|
|
15
|
-
- 🔒 **Privacy-Focused**: Runs locally with Ollama, no external API calls
|
|
16
|
-
|
|
17
|
-
## Quick Start
|
|
18
|
-
|
|
19
|
-
### Prerequisites
|
|
20
|
-
|
|
21
|
-
- **Laravel 10+** application
|
|
22
|
-
- **PHP 8.1+**
|
|
23
|
-
- **Node.js 14+** (for installation)
|
|
24
|
-
- **Ollama** running locally
|
|
25
|
-
|
|
26
|
-
### Installation
|
|
5
|
+
## Install
|
|
27
6
|
|
|
28
7
|
```bash
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# This will automatically run the post-install script
|
|
33
|
-
# Then complete the installation by running:
|
|
34
|
-
npx lwazi
|
|
8
|
+
npm install lwazi
|
|
9
|
+
npx lwazi install
|
|
35
10
|
```
|
|
36
11
|
|
|
37
|
-
|
|
38
|
-
- Download the latest Lwazi package
|
|
39
|
-
- Configure your Laravel application
|
|
40
|
-
- Set up environment variables
|
|
41
|
-
- Publish necessary assets
|
|
42
|
-
- Generate your site's knowledge base
|
|
43
|
-
|
|
44
|
-
### Manual Installation
|
|
12
|
+
## Requirements
|
|
45
13
|
|
|
46
|
-
|
|
14
|
+
- Laravel 10+
|
|
15
|
+
- PHP 8.1+
|
|
16
|
+
- Ollama running locally
|
|
47
17
|
|
|
48
|
-
|
|
49
|
-
# Clone the repository
|
|
50
|
-
git clone https://github.com/nigelnkomo/lwazi.git
|
|
51
|
-
cd your-laravel-project
|
|
18
|
+
## Configure
|
|
52
19
|
|
|
53
|
-
|
|
54
|
-
cp -r /path/to/lwazi/lwazi ./
|
|
20
|
+
Add to `.env`:
|
|
55
21
|
|
|
56
|
-
# Run installation script
|
|
57
|
-
./lwazi/install
|
|
58
22
|
```
|
|
59
|
-
|
|
60
|
-
## Configuration
|
|
61
|
-
|
|
62
|
-
After installation, configure these environment variables in your `.env` file:
|
|
63
|
-
|
|
64
|
-
```env
|
|
65
|
-
# Lwazi AI Configuration
|
|
66
23
|
LWAZI_OLLAMA_URL=http://localhost:11434
|
|
67
24
|
LWAZI_MODEL=llama3.2:1b
|
|
68
|
-
LWAZI_API_URL=/lwazi
|
|
69
|
-
LWAZI_AUTO_INJECT=true
|
|
70
|
-
LWAZI_POSITION=bottom-right
|
|
71
|
-
LWAZI_THEME=blue
|
|
72
|
-
LWAZI_ACCENT="#007aff"
|
|
73
|
-
LWAZI_ACCENT_DARK="#0051d4"
|
|
74
25
|
```
|
|
75
26
|
|
|
76
27
|
## Usage
|
|
77
28
|
|
|
78
|
-
|
|
29
|
+
Lwazi adds a chat widget to your app automatically. Users can ask about your site and get AI-powered responses.
|
|
79
30
|
|
|
80
|
-
|
|
81
|
-
- Get navigation help
|
|
82
|
-
- Interact with your content using AI
|
|
83
|
-
|
|
84
|
-
### Laravel Commands
|
|
31
|
+
## Commands
|
|
85
32
|
|
|
86
33
|
```bash
|
|
87
|
-
# Re-analyze
|
|
88
|
-
php artisan lwazi:
|
|
89
|
-
|
|
90
|
-
# Run setup wizard
|
|
91
|
-
php artisan lwazi:setup
|
|
92
|
-
|
|
93
|
-
# Clear Lwazi cache
|
|
94
|
-
php artisan lwazi:clear
|
|
34
|
+
php artisan lwazi:ingest # Re-analyze app structure
|
|
35
|
+
php artisan lwazi:clear # Clear cache
|
|
95
36
|
```
|
|
96
37
|
|
|
97
|
-
## How It Works
|
|
98
|
-
|
|
99
|
-
Lwazi analyzes your Laravel application to understand:
|
|
100
|
-
|
|
101
|
-
- **Routes & Navigation**: Maps your site's structure
|
|
102
|
-
- **Content & Pages**: Indexes your views and content
|
|
103
|
-
- **Database Schema**: Understands your data relationships
|
|
104
|
-
- **Configuration**: Learns about your app's setup
|
|
105
|
-
|
|
106
|
-
This knowledge allows the AI to provide contextual, helpful responses specific to your application.
|
|
107
|
-
|
|
108
38
|
## Customization
|
|
109
39
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
Lwazi supports multiple themes and custom colors. Configure via environment variables or publish the config:
|
|
40
|
+
Publish config to customize:
|
|
113
41
|
|
|
114
42
|
```bash
|
|
115
43
|
php artisan vendor:publish --provider="Lwazi\Core\Providers\LwaziServiceProvider"
|
|
116
44
|
```
|
|
117
45
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Edit `config/lwazi.php` to customize:
|
|
46
|
+
Edit `config/lwazi.php` to change:
|
|
121
47
|
- AI model settings
|
|
122
48
|
- Widget appearance
|
|
123
49
|
- Response behavior
|
|
124
|
-
- Security settings
|
|
125
|
-
|
|
126
|
-
## Requirements
|
|
127
|
-
|
|
128
|
-
- **Laravel**: 10.0, 11.0, or 12.0
|
|
129
|
-
- **PHP**: 8.1 or higher
|
|
130
|
-
- **Ollama**: Latest version
|
|
131
|
-
- **Node.js**: 14+ (for installation only)
|
|
132
|
-
|
|
133
|
-
## Supported AI Models
|
|
134
|
-
|
|
135
|
-
Lwazi works with any Ollama-compatible model:
|
|
136
|
-
|
|
137
|
-
- **Llama 3.2**: `llama3.2:1b`, `llama3.2:3b`
|
|
138
|
-
- **Llama 3**: `llama3:8b`, `llama3:70b`
|
|
139
|
-
- **Mistral**: `mistral:7b`
|
|
140
|
-
- **Phi-3**: `phi3:3.8b`
|
|
141
|
-
- **Gemma**: `gemma:2b`, `gemma:7b`
|
|
142
50
|
|
|
143
51
|
## Troubleshooting
|
|
144
52
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
- Ensure Ollama is running: `ollama serve`
|
|
149
|
-
- Check the URL in your `.env` file
|
|
150
|
-
|
|
151
|
-
**"Model not found"**
|
|
152
|
-
- Pull the model: `ollama pull llama3.2:1b`
|
|
153
|
-
- Update `LWAZI_MODEL` in your `.env`
|
|
53
|
+
**Ollama not available**
|
|
54
|
+
- Run `ollama serve`
|
|
55
|
+
- Check `LWAZI_OLLAMA_URL` in `.env`
|
|
154
56
|
|
|
155
|
-
**
|
|
156
|
-
-
|
|
157
|
-
- Check browser console for JavaScript errors
|
|
158
|
-
|
|
159
|
-
### Getting Help
|
|
160
|
-
|
|
161
|
-
- 📖 **Documentation**: [GitHub Wiki](https://github.com/nigelnkomo/lwazi/wiki)
|
|
162
|
-
- 🐛 **Issues**: [GitHub Issues](https://github.com/nigelnkomo/lwazi/issues)
|
|
163
|
-
- 💬 **Discussions**: [GitHub Discussions](https://github.com/nigelnkomo/lwazi/discussions)
|
|
164
|
-
|
|
165
|
-
## Contributing
|
|
166
|
-
|
|
167
|
-
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
168
|
-
|
|
169
|
-
1. Fork the repository
|
|
170
|
-
2. Create a feature branch
|
|
171
|
-
3. Make your changes
|
|
172
|
-
4. Add tests if applicable
|
|
173
|
-
5. Submit a pull request
|
|
57
|
+
**Model not found**
|
|
58
|
+
- Run `ollama pull llama3.2:1b`
|
|
174
59
|
|
|
175
60
|
## License
|
|
176
61
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
## Credits
|
|
180
|
-
|
|
181
|
-
- **Ollama**: For providing the local AI inference engine
|
|
182
|
-
- **Laravel**: The PHP framework that makes this possible
|
|
183
|
-
- **Open Source Community**: For the amazing tools and libraries
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
**Made with ❤️ for the Laravel community**
|
|
62
|
+
MIT
|
package/package.json
CHANGED
|
@@ -69,6 +69,16 @@ class AnalyzeProjectCommand extends Command
|
|
|
69
69
|
|
|
70
70
|
$root = $this->extractRoot($rootUrl);
|
|
71
71
|
|
|
72
|
+
if (!isset($manifest['flat'])) {
|
|
73
|
+
$manifest['flat'] = [];
|
|
74
|
+
}
|
|
75
|
+
if (!isset($manifest['nodes'])) {
|
|
76
|
+
$manifest['nodes'] = [];
|
|
77
|
+
}
|
|
78
|
+
if (!isset($manifest['adjacency'])) {
|
|
79
|
+
$manifest['adjacency'] = [];
|
|
80
|
+
}
|
|
81
|
+
|
|
72
82
|
foreach ($routes as $route) {
|
|
73
83
|
$path = '/' . ltrim($route['uri'], '/');
|
|
74
84
|
|
|
@@ -149,6 +149,16 @@ class SetupCommand extends Command
|
|
|
149
149
|
|
|
150
150
|
$root = $this->extractRoot($rootUrl);
|
|
151
151
|
|
|
152
|
+
if (!isset($manifest['flat'])) {
|
|
153
|
+
$manifest['flat'] = [];
|
|
154
|
+
}
|
|
155
|
+
if (!isset($manifest['nodes'])) {
|
|
156
|
+
$manifest['nodes'] = [];
|
|
157
|
+
}
|
|
158
|
+
if (!isset($manifest['adjacency'])) {
|
|
159
|
+
$manifest['adjacency'] = [];
|
|
160
|
+
}
|
|
161
|
+
|
|
152
162
|
foreach ($routes as $route) {
|
|
153
163
|
$path = '/' . ltrim($route['uri'], '/');
|
|
154
164
|
|
|
@@ -55,7 +55,7 @@ class ChatController extends Controller
|
|
|
55
55
|
$ragService = app(RagService::class);
|
|
56
56
|
$routes = $ragService->getRouteIndex();
|
|
57
57
|
|
|
58
|
-
$prompt = "What
|
|
58
|
+
$prompt = "One word only. What does the user want to find? this user is asking about? Just return the word, nothing else. Question: {$message}";
|
|
59
59
|
|
|
60
60
|
$terms = [];
|
|
61
61
|
$llmError = null;
|
|
@@ -168,7 +168,7 @@ class LwaziService
|
|
|
168
168
|
return null;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
$prompt = "What
|
|
171
|
+
$prompt = "One word only. What does the user want to find? this user is asking about? Just return the word, nothing else. Question: {$message}";
|
|
172
172
|
|
|
173
173
|
$response = $this->callOllama([
|
|
174
174
|
['role' => 'system', 'content' => 'Return only one word.'],
|
|
@@ -337,7 +337,7 @@ class LwaziService
|
|
|
337
337
|
return null;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
$prompt = "What
|
|
340
|
+
$prompt = "One word only. What does the user want to find? this user is asking about? Just return the word, nothing else. Question: {$message}";
|
|
341
341
|
|
|
342
342
|
$response = $this->callOllama([
|
|
343
343
|
['role' => 'system', 'content' => 'Return only one word.'],
|