bemade-addons/openwebui_integration/views/res_company_views.xml
2025-02-18 14:55:35 -05:00

98 lines
5.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_company_form_inherit_openwebui" model="ir.ui.view">
<field name="name">res.company.form.inherit.openwebui</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="AI Configuration" name="ai_config">
<group>
<group string="Provider Selection">
<field name="ai_provider"/>
</group>
</group>
<!-- Ollama Configuration -->
<group string="Ollama Configuration" invisible="ai_provider != 'ollama'">
<group>
<field name="ollama_port" required="ai_provider == 'ollama'"/>
<button name="test_ollama_connection"
string="Test Connection"
type="object"
class="btn-primary"
invisible="ai_provider != 'ollama'"/>
</group>
</group>
<!-- OpenWebUI Configuration -->
<group string="OpenWebUI Configuration" invisible="ai_provider != 'openwebui'">
<group>
<field name="openwebui_enabled" required="ai_provider == 'openwebui'"/>
<field name="openwebui_api_url"
invisible="not openwebui_enabled"
required="openwebui_enabled"
placeholder="https://api.openwebui.com"/>
<field name="openwebui_api_key"
invisible="not openwebui_enabled"
required="openwebui_enabled"
password="True"/>
</group>
<group>
<field name="openwebui_verify_ssl"
invisible="not openwebui_enabled"/>
<field name="openwebui_timeout"
invisible="not openwebui_enabled"/>
<field name="openwebui_context_size"
invisible="not openwebui_enabled"
help="Size of the context window in tokens (e.g., 2048, 4096, 8192)"/>
<field name="openwebui_products_per_request"
invisible="not openwebui_enabled"
help="Number of products to process in a single API request"/>
<button name="test_openwebui_connection"
string="Test Connection"
type="object"
class="oe_highlight"
invisible="not openwebui_enabled"/>
</group>
</group>
<!-- Ollama Configuration -->
<group string="Ollama Configuration" invisible="ai_provider != 'ollama'">
<group>
<field name="openwebui_api_url"
required="ai_provider == 'ollama'"
placeholder="http://localhost:11434"/>
<field name="openwebui_context_size"
help="Size of the context window in tokens (e.g., 2048, 4096, 8192)"/>
<field name="openwebui_products_per_request"
help="Number of products to process in a single API request"/>
</group>
</group>
<group string="Models Configuration" invisible="not openwebui_enabled">
<field name="openwebui_default_model_id"
options="{'no_create': True, 'no_open': True}"
domain="[('is_active', '=', True)]"/>
</group>
<group string="Available Models" invisible="not openwebui_enabled">
<field name="openwebui_models_ids" nolabel="1">
<list create="false" delete="false" edit="true">
<field name="name"/>
<field name="identifier"/>
<field name="description"/>
<field name="is_active" widget="boolean_toggle"/>
</list>
</field>
</group>
<group>
<button name="refresh_model_list"
string="Refresh List"
type="object"
class="btn-secondary"
icon="fa-refresh"/>
</group>
</page>
</xpath>
</field>
</record>
</odoo>