定制 akpagni5547/filament-gemini-search 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

akpagni5547/filament-gemini-search

Composer 安装命令:

composer require akpagni5547/filament-gemini-search

包简介

Filament plugin for Gemini API search with Google Search Grounding

README 文档

README

A Filament v4/v5 plugin that integrates Google Gemini API with Google Search Grounding to perform real-time web searches directly from your admin panel.

Gemini doesn't just generate text — it performs real Google searches, analyzes the results, and returns structured responses with verifiable sources.

Features

  • Real-time web search via Gemini + Google Search Grounding
  • Dedicated search page with Markdown result rendering
  • Compact dashboard widget
  • Clickable sources and links to found websites
  • Search history stored in database
  • Multi-language support (EN/FR)
  • Full dark mode support
  • Compatible with Filament v4 and v5

Getting a Gemini API Key

Step 1: Create a Google AI Studio Account

  1. Go to Google AI Studio
  2. Sign in with your Google account

Step 2: Generate an API Key

  1. Click "Get API Key" in the left menu
  2. Click "Create API Key"
  3. Select a Google Cloud project (or create one)
  4. Copy the generated key (format: AIzaSy...)

Step 3: Free vs Paid Plan

Free Plan Paid Plan (Pay-as-you-go)
Requests/minute 15 2,000
Requests/day 1,500 Unlimited
Grounding Search Included Included
Cost $0 ~$0.001-0.01 / request

Tip: The free plan is more than enough for development and moderate production use. To enable billing, visit Google Cloud Console > Billing.

Step 4: Enable the API

If you encounter 403 errors, enable the API manually:

  1. Go to Google Cloud Console > APIs
  2. Search for "Generative Language API"
  3. Click "Enable"

Installation

composer require akpagni5547/filament-gemini-search

Add your key to .env:

GEMINI_API_KEY=AIzaSy...your-key-here
GEMINI_MODEL=gemini-2.5-flash

Publish the configuration and run migrations:

php artisan vendor:publish --tag=gemini-search-config
php artisan migrate

Register the plugin in your PanelProvider:

use SelfProject\FilamentGeminiSearch\FilamentGeminiSearchPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(FilamentGeminiSearchPlugin::make());
}

Configuration

// config/gemini-search.php

return [
    'api_key' => env('GEMINI_API_KEY'),
    'model' => env('GEMINI_MODEL', 'gemini-2.5-flash'),
    'grounding' => [
        'enabled' => true, // Enable Google Search Grounding
    ],
    'history' => [
        'enabled' => true,  // Save searches in DB
        'max_records' => 500,
    ],
    'navigation' => [
        'group' => null,         // Filament navigation group
        'icon' => 'heroicon-o-magnifying-glass',
        'sort' => 100,
    ],
];

Disable page or widget

FilamentGeminiSearchPlugin::make()
    ->disablePage()    // Keep only the widget
    ->disableWidget()  // Keep only the page

Use Cases

1. Price Monitoring / Comparison

Search for product prices across different e-commerce sites. Gemini performs the Google search and returns prices with links to stores.

"iPhone 16 Pro price comparison 2026"

Result: Price list with links to Amazon, Best Buy, etc.

2. Competitive Intelligence

Monitor what your competitors are doing, their offers, and latest news.

"Latest AWS pricing changes cloud computing March 2026"

Result: Summary of current offers with official sources.

3. Supplier Research

Find suppliers for your business needs directly from your back-office.

"Best wholesale office supplies distributors with delivery"

Result: List of suppliers with contacts and websites.

4. Enhanced Customer Support

Your support agents can search for product information in real-time to assist customers.

"Samsung Galaxy A15 full technical specifications"

Result: Detailed specifications with reliable sources.

5. Regulatory / Legal Research

Find information about current regulations.

"GDPR compliance requirements for SaaS companies 2026"

Result: Steps and required documents with official links.

6. Tech Watch

Stay informed about the latest tech trends from your admin dashboard.

"Laravel 12 new features and improvements"

Result: Summary of new features with links to official docs.

How It Works (Under the Hood)

+--------------+     +--------------+     +--------------+
| Filament UI  |---->| Gemini API   |---->| Google Search|
| (your app)   |     | (LLM)        |     | (grounding)  |
+--------------+     +------+-------+     +--------------+
                            |
                    +-------v-------+
                    | Response with |
                    | - AI text     |
                    | - Web sources |
                    | - Queries     |
                    +---------------+

The key is the tools: [{ google_search: {} }] parameter in the API call. This tells Gemini: "Before answering, perform a real Google search and base your response on the results."

Available Gemini Models

Model Speed Quality Grounding
gemini-2.5-flash Fast Very good Yes
gemini-2.5-pro Slower Excellent Yes
gemini-2.0-flash Very fast Good Yes
gemini-2.0-flash-lite Ultra fast Decent Yes

Recommended: gemini-2.5-flash — best speed/quality ratio.

Testing

Quick Test (without Laravel)

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \
  -H "x-goog-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{
    "contents": [{"parts": [{"text": "Latest Laravel features"}]}],
    "tools": [{"google_search": {}}]
  }'

Test in Laravel (Tinker)

php artisan tinker
$service = app(\SelfProject\FilamentGeminiSearch\Services\GeminiSearchService::class);
$result = $service->search('Latest Laravel 12 features');

echo $result->text;           // Formatted response
dump($result->sources);       // Sources with URLs
dump($result->searchQueries); // Google queries performed

License

MIT

akpagni5547/filament-gemini-search 适用场景与选型建议

akpagni5547/filament-gemini-search 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 6, 最近一次更新时间为 2026 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「search」 「google」 「laravel」 「Gemini」 「filament」 「grounding」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 akpagni5547/filament-gemini-search 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 akpagni5547/filament-gemini-search 我们能提供哪些服务?
定制开发 / 二次开发

基于 akpagni5547/filament-gemini-search 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 0
  • Forks: 1
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-04