42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?php
|
|
|
|
class LLMPromptsPlugin extends /snappymail/v/0.0.0/app/libraries/SnappyMail/Plugins/AbstractPlugin
|
|
{
|
|
public $id = 'llm-prompts';
|
|
public $name = 'LLM Email Writing Prompts';
|
|
public $version = '1.0';
|
|
public $description = 'Enhances email composition with AI-driven prompts powered by xAI Grok 3 API.';
|
|
public $author = 'Your Name';
|
|
public $url = 'https://github.com/your-repo/llm-prompts';
|
|
public $license = 'MIT';
|
|
|
|
public function Boot()
|
|
{
|
|
$this->addJs('js/llm-prompts.js');
|
|
$this->addTemplate('templates/llm-prompts.html');
|
|
$this->addHook('filter.compose', 'onFilterCompose');
|
|
$this->addHook('action.pre-send', 'onActionPreSend');
|
|
}
|
|
|
|
public function onFilterCompose($oAccount, $oCompose)
|
|
{
|
|
// Inject UI for Smart Prompts in compose window
|
|
// This will be handled by JavaScript
|
|
}
|
|
|
|
public function onActionPreSend($oAccount, $oMessage)
|
|
{
|
|
// Validate content before sending if generated by LLM
|
|
// Add any necessary validation or sanitization
|
|
}
|
|
|
|
public function configMapping(): array
|
|
{
|
|
return [
|
|
'grok3_api_key' => ['string', ''],
|
|
'selected_model' => ['string', 'grok-3'],
|
|
'enable_context_analysis' => ['bool', true],
|
|
'custom_prompts' => ['json', '[]']
|
|
];
|
|
}
|
|
}
|