bemade-addons/ai_integration_ollama_api/views/ollama_views.xml
2025-05-29 21:35:47 -04:00

108 lines
5.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Form View -->
<record id="ollama_instance_view_form" model="ir.ui.view">
<field name="name">ollama.instance.form</field>
<field name="model">ai.provider.instance</field>
<field name="type">form</field>
<field name="mode">primary</field>
<field name="inherit_id" ref="ai_integration.ai_provider_instance_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="replace">
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options="{'terminology': 'archive'}"/>
</button>
</div>
</xpath>
<xpath expr="//field[@name='api_key']" position="replace">
<field name="api_key" invisible="1"/>
</xpath>
<xpath expr="//notebook" position="inside">
<page string="Ollama Settings" name="ollama_settings"
invisible="provider_type != 'ollama'">
<group>
<group string="Generation Parameters">
<field name="num_ctx"/>
<field name="temperature"/>
<field name="top_p"/>
<field name="top_k"/>
<field name="repeat_penalty"/>
</group>
<group string="Advanced Settings">
<field name="stop_sequences" placeholder="Enter comma-separated stop sequences"/>
</group>
</group>
<div class="alert alert-info" role="alert" style="margin-top: 10px;">
<p><strong>Note:</strong> These settings will be used as defaults for all requests to this Ollama instance.
They can be overridden on a per-request basis.</p>
<ul>
<li><strong>Context Length:</strong> Longer context allows the model to consider more previous text but uses more memory.</li>
<li><strong>Temperature:</strong> Higher values (>1.0) make output more random, lower values make it more focused and deterministic.</li>
<li><strong>Top P:</strong> Controls diversity via nucleus sampling. Lower values (0.1) are more focused, higher values (0.9) more diverse.</li>
<li><strong>Top K:</strong> Limits the cumulative probability of tokens to sample from. Lower values are more focused.</li>
<li><strong>Repeat Penalty:</strong> Higher values (>1.0) make the model less likely to repeat itself.</li>
</ul>
</div>
</page>
</xpath>
</field>
</record>
<!-- Tree View -->
<record id="ollama_instance_view_list" model="ir.ui.view">
<field name="name">ollama.instance.list</field>
<field name="model">ai.provider.instance</field>
<field name="type">list</field>
<field name="arch" type="xml">
<list>
<field name="name"/>
<field name="provider_type"/>
<field name="host"/>
<field name="num_ctx" optional="show"/>
<field name="temperature" optional="hide"/>
<field name="active"/>
</list>
</field>
</record>
<!-- Search View -->
<record id="ollama_instance_view_search" model="ir.ui.view">
<field name="name">ollama.instance.search</field>
<field name="model">ai.provider.instance</field>
<field name="mode">primary</field>
<field name="inherit_id" ref="ai_integration.ai_provider_instance_view_search"/>
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<filter string="Context Length" name="group_by_num_ctx"
domain="[('provider_type', '=', 'ollama')]"
context="{'group_by': 'num_ctx'}"/>
</xpath>
</field>
</record>
<!-- Action -->
<record id="action_ollama_instance" model="ir.actions.act_window">
<field name="name">Ollama Instances</field>
<field name="res_model">ai.provider.instance</field>
<field name="view_mode">list,form</field>
<field name="domain">[('provider_type', '=', 'ollama')]</field>
<field name="context">{'default_provider_type': 'ollama'}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create your first Ollama instance
</p>
<p>
Configure Ollama instances to use local AI models in your Odoo instance.
Make sure you have Ollama installed and running on your server.
</p>
</field>
</record>
<!-- Menu Item -->
<menuitem id="menu_ollama_instance"
name="Ollama Instances"
parent="ai_integration.ai_integration_menu_config"
action="action_ollama_instance"
sequence="20"/>
</odoo>