push
This commit is contained in:
74
dn_ai/views/ai_agent_views.xml
Normal file
74
dn_ai/views/ai_agent_views.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- ================= Agent ================= -->
|
||||
<record id="ai_agent_view_form" model="ir.ui.view">
|
||||
<field name="name">ai.agent.form</field>
|
||||
<field name="model">ai.agent</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="AI Agent">
|
||||
<header>
|
||||
<button name="action_launch_ai_chat" type="object"
|
||||
string="Start a chat" class="btn-primary" icon="fa-comments"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<field name="image_128" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
|
||||
<div class="oe_title">
|
||||
<label for="name"/>
|
||||
<h1>
|
||||
<field name="name" placeholder="e.g. Sales assistant"/>
|
||||
</h1>
|
||||
<field name="subtitle" placeholder="One line describing what this agent does"/>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="active"/>
|
||||
<field name="sequence"/>
|
||||
<field name="is_system_agent"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Instructions" name="instructions">
|
||||
<field name="system_prompt"
|
||||
placeholder="Describe the persona, tone and rules of this agent…"/>
|
||||
</page>
|
||||
<page string="Skills" name="skills">
|
||||
<field name="skill_ids" widget="many2many_tags"/>
|
||||
</page>
|
||||
<page string="Delegation" name="delegation">
|
||||
<field name="allowed_agent_ids" widget="many2many_tags"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<chatter/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="ai_agent_view_list" model="ir.ui.view">
|
||||
<field name="name">ai.agent.list</field>
|
||||
<field name="model">ai.agent</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="AI Agents">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="subtitle"/>
|
||||
<field name="skill_ids" widget="many2many_tags"/>
|
||||
<field name="is_system_agent"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="ai_agent_action" model="ir.actions.act_window">
|
||||
<field name="name">Agents</field>
|
||||
<field name="res_model">ai.agent</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">Create your first AI agent</p>
|
||||
<p>An agent combines a system prompt, skills and tools. Chat with it from the
|
||||
AI menu or from the systray.</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
68
dn_ai/views/ai_composer_views.xml
Normal file
68
dn_ai/views/ai_composer_views.xml
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="ai_composer_view_form" model="ir.ui.view">
|
||||
<field name="name">ai.composer.form</field>
|
||||
<field name="model">ai.composer</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="AI Composer">
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<label for="name"/>
|
||||
<h1><field name="name"/></h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="interface_key"/>
|
||||
<field name="focused_model_id"
|
||||
invisible="not interface_key"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="ai_agent_id"/>
|
||||
<field name="is_system_default"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Context" name="context">
|
||||
<field name="default_prompt"
|
||||
placeholder="Context sent along with the user's selection…"/>
|
||||
</page>
|
||||
<page string="Suggested prompts" name="prompts">
|
||||
<field name="available_prompt_ids">
|
||||
<list editable="bottom">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
</list>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="ai_composer_view_list" model="ir.ui.view">
|
||||
<field name="name">ai.composer.list</field>
|
||||
<field name="model">ai.composer</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="AI Composers">
|
||||
<field name="name"/>
|
||||
<field name="interface_key"/>
|
||||
<field name="focused_model_id"/>
|
||||
<field name="ai_agent_id"/>
|
||||
<field name="is_system_default"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="ai_composer_action" model="ir.actions.act_window">
|
||||
<field name="name">Contexts</field>
|
||||
<field name="res_model">ai.composer</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">Configure an AI entry point</p>
|
||||
<p>A composer binds a UI entry point (chatter button, systray, email composer)
|
||||
to an agent and a default context.</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
38
dn_ai/views/ai_menus.xml
Normal file
38
dn_ai/views/ai_menus.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Actions first: menuitems below reference them by xml id. -->
|
||||
<record id="action_dn_ai_chat" model="ir.actions.client">
|
||||
<field name="name">AI Chat</field>
|
||||
<field name="tag">dn_ai.chat</field>
|
||||
<field name="path">ai-chat</field>
|
||||
</record>
|
||||
|
||||
<record id="action_dn_ai_settings" model="ir.actions.act_window">
|
||||
<field name="name">AI Settings</field>
|
||||
<field name="path">dn-ai-settings</field>
|
||||
<field name="res_model">res.config.settings</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="context">{'module': 'dn_ai'}</field>
|
||||
</record>
|
||||
|
||||
<!-- The chat panel is the home of the app: clicking "AI" opens it. -->
|
||||
<menuitem id="menu_ai_root" name="AI" sequence="95"
|
||||
web_icon="dn_ai,static/description/icon.png"
|
||||
action="action_dn_ai_chat"/>
|
||||
|
||||
<menuitem id="menu_ai_chat" name="Chat" sequence="1"
|
||||
parent="menu_ai_root" action="action_dn_ai_chat"/>
|
||||
<menuitem id="menu_ai_agents" name="Agents" sequence="10"
|
||||
parent="menu_ai_root" action="ai_agent_action"/>
|
||||
<menuitem id="menu_ai_skills" name="Skills" sequence="20"
|
||||
parent="menu_ai_root" action="ai_skill_action"/>
|
||||
|
||||
<menuitem id="menu_ai_configuration" name="Configuration" sequence="90"
|
||||
parent="menu_ai_root" groups="base.group_system"/>
|
||||
<menuitem id="menu_ai_tools" name="Tools" sequence="10"
|
||||
parent="menu_ai_configuration" action="action_ai_tools"/>
|
||||
<menuitem id="menu_ai_composers" name="Contexts" sequence="20"
|
||||
parent="menu_ai_configuration" action="ai_composer_action"/>
|
||||
<menuitem id="menu_ai_settings" name="Settings" sequence="90"
|
||||
parent="menu_ai_configuration" action="action_dn_ai_settings"/>
|
||||
</odoo>
|
||||
32
dn_ai/views/ai_prompt_button_views.xml
Normal file
32
dn_ai/views/ai_prompt_button_views.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="ai_prompt_button_view_form" model="ir.ui.view">
|
||||
<field name="name">ai.prompt.button.form</field>
|
||||
<field name="model">ai.prompt.button</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Suggested Prompt">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="sequence"/>
|
||||
<field name="composer_id"/>
|
||||
</group>
|
||||
<field name="prompt" widget="html"
|
||||
placeholder="e.g. Summarize this record in 3 bullets"/>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="ai_prompt_button_view_list" model="ir.ui.view">
|
||||
<field name="name">ai.prompt.button.list</field>
|
||||
<field name="model">ai.prompt.button</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="Suggested Prompts" editable="bottom">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="composer_id"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
61
dn_ai/views/ai_skill_views.xml
Normal file
61
dn_ai/views/ai_skill_views.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="ai_skill_view_form" model="ir.ui.view">
|
||||
<field name="name">ai.skill.form</field>
|
||||
<field name="model">ai.skill</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="AI Skill">
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<label for="name"/>
|
||||
<h1><field name="name" placeholder="e.g. Create records"/></h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="sequence"/>
|
||||
<field name="type"/>
|
||||
<field name="is_native_skill"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Description" name="description">
|
||||
<field name="description"
|
||||
placeholder="Shown to the model to decide whether this skill is relevant…"/>
|
||||
</page>
|
||||
<page string="Instructions" name="instructions">
|
||||
<field name="instructions"
|
||||
placeholder="Full instructions injected once the skill is loaded…"/>
|
||||
</page>
|
||||
<page string="Tools" name="tools">
|
||||
<field name="tool_ids" widget="many2many_tags"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="ai_skill_view_list" model="ir.ui.view">
|
||||
<field name="name">ai.skill.list</field>
|
||||
<field name="model">ai.skill</field>
|
||||
<field name="arch" type="xml">
|
||||
<list string="AI Skills">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="tool_ids" widget="many2many_tags"/>
|
||||
<field name="is_native_skill"/>
|
||||
</list>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="ai_skill_action" model="ir.actions.act_window">
|
||||
<field name="name">Skills</field>
|
||||
<field name="res_model">ai.skill</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">Create a skill</p>
|
||||
<p>A skill teaches the assistant a workflow: instructions plus the tools it may use.</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
66
dn_ai/views/ai_tool_views.xml
Normal file
66
dn_ai/views/ai_tool_views.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Tools are server actions flagged with use_in_ai; we extend the
|
||||
existing server-action views instead of duplicating them. -->
|
||||
<record id="view_server_action_form_ai" model="ir.ui.view">
|
||||
<field name="name">ir.actions.server.form.ai</field>
|
||||
<field name="model">ir.actions.server</field>
|
||||
<field name="inherit_id" ref="base.view_server_action_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook" position="inside">
|
||||
<page string="AI" name="ai_tool"
|
||||
invisible="not ai_tool_is_candidate">
|
||||
<group>
|
||||
<group string="Tool definition">
|
||||
<field name="use_in_ai"/>
|
||||
<field name="ai_tool_name"
|
||||
invisible="not use_in_ai"/>
|
||||
<field name="ai_tool_thinking_text"
|
||||
invisible="not use_in_ai"/>
|
||||
<field name="ai_tool_requires_confirmation"
|
||||
invisible="not use_in_ai"/>
|
||||
</group>
|
||||
<group string="Status">
|
||||
<field name="ai_tool_is_candidate"/>
|
||||
<field name="ai_tool_has_schema"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Description for the model"/>
|
||||
<field name="ai_tool_description"
|
||||
placeholder="Explain precisely what this tool does and when to use it…"
|
||||
invisible="not use_in_ai"/>
|
||||
<separator string="JSON Schema of the arguments"/>
|
||||
<field name="ai_tool_schema"
|
||||
widget="ace" options="{'mode': 'json'}"
|
||||
invisible="not use_in_ai"
|
||||
placeholder='{"type": "object", "properties": {}, "required": []}'/>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_server_action_list_ai" model="ir.ui.view">
|
||||
<field name="name">ir.actions.server.list.ai</field>
|
||||
<field name="model">ir.actions.server</field>
|
||||
<field name="inherit_id" ref="base.view_server_action_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//list" position="inside">
|
||||
<field name="use_in_ai" optional="show"/>
|
||||
<field name="ai_tool_name" optional="show"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_ai_tools" model="ir.actions.act_window">
|
||||
<field name="name">Tools</field>
|
||||
<field name="res_model">ir.actions.server</field>
|
||||
<field name="view_mode">list,form</field>
|
||||
<field name="domain">[('use_in_ai', '=', True)]</field>
|
||||
<field name="context">{'default_use_in_ai': True, 'default_state': 'code'}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">Add a tool</p>
|
||||
<p>Any server action can be exposed to the assistant. Define a name, a
|
||||
description and the JSON schema of its arguments.</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
89
dn_ai/views/res_config_settings_views.xml
Normal file
89
dn_ai/views/res_config_settings_views.xml
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="res_config_settings_view_form_dn_ai" model="ir.ui.view">
|
||||
<field name="name">res.config.settings.view.form.dn_ai</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form" position="inside">
|
||||
<app string="AI" name="dn_ai" logo="fa-magic">
|
||||
<block title="AI provider" name="dn_ai_provider">
|
||||
<setting id="dn_ai_provider_setting"
|
||||
string="Language model"
|
||||
help="DeepSeek, Qwen or any OpenAI-compatible endpoint.">
|
||||
<div class="content-group">
|
||||
<div class="row mt16">
|
||||
<label for="dn_ai_provider" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_provider" class="col-lg-6"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_base_url" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_base_url" class="col-lg-6"
|
||||
placeholder="https://api.deepseek.com"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_api_key" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_api_key" password="True" class="col-lg-6"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_model" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_model" class="col-lg-6"
|
||||
placeholder="deepseek-chat"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_embedding_model" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_embedding_model" class="col-lg-6"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_vision" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_vision" class="col-lg-6"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_attachment_max_chars" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_attachment_max_chars" class="col-lg-6"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt8">
|
||||
<button name="action_dn_ai_test_connection" type="object"
|
||||
string="Test connection" icon="fa-plug"
|
||||
class="btn-link"/>
|
||||
</div>
|
||||
</setting>
|
||||
</block>
|
||||
|
||||
<block title="Generation" name="dn_ai_generation">
|
||||
<setting id="dn_ai_sampling" string="Sampling">
|
||||
<div class="content-group">
|
||||
<div class="row">
|
||||
<label for="dn_ai_temperature" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_temperature" class="col-lg-6"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_max_tokens" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_max_tokens" class="col-lg-6"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_timeout" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_timeout" class="col-lg-6"/>
|
||||
</div>
|
||||
</div>
|
||||
</setting>
|
||||
<setting id="dn_ai_limits" string="Agent loop limits"
|
||||
help="Guardrails against runaway tool loops.">
|
||||
<div class="content-group">
|
||||
<div class="row">
|
||||
<label for="dn_ai_max_rounds" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_max_rounds" class="col-lg-6"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="dn_ai_max_tools_per_call" class="col-lg-3 o_light_label"/>
|
||||
<field name="dn_ai_max_tools_per_call" class="col-lg-6"/>
|
||||
</div>
|
||||
</div>
|
||||
</setting>
|
||||
</block>
|
||||
</app>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
56
dn_ai/views/templates.xml
Normal file
56
dn_ai/views/templates.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Confirmation / question card posted by the agent in the chat.
|
||||
Variables are prefixed (`ai_request`, `ai_session`) because `request`
|
||||
and `session` are reserved names in the QWeb rendering context. -->
|
||||
<template id="ai_user_input_request" name="AI user input request">
|
||||
<div class="o_dn_ai_user_input" data-type="confirmation"
|
||||
t-if="ai_request.get('type') == 'confirmation'">
|
||||
<div class="o_dn_ai_card">
|
||||
<div class="o_dn_ai_card_body">
|
||||
<t t-out="ai_request.get('body') or ''"/>
|
||||
<div class="o_dn_ai_choices">
|
||||
<t t-foreach="ai_request.get('choices') or []" t-as="choice">
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-primary o_dn_ai_choice"
|
||||
t-att-data-session-id="ai_session.id"
|
||||
t-att-data-value="choice['value']"
|
||||
t-out="choice['label']"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_dn_ai_user_input" data-type="question"
|
||||
t-if="ai_request.get('type') == 'question'">
|
||||
<div class="o_dn_ai_card">
|
||||
<div class="o_dn_ai_card_body">
|
||||
<p class="o_dn_ai_question" t-out="ai_request.get('question')"/>
|
||||
<div class="o_dn_ai_choices" t-if="ai_request.get('choices')">
|
||||
<t t-foreach="ai_request.get('choices') or []" t-as="choice">
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-outline-primary o_dn_ai_choice"
|
||||
t-att-data-session-id="ai_session.id"
|
||||
t-att-data-value="choice['value']"
|
||||
t-out="choice['label']"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Plain-text rendering of an AI action prompt. -->
|
||||
<template id="ai_action_prompt_text" name="AI action prompt">
|
||||
<t t-out="action.ai_action_prompt or ''"/>
|
||||
</template>
|
||||
|
||||
<!-- Small record summary injected as context. -->
|
||||
<template id="ai_record_context" name="AI record context">
|
||||
<t t-out="record._description"/>: <t t-out="record.display_name"/>
|
||||
</template>
|
||||
|
||||
<template id="ai_prompt_button_render" name="AI prompt button rendering">
|
||||
<t t-out="button.prompt or ''"/>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user