ai-site-pilot 0.4.4 → 0.4.5
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 +86 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,35 @@ Works with any AI model (Gemini, GPT-4, Claude, Llama) via [OpenRouter](https://
|
|
|
23
23
|
npm install ai-site-pilot
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## Setup
|
|
27
|
+
|
|
28
|
+
### Tailwind CSS Configuration (Required)
|
|
29
|
+
|
|
30
|
+
If you're using Tailwind CSS, add ai-site-pilot to your content config so Tailwind generates the necessary classes:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
// tailwind.config.js or tailwind.config.ts
|
|
34
|
+
module.exports = {
|
|
35
|
+
content: [
|
|
36
|
+
'./app/**/*.{js,ts,jsx,tsx}',
|
|
37
|
+
'./components/**/*.{js,ts,jsx,tsx}',
|
|
38
|
+
// Add this line:
|
|
39
|
+
'./node_modules/ai-site-pilot/dist/**/*.{js,mjs}',
|
|
40
|
+
],
|
|
41
|
+
// ...
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Without this, the button text ("Ask AI") and other responsive styles won't work correctly.**
|
|
46
|
+
|
|
47
|
+
### Import Styles
|
|
48
|
+
|
|
49
|
+
Make sure to import the CSS file in your component:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import 'ai-site-pilot/styles.css';
|
|
53
|
+
```
|
|
54
|
+
|
|
26
55
|
## Quick Start
|
|
27
56
|
|
|
28
57
|
### 1. Get an OpenRouter API Key
|
|
@@ -245,8 +274,65 @@ const generateFallback = createFallbackMessageGenerator({
|
|
|
245
274
|
|
|
246
275
|
- React 18+ or React 19
|
|
247
276
|
- Next.js 13+ (for API routes)
|
|
277
|
+
- Tailwind CSS (for responsive styles)
|
|
248
278
|
- OpenRouter API key (free at [openrouter.ai](https://openrouter.ai))
|
|
249
279
|
|
|
280
|
+
## Troubleshooting
|
|
281
|
+
|
|
282
|
+
### Button only shows icon, no "Ask AI" text
|
|
283
|
+
|
|
284
|
+
Your Tailwind config isn't scanning the package. Add this to your `tailwind.config.js`:
|
|
285
|
+
|
|
286
|
+
```js
|
|
287
|
+
content: [
|
|
288
|
+
// ... your paths
|
|
289
|
+
'./node_modules/ai-site-pilot/dist/**/*.{js,mjs}',
|
|
290
|
+
]
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Theme accent color not working
|
|
294
|
+
|
|
295
|
+
Make sure you're using the `accent` prop (preset) or `accentColor` prop (custom hex):
|
|
296
|
+
|
|
297
|
+
```tsx
|
|
298
|
+
// Using preset
|
|
299
|
+
<SitePilot theme={{ accent: 'pink' }} />
|
|
300
|
+
|
|
301
|
+
// Using custom color
|
|
302
|
+
<SitePilot theme={{ accentColor: '#ec4899' }} />
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Don't set CSS variables directly—use the component props.
|
|
306
|
+
|
|
307
|
+
### Tools not executing
|
|
308
|
+
|
|
309
|
+
1. Make sure you're handling tool calls in `onToolCall`:
|
|
310
|
+
```tsx
|
|
311
|
+
<SitePilot
|
|
312
|
+
onToolCall={(name, args) => {
|
|
313
|
+
console.log('Tool called:', name, args);
|
|
314
|
+
// Handle the tool...
|
|
315
|
+
}}
|
|
316
|
+
/>
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
2. Check browser console for errors
|
|
320
|
+
|
|
321
|
+
### "I've made some changes" generic message
|
|
322
|
+
|
|
323
|
+
Use `generateFallbackMessage` to customize messages when the AI uses tools without text:
|
|
324
|
+
|
|
325
|
+
```tsx
|
|
326
|
+
import { createFallbackMessageGenerator } from 'ai-site-pilot';
|
|
327
|
+
|
|
328
|
+
const generateFallback = createFallbackMessageGenerator({
|
|
329
|
+
navigate: (args) => `Navigated to ${args.section}`,
|
|
330
|
+
filter: (args) => `Filtered by ${args.category}`,
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
<SitePilot generateFallbackMessage={generateFallback} />
|
|
334
|
+
```
|
|
335
|
+
|
|
250
336
|
## License
|
|
251
337
|
|
|
252
338
|
MIT
|
package/package.json
CHANGED