first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
/**
* Smarty plugin.
*/
/**
* Smarty {insert_llm_button} plugin.
*
* Purpose: Insert llm button
*
* @param array $params parameters
* @param Smarty_Internal_Template $smarty template object
*
* @return string
*/
function smarty_function_insert_llm_button($params, $smarty)
{
if (!findModule(Modules::LLM)) {
return;
}
$textObjectUtil = \KupShop\KupShopBundle\Util\Compat\ServiceContainer::getService(\KupShop\LLMBundle\Util\TextObjectUtil::class);
$params['actions'] = [];
foreach ($textObjectUtil->getObjectLabelPrompts($params['type']) as $id => $prompt) {
$json = [
'entityType' => $params['entityType'] ?? substr(getVal('s'), 0, -4),
'entityId' => $params['entityId'] ?? getVal('ID'),
'target' => $params['target'],
'promptId' => $id,
'objectLabel' => $params['type'] ?? '',
'title' => $prompt->getTitle(),
];
$params['actions'][] = [
'id' => $id,
'title' => $prompt->getTitle(),
'json' => $json,
];
}
echo $smarty->_subTemplateRender('llm/text-dropdown.tpl', $smarty->cache_id, $smarty->compile_id, 0, null, $params, 0, false);
}