承接 gtstudio/module-ai-data-query 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

gtstudio/module-ai-data-query

Composer 安装命令:

composer require gtstudio/module-ai-data-query

包简介

Natural-language data query interface for Magento 2. Lets admin users ask questions in plain English; the AI extracts intent and queries Magento entities locally — no raw store data sent to the LLM.

README 文档

README

Natural-language data query interface for Magento 2. Ask questions in plain English — the AI figures out what to query, the query runs locally, and results are returned directly to the browser. No store data is ever sent to the LLM.

Preview

AiDataQuery — asking plain-English questions and getting store analytics results

AI Studio Ecosystem

Part of the AI Studio suite for Magento 2. See all modules:

Module Repository Description
Gtstudio_AiConnector module-aiconnector Core AI provider abstraction
Gtstudio_AiAgents module-ai-agents Agent & tool orchestration, cron scheduling, execution log
Gtstudio_AiWidgets module-ai-widgets Floating admin chat widget + PageBuilder AI generator
Gtstudio_AiDataQuery (this module) Natural-language store analytics (privacy-first)
Gtstudio_AiKnowledgeBase module-ai-knowledge-base Document upload & RAG retrieval for agents
Gtstudio_AiDashboard module-ai-dashboard AI-powered KPI dashboard with ML insights

What It Does

  • Admin chat page where users type questions like "Show me the top 10 orders from last month" or "Which products have less than 5 units in stock?"
  • Two-phase privacy-first architecture:
    • Phase 1 — LLM receives only the user's question and returns a structured intent (which tool to call, which parameters)
    • Phase 2 — the server executes the query locally using the resolved intent and returns results directly to the browser
  • Built-in query tools: order analytics, customer lifetime value, product performance, and a general entity query
  • Token cost display in the chat interface

Privacy Architecture

The LLM sees nothing about your store data. It only:

  • Receives the user's natural-language question
  • Returns a JSON object describing which analytical tool to call and with what parameters

All actual database queries run on your server. Results are displayed to the user without routing back through the AI provider.

Requirements

  • Magento 2.4.4+
  • PHP 8.1+
  • Gtstudio_AiConnector enabled and configured
  • Gtstudio_AiAgents enabled

Installation

composer require gtstudio/module-ai-data-query
php bin/magento module:enable Gtstudio_AiDataQuery
php bin/magento setup:upgrade

A database agent record with code data_query is created automatically via a data patch.

Usage

Navigate to AI Studio → Data Query.

Example questions:

  • "Show total sales for the last 30 days"
  • "What are my top 5 customers by revenue?"
  • "List orders with status Pending from this week"
  • "Show products with inventory below 10 units"
  • "What is the average order value for this month?"

Built-in Query Tools

Tool Code Description
order_analytics Sales totals, order status distribution, average order value, top customers
customer_lifetime_value LTV ranking, RFM analysis, acquisition trends
product_performance Top sellers, low performers, revenue by category, inventory alerts
query_entity General-purpose query against any Magento entity

Extensibility

Registering a Custom Query Tool

  1. Implement Gtstudio\AiAgents\Api\ToolExecutorInterface:
namespace Vendor\Module\Model\Tool;

use Gtstudio\AiAgents\Api\ToolExecutorInterface;

class StoreRevenueExecutor implements ToolExecutorInterface
{
    public function execute(array $parameters): string|array
    {
        $storeId = (int) ($parameters['store_id'] ?? 0);
        // ... query DB, return formatted results
        return "Revenue for store #{$storeId}: $12,500.00";
    }
}
  1. Create a tool record in AI Studio → Tools with matching code (e.g. store_revenue).

  2. Register the executor via di.xml:

<type name="Gtstudio\AiAgents\Model\Tool\ToolExecutorPool">
    <arguments>
        <argument name="executors" xsi:type="array">
            <item name="store_revenue" xsi:type="object">
                Vendor\Module\Model\Tool\StoreRevenueExecutor
            </item>
        </argument>
    </arguments>
</type>
  1. Update the data_query agent's Background or Steps in the admin to describe your new tool so the LLM knows when to choose it.

Registering a Queryable Entity

The query_entity tool dispatches to registered entity handlers. Add a new entity:

<!-- etc/di.xml -->
<type name="Gtstudio\AiDataQuery\Model\Tool\QueryEntityRegistry">
    <arguments>
        <argument name="entities" xsi:type="array">
            <item name="my_entity" xsi:type="object">
                Vendor\Module\Model\Tool\MyEntityHandler
            </item>
        </argument>
    </arguments>
</type>

Implement the handler to return a collection, field list, and filter map.

Customising the Planner Prompt

The system prompt that instructs the LLM is built in DataQueryChatService::buildPlannerPrompt(). Override the service:

<preference for="Gtstudio\AiDataQuery\Model\Service\DataQueryChatService"
            type="Vendor\Module\Model\Service\CustomDataQueryChatService"/>

ACL Resources

Resource Controls
Gtstudio_AiDataQuery::management Access to the Data Query page and its API endpoints

gtstudio/module-ai-data-query 适用场景与选型建议

gtstudio/module-ai-data-query 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 gtstudio/module-ai-data-query 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 31
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BUSL-1.1
  • 更新时间: 2026-03-09