mirror of
https://github.com/aljazceru/vibeline.git
synced 2026-01-10 18:14:25 +01:00
feat: implement YAML-based plugin system with metadata
This commit is contained in:
11
plugins/action_items_todo.yaml
Normal file
11
plugins/action_items_todo.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
name: action_items_todo
|
||||
description: Extract action items and todos from the transcript
|
||||
model: llama2 # Optional, falls back to OLLAMA_MODEL from .env
|
||||
type: or # or, and, all
|
||||
prompt: |
|
||||
Extract action items and todos from the following transcript.
|
||||
Format each item as a markdown checkbox.
|
||||
If there are no action items or todos, output "No action items or todos found."
|
||||
|
||||
Transcript:
|
||||
{transcript}
|
||||
10
plugins/summary.all.yaml
Normal file
10
plugins/summary.all.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
name: summary
|
||||
description: Generate a concise summary of the transcript
|
||||
model: llama2 # Optional, falls back to OLLAMA_MODEL from .env
|
||||
type: all # or, and, all
|
||||
prompt: |
|
||||
Please provide a concise summary of the following transcript.
|
||||
Focus on the main points and key takeaways.
|
||||
|
||||
Transcript:
|
||||
{transcript}
|
||||
@@ -4,6 +4,7 @@ python-dotenv>=1.0.0
|
||||
ollama>=0.1.17
|
||||
watchdog>=3.0.0
|
||||
inflect>=7.5.0
|
||||
pyyaml>=6.0.1
|
||||
|
||||
# Development dependencies
|
||||
pytest>=7.4.0
|
||||
|
||||
56
src/plugin_manager.py
Normal file
56
src/plugin_manager.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
from typing import Dict, Optional
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class Plugin:
|
||||
name: str
|
||||
description: str
|
||||
model: Optional[str]
|
||||
type: str # or, and, all
|
||||
prompt: str
|
||||
|
||||
class PluginManager:
|
||||
def __init__(self, plugin_dir: Path):
|
||||
self.plugin_dir = plugin_dir
|
||||
self.plugins: Dict[str, Plugin] = {}
|
||||
self.load_plugins()
|
||||
|
||||
def load_plugins(self) -> None:
|
||||
"""Load all YAML plugins from the plugin directory."""
|
||||
for plugin_file in self.plugin_dir.glob("*.yaml"):
|
||||
with open(plugin_file, 'r', encoding='utf-8') as f:
|
||||
data = yaml.safe_load(f)
|
||||
|
||||
# Validate required fields
|
||||
required_fields = ['name', 'description', 'type', 'prompt']
|
||||
for field in required_fields:
|
||||
if field not in data:
|
||||
raise ValueError(f"Plugin {plugin_file} is missing required field: {field}")
|
||||
|
||||
# Create Plugin instance
|
||||
plugin = Plugin(
|
||||
name=data['name'],
|
||||
description=data['description'],
|
||||
model=data.get('model'), # Optional
|
||||
type=data['type'],
|
||||
prompt=data['prompt']
|
||||
)
|
||||
|
||||
self.plugins[plugin.name] = plugin
|
||||
|
||||
def get_plugin(self, name: str) -> Optional[Plugin]:
|
||||
"""Get a plugin by name."""
|
||||
return self.plugins.get(name)
|
||||
|
||||
def get_all_plugins(self) -> Dict[str, Plugin]:
|
||||
"""Get all loaded plugins."""
|
||||
return self.plugins
|
||||
|
||||
def get_plugins_by_type(self, plugin_type: str) -> Dict[str, Plugin]:
|
||||
"""Get all plugins of a specific type."""
|
||||
return {name: plugin for name, plugin in self.plugins.items()
|
||||
if plugin.type == plugin_type}
|
||||
Reference in New Issue
Block a user