This commit represents a significant architectural improvement: - Completely replaced openwebui_connector with a more robust openwebui_base module - Centralized OpenWebUI API integration for better maintainability - Redesigned helpdesk_sale_order_ai to use the new openwebui_base module - Added support for multiple OpenWebUI providers and models - Improved error handling and response parsing - Added proper template management with openwebui_prompt_template - Fixed KeyError issues with safe template substitution - Streamlined API client initialization and usage
29 lines
724 B
Python
29 lines
724 B
Python
from odoo import models, fields, api
|
|
|
|
|
|
class OpenWebUIModel(models.Model):
|
|
_name = "openwebui.model"
|
|
_description = "OpenWebUI Model"
|
|
|
|
technical_name = fields.Char(
|
|
required=True,
|
|
help="Technical name of the model on the OpenWebUI server.",
|
|
readonly=True,
|
|
)
|
|
name = fields.Char(
|
|
required=True,
|
|
help="User-friendly name of the model.",
|
|
readonly=True,
|
|
)
|
|
provider_id = fields.Many2one(
|
|
"openwebui.provider",
|
|
required=True,
|
|
)
|
|
|
|
_sql_constraints = [
|
|
(
|
|
"technical_name_provider_unique",
|
|
"unique(technical_name, provider_id)",
|
|
"Technical name must be unique per provider",
|
|
)
|
|
]
|