ai*
This commit is contained in:
93
ai_agentic/static/src/command_palette.js
Normal file
93
ai_agentic/static/src/command_palette.js
Normal file
@@ -0,0 +1,93 @@
|
||||
import { Component, t, usePlugin, useProps, useScope } from "@odoo/owl";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { normalize } from "@web/core/l10n/utils";
|
||||
import { ORM } from "@web/core/orm_plugin";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { imageUrl } from "@web/core/utils/urls";
|
||||
|
||||
const commandProviderRegistry = registry.category("command_provider");
|
||||
const commandCategoryRegistry = registry.category("command_categories");
|
||||
|
||||
commandCategoryRegistry.add("AI_AGENTS", { namespace: "@", name: _t("Agents") }, { sequence: 30 });
|
||||
|
||||
export class AICommand extends Component {
|
||||
static template = "ai_agentic.AICommand";
|
||||
|
||||
props = useProps({
|
||||
executeCommand: t.function(),
|
||||
name: t.string(),
|
||||
subtitle: t.string(),
|
||||
imgUrl: t.string(),
|
||||
action: t.object().optional(),
|
||||
searchValue: t.string(),
|
||||
slots: t.object(),
|
||||
});
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
this.ui = useService("ui");
|
||||
}
|
||||
}
|
||||
export class AICommandPalette {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
this.orm = usePlugin(ORM);
|
||||
this.ui = useService("ui");
|
||||
this.actions = useService("action");
|
||||
this.commands = [];
|
||||
this.options = options;
|
||||
this.cleanedTerm = normalize(this.options.searchValue);
|
||||
this.agents = [];
|
||||
}
|
||||
|
||||
async fetch() {
|
||||
this.agents = await this.orm.searchRead(
|
||||
"ai.agent",
|
||||
[],
|
||||
["id", "name", "subtitle", "partner_id"],
|
||||
{ load: false }
|
||||
);
|
||||
}
|
||||
|
||||
async buildResults(filtered) {
|
||||
this.agents
|
||||
.filter(
|
||||
(agent) =>
|
||||
(normalize(agent.name).includes(this.cleanedTerm) ||
|
||||
(agent.subtitle && normalize(agent.subtitle).includes(this.cleanedTerm))) &&
|
||||
(!filtered || !filtered.has(agent))
|
||||
)
|
||||
.slice(0, 5)
|
||||
.forEach((agent) => {
|
||||
this.commands.push({
|
||||
Component: AICommand,
|
||||
action: async () => {
|
||||
const result = await this.orm.call("ai.agent", "open_agent_chat", [
|
||||
agent.id,
|
||||
]);
|
||||
if (result) {
|
||||
this.actions.doAction(result, { clearBreadcrumbs: true });
|
||||
}
|
||||
},
|
||||
name: agent.name,
|
||||
props: {
|
||||
imgUrl: imageUrl("ai.agent", agent.id, "image_128"),
|
||||
subtitle: agent.subtitle ? agent.subtitle : "",
|
||||
},
|
||||
category: "AI_AGENTS",
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
commandProviderRegistry.add("chat_with_agent", {
|
||||
namespace: "@",
|
||||
async provide(options) {
|
||||
const scope = useScope();
|
||||
const palette = scope.run(() => new AICommandPalette(options));
|
||||
await palette.fetch();
|
||||
palette.buildResults();
|
||||
return palette.commands;
|
||||
},
|
||||
});
|
||||
15
ai_agentic/static/src/command_palette.xml
Normal file
15
ai_agentic/static/src/command_palette.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AICommand">
|
||||
<div class="o-mail-DiscussCommand o_command_default d-flex align-items-center ps-3 pe-4" t-att-class="{ 'o-uiSmall': this.ui.isSmall }">
|
||||
<i class="oi oi-fw oi-filled opacity-50 text-muted me-2" data-icon="settings"/>
|
||||
<img class="rounded me-2 object-fit-cover" t-if="this.props.imgUrl" t-att-src="this.props.imgUrl" style="width: 25px; height: 25px"/>
|
||||
<span class="pe-1 text-ellipsis d-flex align-items-center fw-bold">
|
||||
<t t-call-slot="name" />
|
||||
</span>
|
||||
<span t-if="this.props.subtitle" class="text-muted smaller text-truncate mw-50" t-out="'- ' + this.props.subtitle"/>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,241 @@
|
||||
import { Component, proxy, signal, t, useProps } from "@odoo/owl";
|
||||
import { Dialog } from "@web/core/dialog/dialog";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { useAutofocus, useService } from "@web/core/utils/hooks";
|
||||
import { getDataURLFromFile } from "@web/core/utils/urls";
|
||||
import { AiAgentPanelCard } from "@ai_agentic/components/ai_agent_panel_card/ai_agent_panel_card";
|
||||
|
||||
class AgentSourceURLDialog extends Component {
|
||||
static template = "ai.AgentSourceURLDialog";
|
||||
static components = {
|
||||
Dialog,
|
||||
};
|
||||
|
||||
props = useProps({
|
||||
addURLSources: t.function(),
|
||||
close: t.function(),
|
||||
});
|
||||
autofocusRef = signal.ref();
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
useAutofocus({ ref: this.autofocusRef });
|
||||
this.state = proxy({
|
||||
urls: "",
|
||||
});
|
||||
}
|
||||
|
||||
onConfirm() {
|
||||
this.props.addURLSources(this.state.urls);
|
||||
this.props.close();
|
||||
}
|
||||
}
|
||||
|
||||
export class AgentSourceAddDialog extends Component {
|
||||
static template = "ai.AgentSourceAddDialog";
|
||||
static components = { AiAgentPanelCard, Dialog };
|
||||
|
||||
props = useProps({
|
||||
agentId: t.number(),
|
||||
onSourcesAdded: t.function(),
|
||||
close: t.function(),
|
||||
});
|
||||
fileInputRef = signal.ref();
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
this.agentId = this.props.agentId;
|
||||
this.orm = useService("orm");
|
||||
this.notification = useService("notification");
|
||||
this.actionService = useService("action");
|
||||
this.dialog = useService("dialog");
|
||||
this.state = proxy({
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
|
||||
async onSourcesAdded() {
|
||||
await this.props.onSourcesAdded();
|
||||
this.props.close();
|
||||
}
|
||||
|
||||
onAddFileSourceClick() {
|
||||
this.fileInputRef().click();
|
||||
}
|
||||
|
||||
validateFileTypes(files) {
|
||||
const validFiles = [];
|
||||
const invalidFiles = [];
|
||||
for (const file of files) {
|
||||
const fileExtension = "." + file.name.split(".").pop().toLowerCase();
|
||||
if (this.allowedExtensions.includes(fileExtension)) {
|
||||
validFiles.push(file);
|
||||
} else {
|
||||
invalidFiles.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
return { validFiles, invalidFiles };
|
||||
}
|
||||
|
||||
async addAttachmentSources(ev) {
|
||||
const files = ev.target.files;
|
||||
if (!files || !files.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate file types
|
||||
const { validFiles, invalidFiles } = this.validateFileTypes(Array.from(files));
|
||||
if (invalidFiles.length > 0 && validFiles.length > 0) {
|
||||
const invalidFileNames = invalidFiles.map((file) => file.name).join(", ");
|
||||
this.notification.add(
|
||||
_t(
|
||||
"Some files have invalid formats and were skipped: %s. Only PDF, Word, PowerPoint, Excel, Text, CSV, and OpenDocument files are allowed.",
|
||||
invalidFileNames
|
||||
),
|
||||
{
|
||||
type: "warning",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (validFiles.length === 0) {
|
||||
this.notification.add(
|
||||
_t(
|
||||
"No valid files to upload. Only PDF, Word, PowerPoint, Excel, Text, CSV, OpenDocument, and Markdown files are allowed."
|
||||
),
|
||||
{
|
||||
type: "danger",
|
||||
}
|
||||
);
|
||||
|
||||
ev.target.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
this.state.loading = true;
|
||||
try {
|
||||
const files_list = await Promise.all(
|
||||
validFiles.map(async (file) => ({
|
||||
name: file.name,
|
||||
raw: (await getDataURLFromFile(file)).split(",")[1],
|
||||
}))
|
||||
);
|
||||
const files_datas = [];
|
||||
for (const attachment_data of files_list) {
|
||||
files_datas.push({
|
||||
name: attachment_data.name,
|
||||
raw: attachment_data.raw,
|
||||
});
|
||||
}
|
||||
await this.orm.call("ai.agent.source", "create_from_binary_files", [
|
||||
files_datas,
|
||||
this.agentId,
|
||||
]);
|
||||
} finally {
|
||||
this.state.loading = false;
|
||||
ev.target.value = "";
|
||||
}
|
||||
return this.onSourcesAdded();
|
||||
}
|
||||
|
||||
onAddLinkSourceClick() {
|
||||
this.dialog.add(AgentSourceURLDialog, {
|
||||
addURLSources: async (urls_string) => await this.addURLSources(urls_string),
|
||||
});
|
||||
}
|
||||
|
||||
validateAndFilterURLs(urls_list) {
|
||||
const validUrls = [];
|
||||
const invalidUrls = [];
|
||||
for (const url of urls_list) {
|
||||
if (
|
||||
url &&
|
||||
(url.startsWith("https://") ||
|
||||
url.startsWith("http://") ||
|
||||
url.startsWith("ftp://"))
|
||||
) {
|
||||
validUrls.push(url);
|
||||
} else {
|
||||
invalidUrls.push(url);
|
||||
}
|
||||
}
|
||||
return { validUrls, invalidUrls };
|
||||
}
|
||||
|
||||
async addURLSources(urls_string) {
|
||||
if (!urls_string) {
|
||||
return;
|
||||
}
|
||||
const urls_list = [
|
||||
...new Set(
|
||||
urls_string
|
||||
.split("\n")
|
||||
.map((url) => url.trim())
|
||||
.filter((url) => url !== "")
|
||||
),
|
||||
];
|
||||
|
||||
if (urls_list.length > 0) {
|
||||
const { validUrls, invalidUrls } = this.validateAndFilterURLs(urls_list);
|
||||
if (validUrls.length > 0) {
|
||||
this.state.loading = true;
|
||||
try {
|
||||
await this.orm.call("ai.agent.source", "create_from_urls", [
|
||||
validUrls,
|
||||
this.agentId,
|
||||
]);
|
||||
} finally {
|
||||
this.state.loading = false;
|
||||
}
|
||||
if (invalidUrls.length > 0) {
|
||||
this.notification.add(
|
||||
_t(
|
||||
"Some URLs are invalid and were skipped. URLs must start with http://, https://, or ftp://"
|
||||
),
|
||||
{
|
||||
type: "warning",
|
||||
}
|
||||
);
|
||||
}
|
||||
return this.onSourcesAdded();
|
||||
} else {
|
||||
this.notification.add(_t("No valid URLs found to process."), {
|
||||
type: "danger",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get cardsData() {
|
||||
return [
|
||||
{
|
||||
icon: "upload",
|
||||
title: _t("Upload a File"),
|
||||
onClick: () => this.onAddFileSourceClick(),
|
||||
},
|
||||
{
|
||||
icon: "link",
|
||||
title: _t("Add a Link"),
|
||||
onClick: () => this.onAddLinkSourceClick(),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
get allowedExtensions() {
|
||||
return [
|
||||
".pdf",
|
||||
".docx",
|
||||
".doc",
|
||||
".pptx",
|
||||
".ppt",
|
||||
".xlsx",
|
||||
".xls",
|
||||
".odt",
|
||||
".ods",
|
||||
".txt",
|
||||
".csv",
|
||||
".md",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai.AgentSourceURLDialog">
|
||||
<Dialog title.translate="Add Links" size="'md'">
|
||||
<div class="row gy-4 p-3">
|
||||
<textarea
|
||||
t-model.proxy="this.state.urls"
|
||||
class="form-control p-2"
|
||||
rows="4"
|
||||
placeholder="Paste your links, one per line"
|
||||
t-ref="this.autofocusRef"
|
||||
required="required"/>
|
||||
</div>
|
||||
<t t-set-slot="footer">
|
||||
<button class="btn btn-primary" t-on-click="this.onConfirm">Save</button>
|
||||
<button class="btn btn-secondary" t-on-click="this.props.close">Discard</button>
|
||||
</t>
|
||||
</Dialog>
|
||||
</t>
|
||||
|
||||
<t t-name="ai.AgentSourceAddDialog">
|
||||
<Dialog title.translate="Add Sources" size="'lg'">
|
||||
<div class="position-relative" style="min-height: 250px;" >
|
||||
<p class="mb-1">Add sources to your AI Agent to get answers based on specific content.</p>
|
||||
<input
|
||||
type="file"
|
||||
t-ref="this.fileInputRef"
|
||||
multiple="true"
|
||||
class="o_input_file d-none"
|
||||
t-att-accept="this.allowedExtensions"
|
||||
t-on-change.stop="this.addAttachmentSources"
|
||||
/>
|
||||
<div class="pt-2" t-att-class="this.state.loading ? 'opacity-50 pe-none' : ''">
|
||||
<div t-if="this.state.loading" class="d-flex justify-content-center w-100 position-absolute" style="bottom: 15px;">
|
||||
<div class="text-muted">
|
||||
<i class="oi oi-spin me-2" data-icon="progress_activity"></i>
|
||||
Adding sources...
|
||||
</div>
|
||||
</div>
|
||||
<div class="row gy-3 justify-content-center">
|
||||
<t t-foreach="this.cardsData" t-as="card" t-key="card.title">
|
||||
<div class="col col-md-6">
|
||||
<AiAgentPanelCard
|
||||
icon="card.icon"
|
||||
image="card.image"
|
||||
title="card.title"
|
||||
description="card.description"
|
||||
onClick="card.onClick"
|
||||
/>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<t t-set-slot="footer">
|
||||
<button class="btn btn-primary" t-on-click="this.props.close">Close</button>
|
||||
</t>
|
||||
</Dialog>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,76 @@
|
||||
import { Component, t, useProps } from "@odoo/owl";
|
||||
import { Dialog } from "@web/core/dialog/dialog";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { AiAgentPanelCard } from "@ai_agentic/components/ai_agent_panel_card/ai_agent_panel_card";
|
||||
|
||||
const HELP_PROMPT = _t(
|
||||
"Let's create a new Trigger together, I'm not sure what setup is best for my use case."
|
||||
);
|
||||
|
||||
export class AgentTriggerAddDialog extends Component {
|
||||
static template = "ai_agentic.AgentTriggerAddDialog";
|
||||
static components = { AiAgentPanelCard, Dialog };
|
||||
|
||||
props = useProps({
|
||||
agentId: t.number(),
|
||||
close: t.function(),
|
||||
});
|
||||
|
||||
setup() {
|
||||
this.action = useService("action");
|
||||
this.store = useService("mail.store");
|
||||
this.dialog = useService("dialog");
|
||||
}
|
||||
|
||||
get cardsData() {
|
||||
return [
|
||||
{
|
||||
image: "/ai_agentic/static/src/img/ai_trigger_cron.svg",
|
||||
title: _t("On a Schedule"),
|
||||
description: _t("Run automatically at a set frequency, e.g. on Mondays 8AM"),
|
||||
// targets ai.automation.trigger, not a business model: see BaseAutomation.default_get
|
||||
onClick: () => this.openAutomationForm("on_schedule"),
|
||||
},
|
||||
{
|
||||
image: "/ai_agentic/static/src/img/ai_trigger_on_date.svg",
|
||||
title: _t("Based on a Date Field"),
|
||||
description: _t("Run once per record, when a specific date is reached"),
|
||||
onClick: () => this.openAutomationForm("on_time"),
|
||||
},
|
||||
{
|
||||
image: "/ai_agentic/static/src/img/ai_trigger_create.svg",
|
||||
title: _t("After Creation"),
|
||||
description: _t("Run whenever a new record is added"),
|
||||
onClick: () => this.openAutomationForm("on_time_created"),
|
||||
},
|
||||
{
|
||||
image: "/ai_agentic/static/src/img/ai_trigger_update.svg",
|
||||
title: _t("After Update"),
|
||||
description: _t("Run whenever a specific field gets updated"),
|
||||
onClick: () => this.openAutomationForm("on_time_updated"),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
openAutomationForm(trigger) {
|
||||
this.openTriggerForm("base.automation", { ai_preset_trigger: trigger });
|
||||
}
|
||||
|
||||
openTriggerForm(resModel, context) {
|
||||
this.props.close();
|
||||
this.action.doAction({
|
||||
type: "ir.actions.act_window",
|
||||
res_model: resModel,
|
||||
views: [[false, "form"]],
|
||||
context: { default_ai_agent_id: this.props.agentId, ...context },
|
||||
});
|
||||
}
|
||||
|
||||
async onClickHelp() {
|
||||
const thread = this.store.discuss.thread;
|
||||
this.dialog.closeAll();
|
||||
thread.open({ focus: true, fromMessagingMenu: true, bypassCompact: true });
|
||||
await thread.post(HELP_PROMPT.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AgentTriggerAddDialog">
|
||||
<Dialog title.translate="When should your agent be triggered?" size="'lg'">
|
||||
<div class="row gy-3 justify-content-center">
|
||||
<t t-foreach="this.cardsData" t-as="card" t-key="card.title">
|
||||
<div class="col col-md-6">
|
||||
<AiAgentPanelCard
|
||||
image="card.image"
|
||||
title="card.title"
|
||||
description="card.description"
|
||||
onClick="card.onClick"
|
||||
/>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
<button class="btn btn-link ps-0 pt-3" t-on-click="this.onClickHelp">
|
||||
I need help to choose
|
||||
</button>
|
||||
<t t-set-slot="footer">
|
||||
<button class="btn btn-primary" t-on-click="this.props.close">Close</button>
|
||||
</t>
|
||||
</Dialog>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Component, t, useProps } from "@odoo/owl";
|
||||
|
||||
/** One clickable option in a "how do you want to do this?" dialog. */
|
||||
export class AiAgentPanelCard extends Component {
|
||||
static template = "ai_agentic.AiAgentPanelCard";
|
||||
|
||||
props = useProps({
|
||||
icon: t.string().optional(),
|
||||
image: t.string().optional(),
|
||||
title: t.string(),
|
||||
description: t.string().optional(),
|
||||
onClick: t.function(),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
.o_agent_choice_card {
|
||||
min-height: 180px;
|
||||
|
||||
.card-body {
|
||||
background: linear-gradient(to right, $card-bg, rgba($card-bg, .95));
|
||||
border-radius: inherit;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: $o-action;
|
||||
border-radius: inherit;
|
||||
}
|
||||
|
||||
.o_agent_choice_card_icon {
|
||||
&.oi {
|
||||
font-size: 48px;
|
||||
line-height: 48px;
|
||||
}
|
||||
}
|
||||
|
||||
.o_agent_choice_card_image {
|
||||
max-width: 64px;
|
||||
max-height: 64px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.o_agent_choice_card_title {
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelCard">
|
||||
<div class="o_agent_choice_card card shadow-sm cursor-pointer rounded-3 h-100" t-on-click="this.props.onClick">
|
||||
<div class="card-body d-flex flex-column justify-content-center align-items-center text-center p-3">
|
||||
<div class="mb-2">
|
||||
<img t-if="this.props.image" t-att-src="this.props.image" t-att-alt="this.props.title" class="o_agent_choice_card_image"/>
|
||||
<i t-elif="this.props.icon" class="oi o_agent_choice_card_icon" t-att-data-icon="this.props.icon" t-att-title="this.props.title"/>
|
||||
</div>
|
||||
<h5 class="o_agent_choice_card_title card-title mb-0 text-truncate w-100" t-out="this.props.title" t-att-title="this.props.title"/>
|
||||
<p t-if="this.props.description" class="card-text text-muted small mb-0 mt-1" t-out="this.props.description"/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Record } from "@web/model/relational_model/record";
|
||||
import { useAutofocus } from "@web/core/utils/hooks";
|
||||
import { useInputField } from "@web/views/fields/input_field_hook";
|
||||
|
||||
import { Component, signal, t, useProps } from "@odoo/owl";
|
||||
|
||||
export class AiAgentSystemPromptEditor extends Component {
|
||||
static template = "ai_agentic.AiAgentSystemPromptEditor";
|
||||
|
||||
props = useProps({
|
||||
record: t.instanceOf(Record),
|
||||
placeholder: t.string(),
|
||||
});
|
||||
|
||||
isEditing = signal(false);
|
||||
textareaRef = signal.ref();
|
||||
|
||||
setup() {
|
||||
useAutofocus({ ref: this.textareaRef });
|
||||
useInputField({
|
||||
ref: this.textareaRef,
|
||||
fieldName: "system_prompt",
|
||||
getValue: () => this.props.record.data.system_prompt || "",
|
||||
});
|
||||
}
|
||||
|
||||
get isEmpty() {
|
||||
return !(this.props.record.data.system_prompt || "").trim();
|
||||
}
|
||||
|
||||
startEditing() {
|
||||
this.isEditing.set(true);
|
||||
}
|
||||
|
||||
async stopEditing() {
|
||||
await this.props.record.isDirty(); // forces the pending edit to commit first
|
||||
this.isEditing.set(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentSystemPromptEditor">
|
||||
<div class="o_ai_agent_system_prompt_editor d-flex flex-column h-100 pt-2">
|
||||
<textarea
|
||||
t-if="this.isEditing()"
|
||||
t-ref="this.textareaRef"
|
||||
class="flex-grow-1 w-100 h-100 p-0 border-0 bg-transparent overflow-y-auto text-break"
|
||||
t-att-placeholder="this.props.placeholder"
|
||||
t-on-blur="this.stopEditing"
|
||||
/>
|
||||
<div
|
||||
t-else=""
|
||||
class="o_ai_agent_system_prompt_editor_preview flex-grow-1 w-100 overflow-y-auto text-break"
|
||||
t-on-click="this.startEditing"
|
||||
>
|
||||
<span t-if="this.isEmpty" class="text-muted text-prewrap" t-out="this.props.placeholder"/>
|
||||
<t t-else="" t-out="this.props.record.data.system_prompt_rendered"/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { AiAgent } from "@ai/discuss/core/common/ai_agent_model";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(AiAgent.prototype, {
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
/** Whether inspectable automation runs exist, feeding the scoped Automation tab. */
|
||||
this.has_automation_channels = false;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { DiscussChannel } from "@mail/discuss/core/common/discuss_channel_model";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(DiscussChannel.prototype, {
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
this.from_ai_automation = false;
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import { ActionPanel } from "@mail/discuss/core/common/action_panel";
|
||||
|
||||
import { Component, t, useProps } from "@odoo/owl";
|
||||
|
||||
import { AiAgentPanel } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel";
|
||||
|
||||
/** The agent panel as a thread action panel, for the chats opened outside the agent's page. */
|
||||
export class AiAgentActionPanel extends Component {
|
||||
static template = "ai_agentic.AiAgentActionPanel";
|
||||
static components = { ActionPanel, AiAgentPanel };
|
||||
|
||||
props = useProps({
|
||||
agent: t.any(),
|
||||
close: t.function().optional(),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentActionPanel">
|
||||
<ActionPanel close="this.props.close" minWidth="240" initialWidth="420">
|
||||
<AiAgentPanel agent="this.props.agent"/>
|
||||
</ActionPanel>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,186 @@
|
||||
import { Record } from "@web/model/record";
|
||||
import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
|
||||
import { Dropdown } from "@web/core/dropdown/dropdown";
|
||||
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
|
||||
import { extractFieldsFromArchInfo } from "@web/model/relational_model/utils";
|
||||
import { CharField } from "@web/views/fields/char/char_field";
|
||||
import { Field } from "@web/views/fields/field";
|
||||
import { ImageField } from "@web/views/fields/image/image_field";
|
||||
import { FormArchParser } from "@web/views/form/form_arch_parser";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { parseXML } from "@web/core/utils/xml";
|
||||
import { useSetupAction } from "@web/search/action_hook";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { pick } from "@web/core/utils/objects";
|
||||
import { useDebounced } from "@web/core/utils/timing";
|
||||
import { AiAgentSystemPromptEditor } from "@ai_agentic/components/ai_agent_system_prompt_editor/ai_agent_system_prompt_editor";
|
||||
import { AiAgentPanelNativeSkills } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_skills/ai_agent_panel_native_skills";
|
||||
import "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_skills/ai_agent_panel_skills";
|
||||
import "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_sources/ai_agent_panel_sources";
|
||||
import "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_triggers/ai_agent_panel_triggers";
|
||||
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
|
||||
import { Component, onWillStart, proxy, t, useProps } from "@odoo/owl";
|
||||
|
||||
const AI_AGENT_MODEL = "ai.agent";
|
||||
const AI_AGENT_PANEL_VIEW_REF = "ai_agentic.ai_agent_view_form";
|
||||
// Fields shown as the channel name/subtitle (Need to be in sync).
|
||||
const AI_AGENT_DISPLAY_FIELD_NAMES = ["name", "subtitle"];
|
||||
const TABS = [
|
||||
{ id: "instructions", label: _t("Instructions") },
|
||||
{ id: "skills", label: _t("Skills") },
|
||||
{ id: "knowledge", label: _t("Knowledge") },
|
||||
{ id: "triggers", label: _t("Triggers") },
|
||||
];
|
||||
const DEFAULT_TAB_ID = TABS[0].id;
|
||||
const ACTIVE_TAB_IDS_KEY = "ai_agentic.AiAgentPanel.activeTabIds";
|
||||
|
||||
function readActiveTabIds() {
|
||||
try {
|
||||
return JSON.parse(browser.sessionStorage.getItem(ACTIVE_TAB_IDS_KEY)) ?? {};
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function getFieldNodesByName(archInfo) {
|
||||
return Object.fromEntries(
|
||||
Object.values(archInfo.fieldNodes).map((fieldNode) => [fieldNode.name, fieldNode])
|
||||
);
|
||||
}
|
||||
|
||||
export class AiAgentPanel extends Component {
|
||||
static components = {
|
||||
AiAgentSystemPromptEditor,
|
||||
AiAgentPanelNativeSkills,
|
||||
CharField,
|
||||
Dropdown,
|
||||
DropdownItem,
|
||||
Field,
|
||||
ImageField,
|
||||
Record,
|
||||
};
|
||||
static template = "ai_agentic.AiAgentPanel";
|
||||
tabs = TABS;
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
this.props = useProps({
|
||||
agent: t.any(),
|
||||
showAgentActions: t.boolean().optional(),
|
||||
});
|
||||
this.viewService = useService("view");
|
||||
this.actionService = useService("action");
|
||||
this.dialog = useService("dialog");
|
||||
onWillStart(() => this.loadPanelView());
|
||||
this.debouncedSaveAgentChanges = useDebounced(() => this.flushAgentChanges(), 500);
|
||||
this.recordHooks = {
|
||||
onRecordChanged: (record) => {
|
||||
this.record = record;
|
||||
this.debouncedSaveAgentChanges();
|
||||
},
|
||||
};
|
||||
// Saves before leaving the action: a debounced save can't rely on
|
||||
// execBeforeUnmount, its RPC is aborted before onWillDestroy runs.
|
||||
useSetupAction({ beforeLeave: () => this.flushAgentChanges() });
|
||||
this.state = proxy({ activeTabIds: readActiveTabIds() });
|
||||
}
|
||||
|
||||
/** Single choke point for both the debounce and beforeLeave. */
|
||||
async flushAgentChanges() {
|
||||
this.debouncedSaveAgentChanges.cancel();
|
||||
if (this.record) {
|
||||
await this.saveAgentChanges(this.record);
|
||||
}
|
||||
}
|
||||
|
||||
get activeTabId() {
|
||||
const tabId = this.state.activeTabIds[this.agent?.id];
|
||||
return TABS.some((tab) => tab.id === tabId) ? tabId : DEFAULT_TAB_ID;
|
||||
}
|
||||
|
||||
isActiveTab(id) {
|
||||
return this.activeTabId === id;
|
||||
}
|
||||
|
||||
setActiveTab(id) {
|
||||
this.state.activeTabIds[this.agent.id] = id;
|
||||
browser.sessionStorage.setItem(ACTIVE_TAB_IDS_KEY, JSON.stringify(this.state.activeTabIds));
|
||||
}
|
||||
|
||||
async loadPanelView() {
|
||||
const { fields, relatedModels, views } = await this.viewService.loadViews({
|
||||
context: { form_view_ref: AI_AGENT_PANEL_VIEW_REF },
|
||||
resModel: AI_AGENT_MODEL,
|
||||
views: [[false, "form"]],
|
||||
});
|
||||
const parser = new FormArchParser();
|
||||
const arch = views.form.arch;
|
||||
|
||||
this.agentArchInfo = parser.parse(parseXML(arch), relatedModels, AI_AGENT_MODEL);
|
||||
const { activeFields } = extractFieldsFromArchInfo(this.agentArchInfo, fields);
|
||||
if (!Object.keys(activeFields).length) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.agentFields = fields;
|
||||
this.agentActiveFields = activeFields;
|
||||
this.fieldNodes = getFieldNodesByName(this.agentArchInfo);
|
||||
}
|
||||
|
||||
get agent() {
|
||||
return this.props.agent;
|
||||
}
|
||||
|
||||
get resModel() {
|
||||
return AI_AGENT_MODEL;
|
||||
}
|
||||
|
||||
archiveAgent(record) {
|
||||
this.dialog.add(ConfirmationDialog, {
|
||||
body: _t("Are you sure that you want to archive this agent?"),
|
||||
confirmLabel: _t("Archive"),
|
||||
confirm: async () => {
|
||||
await this.flushAgentChanges();
|
||||
await record.archive();
|
||||
await this.actionService.doAction("ai_agentic.ai_agent_action", {
|
||||
clearBreadcrumbs: true,
|
||||
});
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
}
|
||||
|
||||
async unarchiveAgent(record) {
|
||||
await this.flushAgentChanges();
|
||||
await record.unarchive();
|
||||
}
|
||||
|
||||
deleteAgent(record) {
|
||||
this.dialog.add(ConfirmationDialog, {
|
||||
body: _t("Are you sure that you want to delete this agent?"),
|
||||
confirmLabel: _t("Delete"),
|
||||
confirmClass: "btn-danger",
|
||||
confirm: async () => {
|
||||
if ((await record.delete()) !== false) {
|
||||
this.agent?.delete();
|
||||
await this.actionService.doAction("ai_agentic.ai_agent_action", {
|
||||
clearBreadcrumbs: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
}
|
||||
|
||||
async saveAgentChanges(record) {
|
||||
if (
|
||||
(await record.isDirty()) &&
|
||||
(await record.checkValidity({ displayNotification: true })) &&
|
||||
(await record.save({ reload: false }))
|
||||
) {
|
||||
this.agent?.update(pick(record.data, ...AI_AGENT_DISPLAY_FIELD_NAMES));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
.o_ai_agent_panel_container {
|
||||
width: 420px;
|
||||
max-width: 30vw;
|
||||
}
|
||||
|
||||
.o_ai_agent_panel {
|
||||
.o_ai_agent_panel_header {
|
||||
.o_input {
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
|
||||
&:not(:hover):not(:focus) {
|
||||
--o-input-border-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.o_ai_agent_panel_subtitle {
|
||||
font-size: $o-font-size-base-smaller;
|
||||
|
||||
.o_input {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.o_icon_preview {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.o_ai_agent_panel_tab {
|
||||
background: none;
|
||||
border: 0;
|
||||
border-bottom: 2px solid transparent;
|
||||
padding: 0.5rem 0 0.25rem;
|
||||
color: $o-gray-600;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
|
||||
&.o_ai_agent_panel_tab_active {
|
||||
color: $o-enterprise-action-color;
|
||||
border-bottom-color: currentColor;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.o_ai_agent_panel_tabpanels {
|
||||
// avoid a hard cut of the scrolled content at the panel's bottom edge
|
||||
padding-bottom: $spacer * 2;
|
||||
mask-image: linear-gradient(to bottom, black calc(100% - #{$spacer * 1.5}), transparent);
|
||||
}
|
||||
|
||||
.o_ai_agent_panel_tabpanels textarea {
|
||||
resize: none;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.o_ai_agent_system_prompt_editor_preview {
|
||||
cursor: text;
|
||||
|
||||
> :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
> :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
:is(h2, h3, h4):not(:first-child) {
|
||||
margin-top: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.o_ai_agent_panel_list_row {
|
||||
min-height: 2.5rem;
|
||||
&:has(button):hover {
|
||||
background-color: mix($o-view-background-color, $o-action, 95%);
|
||||
}
|
||||
|
||||
&.o_ai_agent_panel_list_row_nested {
|
||||
min-height: 2rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
.o_ai_agent_panel_list_row_menu {
|
||||
min-width: 9rem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelHeader">
|
||||
<div class="o_ai_agent_panel_header d-flex align-items-center gap-2 py-1">
|
||||
<div class="flex-shrink-0">
|
||||
<ImageField name="'image_128'" record="data.record" width="64" height="64" imgClass="'rounded'"/>
|
||||
</div>
|
||||
<div class="d-flex flex-column overflow-hidden flex-grow-1 min-w-0 gap-1">
|
||||
<div class="fw-bold fs-4 lh-sm min-w-0 px-1">
|
||||
<CharField name="'name'" record="data.record" placeholder.translate="Agent Name"/>
|
||||
</div>
|
||||
<div class="text-muted lh-sm min-w-0 o_ai_agent_panel_subtitle px-1">
|
||||
<CharField name="'subtitle'" record="data.record" placeholder.translate="Agent Subtitle"/>
|
||||
</div>
|
||||
</div>
|
||||
<Dropdown t-if="this.props.showAgentActions" position="'bottom-end'">
|
||||
<button class="btn btn-light o-no-caret px-1 align-self-start flex-shrink-0" title.translate="Agent Actions">
|
||||
<i class="oi oi-lg" data-icon="more_vert"/>
|
||||
</button>
|
||||
<t t-set-slot="content">
|
||||
<DropdownItem t-if="data.record.data.active" onSelected="() => this.archiveAgent(data.record)">
|
||||
<i class="oi me-1" role="img" data-icon="archive"/>Archive
|
||||
</DropdownItem>
|
||||
<DropdownItem t-else="" onSelected="() => this.unarchiveAgent(data.record)">
|
||||
<i class="oi me-1" role="img" data-icon="unarchive"/>Unarchive
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
t-if="!data.record.data.is_system_agent"
|
||||
class="'text-danger'"
|
||||
onSelected="() => this.deleteAgent(data.record)"
|
||||
>
|
||||
<i class="oi me-1" role="img" data-icon="delete"/>Delete
|
||||
</DropdownItem>
|
||||
</t>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanel">
|
||||
<Record
|
||||
t-if="this.agent?.id and this.agentFields"
|
||||
t-key="this.agent.id"
|
||||
fields="this.agentFields"
|
||||
activeFields="this.agentActiveFields"
|
||||
resModel="this.resModel"
|
||||
resId="this.agent.id"
|
||||
mode="'edit'"
|
||||
hooks="this.recordHooks"
|
||||
t-slot-scope="data"
|
||||
>
|
||||
<div class="o_ai_agent_panel d-flex flex-column h-100 overflow-x-hidden overflow-y-auto o-scrollbar-thin bg-inherit rounded-4">
|
||||
<div class="ps-3 pe-2">
|
||||
<t t-call="ai_agentic.AiAgentPanelHeader"/>
|
||||
</div>
|
||||
<div class="o_ai_agent_panel_tabs d-flex flex-column flex-grow-1 min-h-0 overflow-hidden">
|
||||
<div class="o_ai_agent_panel_tablist d-flex gap-4 flex-shrink-0 flex-nowrap overflow-x-auto o-scrollbar-thin border-bottom px-3">
|
||||
<t t-foreach="this.tabs" t-as="tab" t-key="tab.id">
|
||||
<button
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
t-att-class="{ 'o_ai_agent_panel_tab_active': this.isActiveTab(tab.id) }"
|
||||
class="o_ai_agent_panel_tab flex-shrink-0 text-nowrap"
|
||||
t-on-click="() => this.setActiveTab(tab.id)"
|
||||
>
|
||||
<t t-out="tab.label"/>
|
||||
</button>
|
||||
</t>
|
||||
</div>
|
||||
<div class="o_ai_agent_panel_tabpanels flex-grow-1 overflow-x-hidden overflow-y-auto o-scrollbar-thin min-h-0 px-3 pt-2">
|
||||
<div t-if="this.isActiveTab('instructions')" role="tabpanel" class="h-100 pb-2">
|
||||
<AiAgentSystemPromptEditor
|
||||
record="data.record"
|
||||
placeholder.translate="Define your agent's operating framework: - Which role should it take? - What can it do? - How should it work?"
|
||||
/>
|
||||
</div>
|
||||
<div t-if="this.isActiveTab('skills')" role="tabpanel" class="d-flex flex-column w-100 pb-2">
|
||||
<AiAgentPanelNativeSkills
|
||||
record="data.record"
|
||||
name="'skill_ids'"
|
||||
domain="[['is_native_skill', '=', true]]"
|
||||
/>
|
||||
<Field t-foreach="['custom_skill_ids', 'allowed_agent_ids']" t-as="fieldName" t-key="fieldName"
|
||||
id="fieldName"
|
||||
name="fieldName"
|
||||
record="data.record"
|
||||
fieldInfo="this.fieldNodes[fieldName]"
|
||||
class="'d-block w-100 min-w-0 mb-3'"
|
||||
/>
|
||||
</div>
|
||||
<div t-if="this.isActiveTab('knowledge')" role="tabpanel" class="d-flex flex-column w-100 pb-2">
|
||||
<Field
|
||||
name="'sources_ids'"
|
||||
record="data.record"
|
||||
fieldInfo="this.fieldNodes.sources_ids"
|
||||
class="'d-block w-100 min-w-0'"
|
||||
/>
|
||||
</div>
|
||||
<div t-if="this.isActiveTab('triggers')" role="tabpanel" class="d-flex flex-column w-100 pb-2">
|
||||
<Field
|
||||
name="'automation_ids'"
|
||||
record="data.record"
|
||||
fieldInfo="this.fieldNodes.automation_ids"
|
||||
class="'d-block w-100 min-w-0'"
|
||||
context="{'active_test': False}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Record>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -0,0 +1,16 @@
|
||||
import { ListRenderer } from "@web/views/list/list_renderer";
|
||||
|
||||
export class AiAgentPanelListRenderer extends ListRenderer {
|
||||
static template = "ai_agentic.AiAgentPanelList";
|
||||
static rowTemplate = "";
|
||||
static empty = { icon: "", text: "" };
|
||||
/** Optional left-hand side of the header row; the add button is shared. */
|
||||
static headerTemplate = "";
|
||||
|
||||
/**
|
||||
* Shared by every list in this panel (skills, sources, ...).
|
||||
* From ListRenderer: we can't really use `super.setup()` because it
|
||||
* expects to be used on a html table which is not the case here.
|
||||
*/
|
||||
setup() {}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelList.AddButton">
|
||||
<button class="btn btn-sm btn-primary flex-shrink-0" t-on-click.stop.prevent="() => this.props.onAdd({})">
|
||||
<i class="oi me-1" data-icon="add"/>Add
|
||||
</button>
|
||||
</t>
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelList">
|
||||
<t t-set="isEmpty" t-value="!this.props.list.records.length"/>
|
||||
<div class="o_ai_agent_panel_list d-flex flex-column gap-2 w-100">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<t t-if="this.constructor.headerTemplate" t-call="{{ this.constructor.headerTemplate }}"/>
|
||||
<div t-if="!isEmpty" class="ms-auto">
|
||||
<t t-call="ai_agentic.AiAgentPanelList.AddButton"/>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="isEmpty" class="text-center text-500 my-3">
|
||||
<i class="oi oi-2x opacity-50 mb-2 d-block" t-att-data-icon="this.constructor.empty.icon"/>
|
||||
<p t-out="this.constructor.empty.text"/>
|
||||
<t t-call="ai_agentic.AiAgentPanelList.AddButton"/>
|
||||
</div>
|
||||
<t t-else="">
|
||||
<t t-foreach="this.props.list.records" t-as="record" t-key="record.id">
|
||||
<t t-call="{{ this.constructor.rowTemplate }}"/>
|
||||
</t>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,38 @@
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { X2ManyField, x2ManyField } from "@web/views/fields/x2many/x2many_field";
|
||||
import { AiAgentPanelListRenderer } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_list";
|
||||
|
||||
export class AiAgentPanelAgentListRenderer extends AiAgentPanelListRenderer {
|
||||
static rowTemplate = "ai_agentic.AiAgentPanelAgentListRenderer.Row";
|
||||
static headerTemplate = "ai_agentic.AiAgentPanelAgentListRenderer.Header";
|
||||
static empty = {
|
||||
icon: "handshake",
|
||||
text: _t("Allow this Agent to ask for help to other Agents"),
|
||||
};
|
||||
|
||||
async onClickAgent(record) {
|
||||
const result = await this.env.services.orm.call("ai.agent", "open_agent_chat", [
|
||||
record.data.id,
|
||||
]);
|
||||
if (result) {
|
||||
this.env.services.action.doAction(result);
|
||||
}
|
||||
}
|
||||
|
||||
async onClickRemoveAgent(record) {
|
||||
await this.activeActions.onDelete?.(record);
|
||||
}
|
||||
}
|
||||
|
||||
export class AiAgentX2ManyField extends X2ManyField {
|
||||
static components = {
|
||||
...X2ManyField.components,
|
||||
ListRenderer: AiAgentPanelAgentListRenderer,
|
||||
};
|
||||
}
|
||||
|
||||
registry.category("fields").add("ai_agent_panel_agent_x2many", {
|
||||
...x2ManyField,
|
||||
component: AiAgentX2ManyField,
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelAgentListRenderer.Header">
|
||||
<h6 class="mb-0">Subagents</h6>
|
||||
</t>
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelAgentListRenderer.Row">
|
||||
<div class="o_ai_agent_panel_list_row d-flex align-items-center gap-2 w-100 p-2 border rounded-4 bg-body">
|
||||
<button
|
||||
class="btn btn-link text-start text-reset text-decoration-none min-w-0 flex-grow-1 p-0 d-flex align-items-center gap-2"
|
||||
type="button"
|
||||
t-on-click="() => this.onClickAgent(record)"
|
||||
>
|
||||
<img t-attf-src="/web/image/ai.agent/{{record.data.id}}/avatar_128" class="o_avatar rounded"/>
|
||||
<span class="fw-bold text-truncate m0" t-out="record.data.name"/>
|
||||
</button>
|
||||
<button class="btn btn-sm o-no-caret px-1" t-on-click="() => this.onClickRemoveAgent(record)">
|
||||
<span class="oi" data-icon="close"/>
|
||||
</button>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Many2ManyCheckboxesField } from "@web/views/fields/many2many_checkboxes/many2many_checkboxes_field";
|
||||
|
||||
export class AiAgentPanelNativeSkills extends Many2ManyCheckboxesField {
|
||||
static template = "ai_agentic.AiAgentPanelNativeSkills";
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelNativeSkills">
|
||||
<div>
|
||||
<h6 class="mt-2 mb-2">Tools</h6>
|
||||
<div aria-atomic="true" class="d-flex flex-column gap-2 w-100 mb-3">
|
||||
<t t-foreach="this.items" t-as="item" t-key="item.id">
|
||||
<div class="o_ai_agent_panel_list_row d-flex align-items-center justify-content-between gap-2 w-100 p-2 border rounded-4 bg-body">
|
||||
<span class="text-900 fw-medium text-truncate" t-out="item.display_name"/>
|
||||
<CheckBox
|
||||
value="this.isSelected(item)"
|
||||
onChange="(checked) => this.onChange(item.id, item.display_name, checked)"
|
||||
className="'o_field_boolean o_boolean_toggle form-switch'"
|
||||
/>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,33 @@
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { X2ManyField, x2ManyField } from "@web/views/fields/x2many/x2many_field";
|
||||
import { AiAgentPanelListRenderer } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_list";
|
||||
|
||||
export class AiAgentPanelSkillListRenderer extends AiAgentPanelListRenderer {
|
||||
static rowTemplate = "ai_agentic.AiAgentPanelSkillListRenderer.Row";
|
||||
static headerTemplate = "ai_agentic.AiAgentPanelSkillListRenderer.Header";
|
||||
static empty = {
|
||||
icon: "wand_stars",
|
||||
text: _t("Add skills to expand what your agent can do."),
|
||||
};
|
||||
|
||||
async onClickEditSkill(record) {
|
||||
await this.props.openRecord(record);
|
||||
}
|
||||
|
||||
async onClickRemoveSkill(record) {
|
||||
await this.activeActions.onDelete?.(record);
|
||||
}
|
||||
}
|
||||
|
||||
export class AiAgentSkillX2ManyField extends X2ManyField {
|
||||
static components = {
|
||||
...X2ManyField.components,
|
||||
ListRenderer: AiAgentPanelSkillListRenderer,
|
||||
};
|
||||
}
|
||||
|
||||
registry.category("fields").add("ai_agent_panel_skill_x2many", {
|
||||
...x2ManyField,
|
||||
component: AiAgentSkillX2ManyField,
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelSkillListRenderer.Header">
|
||||
<h6 class="mb-0">Skills</h6>
|
||||
</t>
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelSkillListRenderer.Row">
|
||||
<div class="o_ai_agent_panel_list_row d-flex align-items-center gap-2 w-100 p-2 border rounded-4 bg-body">
|
||||
<button
|
||||
class="btn btn-link text-start text-reset text-decoration-none min-w-0 flex-grow-1 p-0 d-flex align-items-center gap-2"
|
||||
type="button"
|
||||
t-on-click="() => this.onClickEditSkill(record)"
|
||||
>
|
||||
<i class="oi" data-icon="wand_stars"/>
|
||||
<span class="d-block text-truncate" t-out="record.data.name"/>
|
||||
</button>
|
||||
<Dropdown menuClass="'o_ai_agent_panel_list_row_menu'" position="'bottom-end'">
|
||||
<button class="btn btn-sm o-no-caret px-1" title="Dropdown menu">
|
||||
<span class="oi" data-icon="more_vert"/>
|
||||
</button>
|
||||
<t t-set-slot="content">
|
||||
<DropdownItem onSelected="() => this.onClickEditSkill(record)">
|
||||
<i class="oi oi-fw oi-filled me-2" data-icon="edit"/>Edit
|
||||
</DropdownItem>
|
||||
<DropdownItem class="'text-danger'" onSelected="() => this.onClickRemoveSkill(record)">
|
||||
<i class="oi oi-fw oi-filled me-2" data-icon="delete"/>Remove
|
||||
</DropdownItem>
|
||||
</t>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,71 @@
|
||||
import { AgentSourceAddDialog } from "@ai_agentic/components/agent_add_source_dialog/agent_add_source_dialog";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { BooleanToggleField } from "@web/views/fields/boolean_toggle/boolean_toggle_field";
|
||||
import { X2ManyField, x2ManyField } from "@web/views/fields/x2many/x2many_field";
|
||||
import { AiAgentPanelListRenderer } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_list";
|
||||
import { AiAgentSourceRow } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_sources/ai_agent_source_row";
|
||||
import { AiAgentSourceFolderTreePlugin } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_sources/ai_agent_source_folder_tree_plugin";
|
||||
|
||||
import { onWillStart, providePlugins, usePlugin } from "@odoo/owl";
|
||||
|
||||
export class AiAgentPanelSourceListRenderer extends AiAgentPanelListRenderer {
|
||||
static rowTemplate = "ai_agentic.AiAgentPanelSourceListRenderer.Row";
|
||||
static headerTemplate = "ai_agentic.AiAgentPanelSourceListRenderer.Header";
|
||||
static empty = {
|
||||
icon: "folder_open",
|
||||
text: _t("Add sources to give your agent the information it needs to answer accurately."),
|
||||
};
|
||||
static components = {
|
||||
...AiAgentPanelListRenderer.components,
|
||||
AiAgentSourceRow,
|
||||
BooleanToggleField,
|
||||
};
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
this.sourcesFolderTree = usePlugin(AiAgentSourceFolderTreePlugin);
|
||||
}
|
||||
}
|
||||
|
||||
export class AiAgentSourceX2ManyField extends X2ManyField {
|
||||
static components = {
|
||||
...X2ManyField.components,
|
||||
ListRenderer: AiAgentPanelSourceListRenderer,
|
||||
};
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
this.dialog = useService("dialog");
|
||||
providePlugins([AiAgentSourceFolderTreePlugin], {
|
||||
record: this.props.record,
|
||||
list: this.list,
|
||||
});
|
||||
this.sourcesFolderTree = usePlugin(AiAgentSourceFolderTreePlugin);
|
||||
onWillStart(() => this.sourcesFolderTree.loadTree());
|
||||
}
|
||||
|
||||
get rendererProps() {
|
||||
return {
|
||||
...super.rendererProps,
|
||||
list: { records: this.sourcesFolderTree.rootRecords },
|
||||
};
|
||||
}
|
||||
|
||||
get canCreate() {
|
||||
return super.canCreate && this.sourcesFolderTree.canManageSources();
|
||||
}
|
||||
|
||||
onAdd() {
|
||||
this.dialog.add(AgentSourceAddDialog, {
|
||||
agentId: this.props.record.resId,
|
||||
onSourcesAdded: () => this.sourcesFolderTree.reloadAll(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("fields").add("ai_agent_panel_source_x2many", {
|
||||
...x2ManyField,
|
||||
component: AiAgentSourceX2ManyField,
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelSourceListRenderer.Header">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<BooleanToggleField name="'restrict_to_sources'" record="this.sourcesFolderTree.record"/>
|
||||
<span>Restrict answers to Sources</span>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelSourceListRenderer.Row">
|
||||
<AiAgentSourceRow record="record"/>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,86 @@
|
||||
import { ORM } from "@web/core/orm_plugin";
|
||||
import { user } from "@web/core/user";
|
||||
|
||||
import { Plugin, signal, types as t, useConfig, usePlugin } from "@odoo/owl";
|
||||
|
||||
export class AiAgentSourceFolderTreePlugin extends Plugin {
|
||||
orm = usePlugin(ORM);
|
||||
record = useConfig("record", t.record());
|
||||
list = useConfig("list", t.object());
|
||||
unfoldedIds = signal.Set(new Set(), { type: t.number() });
|
||||
records = signal.Array([]);
|
||||
canManageSources = signal(false);
|
||||
|
||||
setup() {
|
||||
user.hasGroup("base.group_system").then((hasGroup) => this.canManageSources.set(hasGroup));
|
||||
}
|
||||
|
||||
get rootRecords() {
|
||||
return this.records().filter((record) => !record.data.parent_id);
|
||||
}
|
||||
|
||||
get childrenByParentId() {
|
||||
const records = this.records();
|
||||
if (this._childrenByParentId?.records !== records) {
|
||||
const byParentId = new Map();
|
||||
for (const record of records) {
|
||||
const parentId = record.data.parent_id && record.data.parent_id[0];
|
||||
if (parentId) {
|
||||
if (!byParentId.has(parentId)) {
|
||||
byParentId.set(parentId, []);
|
||||
}
|
||||
byParentId.get(parentId).push(record);
|
||||
}
|
||||
}
|
||||
this._childrenByParentId = { records, byParentId };
|
||||
}
|
||||
return this._childrenByParentId.byParentId;
|
||||
}
|
||||
|
||||
childrenOf(parentResId) {
|
||||
return this.childrenByParentId.get(parentResId) || [];
|
||||
}
|
||||
|
||||
async loadTree() {
|
||||
const rows = await this.orm.call("ai.agent.source", "get_agent_sources_tree", [
|
||||
this.record.resId,
|
||||
Object.keys(this.list.activeFields),
|
||||
[...this.unfoldedIds()],
|
||||
]);
|
||||
this.records.set(rows.map((data) => ({ id: data.id, resId: data.id, data })));
|
||||
}
|
||||
|
||||
async toggleFolder(record) {
|
||||
if (this.unfoldedIds().has(record.resId)) {
|
||||
this.unfoldedIds().delete(record.resId);
|
||||
return;
|
||||
}
|
||||
this.unfoldedIds().add(record.resId);
|
||||
if (!this.childrenOf(record.resId).length) {
|
||||
await this.loadTree();
|
||||
}
|
||||
}
|
||||
|
||||
async reloadAll() {
|
||||
// Only the sources tree needs refreshing here: no field on the agent
|
||||
// record itself depends on source state, so reloading the parent
|
||||
// record would be wasted work. Saving first only guards against
|
||||
// clobbering an in-progress edit to another field (e.g. name).
|
||||
if (await this.record.isDirty()) {
|
||||
await this.record.save({ reload: false });
|
||||
}
|
||||
await this.loadTree();
|
||||
}
|
||||
|
||||
patchRecord(resId, data) {
|
||||
this.records.set(
|
||||
this.records().map((record) =>
|
||||
record.resId === resId ? { ...record, data: { ...record.data, ...data } } : record
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
removeRecord(resId) {
|
||||
this.records.set(this.records().filter((record) => record.resId !== resId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
|
||||
export const STATUS_BADGE_CLASS = {
|
||||
indexed: "text-bg-success",
|
||||
incomplete: "text-bg-warning",
|
||||
processing: "text-bg-info",
|
||||
failed: "text-bg-danger",
|
||||
};
|
||||
|
||||
export const SOURCE_ICON_CONFIGS = {
|
||||
url: () => ({
|
||||
type: "icon",
|
||||
icon: "link",
|
||||
title: _t("Link"),
|
||||
}),
|
||||
binary: (record) => {
|
||||
const { mimetype } = record.data;
|
||||
if (mimetype) {
|
||||
return {
|
||||
type: "mimetype",
|
||||
dataMimetype: mimetype,
|
||||
title: mimetype,
|
||||
};
|
||||
}
|
||||
return SOURCE_ICON_CONFIGS.default(record);
|
||||
},
|
||||
default: () => ({
|
||||
type: "icon",
|
||||
icon: "description",
|
||||
title: _t("File"),
|
||||
}),
|
||||
};
|
||||
@@ -0,0 +1,116 @@
|
||||
import { Dropdown } from "@web/core/dropdown/dropdown";
|
||||
import { DropdownItem } from "@web/core/dropdown/dropdown_item";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { SOURCE_ICON_CONFIGS, STATUS_BADGE_CLASS } from "./ai_agent_source_icons";
|
||||
import { AiAgentSourceFolderTreePlugin } from "./ai_agent_source_folder_tree_plugin";
|
||||
|
||||
import { Component, t, useProps, usePlugin } from "@odoo/owl";
|
||||
|
||||
export class AiAgentSourceRow extends Component {
|
||||
static template = "ai_agentic.AiAgentSourceRow";
|
||||
static components = { AiAgentSourceRow, Dropdown, DropdownItem };
|
||||
|
||||
setup() {
|
||||
this.props = useProps({
|
||||
record: t.any(),
|
||||
isNested: t.boolean().optional(),
|
||||
});
|
||||
this.orm = useService("orm");
|
||||
this.action = useService("action");
|
||||
this.sourcesFolderTree = usePlugin(AiAgentSourceFolderTreePlugin);
|
||||
}
|
||||
|
||||
get record() {
|
||||
return this.props.record;
|
||||
}
|
||||
|
||||
get isUnfolded() {
|
||||
return this.sourcesFolderTree.unfoldedIds().has(this.record.resId);
|
||||
}
|
||||
|
||||
childRecords() {
|
||||
return this.sourcesFolderTree.childrenOf(this.record.resId);
|
||||
}
|
||||
|
||||
sourceIconConfig() {
|
||||
const iconConfig = SOURCE_ICON_CONFIGS[this.record.data.type];
|
||||
return (iconConfig || SOURCE_ICON_CONFIGS.default)(this.record);
|
||||
}
|
||||
|
||||
sourcesCountLabel() {
|
||||
return "";
|
||||
}
|
||||
|
||||
statusBadgeClass() {
|
||||
return STATUS_BADGE_CLASS[this.record.data.status] || "text-bg-secondary";
|
||||
}
|
||||
|
||||
statusErrorTooltip() {
|
||||
const { status, error_details } = this.record.data;
|
||||
return ["failed", "incomplete"].includes(status) ? error_details : "";
|
||||
}
|
||||
|
||||
canOpenSource() {
|
||||
const { file_sources_count, is_folder, status, user_has_access } = this.record.data;
|
||||
return (is_folder && file_sources_count > 0) || (status === "indexed" && user_has_access);
|
||||
}
|
||||
|
||||
canRetryOrReprocess() {
|
||||
const { status, type } = this.record.data;
|
||||
return (
|
||||
status === "failed" ||
|
||||
status === "incomplete" ||
|
||||
(status === "indexed" && type !== "binary")
|
||||
);
|
||||
}
|
||||
|
||||
canToggleActive() {
|
||||
const { status } = this.record.data;
|
||||
return status !== "processing" && status !== "failed";
|
||||
}
|
||||
|
||||
retryOrReprocessLabel() {
|
||||
return this.record.data.status === "indexed" ? _t("Reprocess") : _t("Retry");
|
||||
}
|
||||
|
||||
toggleActiveLabel() {
|
||||
return this.record.data.is_active ? _t("Disable") : _t("Enable");
|
||||
}
|
||||
|
||||
async onClickSource() {
|
||||
if (!this.canOpenSource()) {
|
||||
return;
|
||||
}
|
||||
if (this.record.data.is_folder) {
|
||||
await this.sourcesFolderTree.toggleFolder(this.record);
|
||||
return;
|
||||
}
|
||||
const action = await this.orm.call("ai.agent.source", "action_access_source", [
|
||||
[this.record.resId],
|
||||
]);
|
||||
if (action) {
|
||||
await this.action.doAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
async onClickToggleActive() {
|
||||
const is_active = !this.record.data.is_active;
|
||||
await this.orm.write("ai.agent.source", [this.record.resId], { is_active });
|
||||
this.sourcesFolderTree.patchRecord(this.record.resId, { is_active });
|
||||
}
|
||||
|
||||
async onClickRetryOrReprocess() {
|
||||
const method =
|
||||
this.record.data.status === "indexed"
|
||||
? "action_reprocess_index"
|
||||
: "action_retry_failed_source";
|
||||
await this.orm.call("ai.agent.source", method, [[this.record.resId]]);
|
||||
this.sourcesFolderTree.patchRecord(this.record.resId, { status: "processing" });
|
||||
}
|
||||
|
||||
async onClickRemoveSource() {
|
||||
await this.orm.unlink("ai.agent.source", [this.record.resId]);
|
||||
this.sourcesFolderTree.removeRecord(this.record.resId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentSourceRow">
|
||||
<t t-set="record" t-value="this.record"/>
|
||||
<div>
|
||||
<div
|
||||
t-attf-class="o_ai_agent_panel_list_row d-flex align-items-center gap-2 w-100 {{ this.props.isNested ? 'o_ai_agent_panel_list_row_nested py-1 px-2 small' : 'p-2 border rounded-4 bg-body' }}"
|
||||
>
|
||||
<button
|
||||
class="btn btn-link text-start text-reset text-decoration-none min-w-0 flex-grow-1 p-0"
|
||||
type="button"
|
||||
t-att-class="{ 'cursor-pointer': this.canOpenSource(), 'opacity-50': !record.data.is_active }"
|
||||
t-on-click="() => this.onClickSource()"
|
||||
>
|
||||
<span class="d-flex align-items-center gap-2 min-w-0">
|
||||
<i
|
||||
t-if="record.data.is_folder"
|
||||
class="oi opacity-75" t-att-data-icon="this.isUnfolded ? 'arrow_drop_down' : 'arrow_right'"
|
||||
/>
|
||||
<t t-set="icon" t-value="this.sourceIconConfig()"/>
|
||||
<i t-if="icon.type === 'icon'" class="oi ms-1" t-att-data-icon="icon.icon" t-att-title="icon.title"/>
|
||||
<i t-elif="icon.type === 'mimetype'" class="o_image o_icon_preview" t-att-data-mimetype="icon.dataMimetype" t-att-title="icon.title"/>
|
||||
<img t-elif="icon.type === 'image'" class="o_icon_preview" t-att-src="icon.src" t-att-alt="icon.title" t-att-title="icon.title"/>
|
||||
<span class="min-w-0">
|
||||
<span class="text-900 fw-medium d-block text-truncate" t-att-title="record.data.name" t-out="record.data.name"/>
|
||||
<span
|
||||
t-if="this.sourcesCountLabel()"
|
||||
class="d-inline-flex align-items-center px-2 py-0 small rounded-pill border bg-light ms-1"
|
||||
>
|
||||
<span class="fw-bold" t-out="this.sourcesCountLabel()"/>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
<div class="d-flex align-items-center gap-2 flex-shrink-0">
|
||||
<span
|
||||
t-if="record.data.status"
|
||||
t-attf-class="badge rounded-pill {{ this.statusBadgeClass() }}"
|
||||
t-att-data-tooltip="this.statusErrorTooltip()"
|
||||
>
|
||||
<t t-out="record.data.status"/>
|
||||
</span>
|
||||
<Dropdown
|
||||
t-if="this.sourcesFolderTree.canManageSources()"
|
||||
menuClass="'o_ai_agent_panel_list_row_menu'"
|
||||
position="'bottom-end'"
|
||||
>
|
||||
<button class="btn btn-sm o-no-caret px-1" title="Dropdown menu">
|
||||
<span class="oi" data-icon="more_vert"/>
|
||||
</button>
|
||||
<t t-set-slot="content">
|
||||
<DropdownItem
|
||||
t-if="this.canRetryOrReprocess()"
|
||||
onSelected="() => this.onClickRetryOrReprocess()"
|
||||
>
|
||||
<i class="oi oi-fw me-2" data-icon="refresh"/>
|
||||
<t t-out="this.retryOrReprocessLabel()"/>
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
t-if="this.canToggleActive()"
|
||||
onSelected="() => this.onClickToggleActive()"
|
||||
>
|
||||
<i class="oi oi-fw me-2" data-icon="block"/>
|
||||
<t t-out="this.toggleActiveLabel()"/>
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
class="'text-danger'"
|
||||
onSelected="() => this.onClickRemoveSource()"
|
||||
>
|
||||
<i class="oi oi-fw oi-filled me-2" data-icon="delete"/>Remove
|
||||
</DropdownItem>
|
||||
</t>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
t-if="record.data.is_folder and this.isUnfolded"
|
||||
class="ps-4 d-flex flex-column gap-2 mt-2"
|
||||
>
|
||||
<t t-foreach="this.childRecords()" t-as="record" t-key="record.resId">
|
||||
<AiAgentSourceRow record="record" isNested="true"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,67 @@
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { X2ManyField, x2ManyField } from "@web/views/fields/x2many/x2many_field";
|
||||
import { AiAgentPanelListRenderer } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_list";
|
||||
import { AgentTriggerAddDialog } from "@ai_agentic/components/agent_add_trigger_dialog/agent_add_trigger_dialog";
|
||||
|
||||
export class AiAgentPanelTriggerListRenderer extends AiAgentPanelListRenderer {
|
||||
static rowTemplate = "ai_agentic.AiAgentPanelTriggerListRenderer.Row";
|
||||
static empty = {
|
||||
icon: "flash_on",
|
||||
text: _t(
|
||||
"Add triggers to let your agent run automatically on a schedule or when key events happen."
|
||||
),
|
||||
};
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
this.action = useService("action");
|
||||
this.orm = useService("orm");
|
||||
this.notification = useService("notification");
|
||||
}
|
||||
|
||||
isCronTrigger(record) {
|
||||
return record.data.model_name === "ai.automation.trigger";
|
||||
}
|
||||
|
||||
async onClickOpenTrigger(record) {
|
||||
await this.action.doAction({
|
||||
type: "ir.actions.act_window",
|
||||
res_model: "base.automation",
|
||||
res_id: record.data.id,
|
||||
views: [[false, "form"]],
|
||||
});
|
||||
}
|
||||
|
||||
async onToggleActive(record, isActive) {
|
||||
await this.orm.write("base.automation", [record.data.id], { active: isActive });
|
||||
await this.props.list.model.load();
|
||||
}
|
||||
|
||||
async onClickRunTrigger(record) {
|
||||
this.notification.add(_t("Automation triggered!"), { type: "success" });
|
||||
await this.orm.call("base.automation", "action_ai_run_now", [record.data.id]);
|
||||
}
|
||||
}
|
||||
|
||||
export class AiAgentTriggerX2ManyField extends X2ManyField {
|
||||
static components = {
|
||||
...X2ManyField.components,
|
||||
ListRenderer: AiAgentPanelTriggerListRenderer,
|
||||
};
|
||||
|
||||
setup() {
|
||||
super.setup();
|
||||
this.dialog = useService("dialog");
|
||||
}
|
||||
|
||||
onAdd() {
|
||||
this.dialog.add(AgentTriggerAddDialog, { agentId: this.props.record.resId });
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("fields").add("ai_agent_panel_trigger_x2many", {
|
||||
...x2ManyField,
|
||||
component: AiAgentTriggerX2ManyField,
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="ai_agentic.AiAgentPanelTriggerListRenderer.Row">
|
||||
<div class="o_ai_agent_panel_list_row d-flex align-items-center gap-2 w-100 p-2 border rounded-4 bg-body">
|
||||
<button
|
||||
class="btn btn-link text-start text-reset text-decoration-none min-w-0 flex-grow-1 p-0 d-flex align-items-center gap-2"
|
||||
type="button"
|
||||
t-on-click="() => this.onClickOpenTrigger(record)"
|
||||
>
|
||||
<i class="oi oi-fw" t-att-data-icon="this.isCronTrigger(record) ? 'schedule' : 'flash_on'"/>
|
||||
<span class="d-block text-truncate" t-out="record.data.name"/>
|
||||
</button>
|
||||
<button
|
||||
t-if="this.isCronTrigger(record)"
|
||||
class="btn btn-sm btn-secondary flex-shrink-0"
|
||||
type="button"
|
||||
t-on-click.stop="() => this.onClickRunTrigger(record)"
|
||||
>Run</button>
|
||||
<CheckBox
|
||||
value="record.data.active"
|
||||
onChange="(checked) => this.onToggleActive(record, checked)"
|
||||
className="'o_field_boolean o_boolean_toggle form-switch'"
|
||||
/>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
30
ai_agentic/static/src/discuss/discuss_app_model_patch.js
Normal file
30
ai_agentic/static/src/discuss/discuss_app_model_patch.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import { DiscussApp } from "@mail/core/public_web/discuss_app/discuss_app_model";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(DiscussApp.prototype, {
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
this.scopedAiAgentId = undefined;
|
||||
},
|
||||
|
||||
setScopedAiAgent(id) {
|
||||
const agentId = Number(id);
|
||||
if (agentId !== this.scopedAiAgentId) {
|
||||
this.scopedAiAgentId = agentId;
|
||||
this.sidebarState.activeTab = this.store.messagingMenu.scopedAiAgentTab;
|
||||
}
|
||||
},
|
||||
|
||||
clearScopedAiAgent() {
|
||||
this.scopedAiAgentId = undefined;
|
||||
},
|
||||
|
||||
get scopedAgent() {
|
||||
return this.scopedAiAgentId ? this.store["ai.agent"].get(this.scopedAiAgentId) : undefined;
|
||||
},
|
||||
|
||||
isChannelInScopedAiAgent(channel) {
|
||||
return Boolean(this.scopedAiAgentId) && channel?.ai_agent_id?.id === this.scopedAiAgentId;
|
||||
},
|
||||
});
|
||||
13
ai_agentic/static/src/discuss/discuss_app_patch.js
Normal file
13
ai_agentic/static/src/discuss/discuss_app_patch.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Discuss } from "@mail/core/public_web/discuss_app/discuss_app";
|
||||
|
||||
import { AiAgentPanel } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { user } from "@web/core/user";
|
||||
|
||||
Discuss.components = { ...Discuss.components, AiAgentPanel };
|
||||
|
||||
patch(Discuss.prototype, {
|
||||
get showScopedAgentPanel() {
|
||||
return Boolean(this.store.discuss.scopedAgent) && user.isSystem && !this.ui.isSmall;
|
||||
},
|
||||
});
|
||||
15
ai_agentic/static/src/discuss/discuss_app_patch.xml
Normal file
15
ai_agentic/static/src/discuss/discuss_app_patch.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-inherit="mail.Discuss" t-inherit-mode="extension">
|
||||
<xpath expr="//DiscussContent" position="after">
|
||||
<div
|
||||
t-if="this.showScopedAgentPanel"
|
||||
class="o_ai_agent_panel_container d-flex flex-column flex-shrink-0 h-100 rounded-4 border bg-view d-print-none"
|
||||
>
|
||||
<AiAgentPanel agent="this.store.discuss.scopedAgent" showAgentActions="true"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
62
ai_agentic/static/src/discuss/discuss_client_action_patch.js
Normal file
62
ai_agentic/static/src/discuss/discuss_client_action_patch.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import { DiscussClientAction } from "@mail/core/public_web/discuss_app/client_action";
|
||||
|
||||
import { t, useOnChange, useProps } from "@odoo/owl";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { router } from "@web/core/browser/router";
|
||||
|
||||
patch(DiscussClientAction.prototype, {
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
this.updateActionState = useProps.static("updateActionState", t.function());
|
||||
useOnChange(
|
||||
() => [this.action(), router.current.scoped_ai_agent_id],
|
||||
(action) => this.syncScopedAiAgent(action)
|
||||
);
|
||||
// Keep the scoped agent id in the URL so it survives a reload with a different
|
||||
// `active_id`. And keep it on the action as well to be able to get back to the
|
||||
// scoped view from the breadcrumbs.
|
||||
useOnChange(
|
||||
() => [this.store.discuss.scopedAiAgentId],
|
||||
(scopedAiAgentId) => {
|
||||
this.updateActionState({ scoped_ai_agent_id: scopedAiAgentId });
|
||||
if (this.action()) {
|
||||
this.action().context.scoped_ai_agent_id = scopedAiAgentId;
|
||||
}
|
||||
}
|
||||
);
|
||||
// Opening another AI chat re-scopes to its agent. Opening anything else leaves
|
||||
// the scoped view. A chat already in the current scope is left untouched above.
|
||||
useOnChange(
|
||||
() => [this.store.discuss.thread],
|
||||
(thread) => {
|
||||
if (
|
||||
!thread ||
|
||||
!this.store.discuss.scopedAiAgentId ||
|
||||
this.store.discuss.isChannelInScopedAiAgent(thread.channel)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (thread.channel?.ai_agent_id) {
|
||||
this.store.discuss.setScopedAiAgent(thread.channel.ai_agent_id.id);
|
||||
} else {
|
||||
this.store.discuss.clearScopedAiAgent();
|
||||
}
|
||||
},
|
||||
{ initialRun: false }
|
||||
);
|
||||
},
|
||||
|
||||
getScopedAiAgentIdFromAction(action) {
|
||||
const rawId = action?.context?.scoped_ai_agent_id || router.current.scoped_ai_agent_id;
|
||||
return rawId ? Number(rawId) : undefined;
|
||||
},
|
||||
|
||||
syncScopedAiAgent(action) {
|
||||
const scopedAiAgentId = this.getScopedAiAgentIdFromAction(action);
|
||||
if (scopedAiAgentId) {
|
||||
this.store.discuss.setScopedAiAgent(scopedAiAgentId);
|
||||
} else {
|
||||
this.store.discuss.clearScopedAiAgent();
|
||||
}
|
||||
},
|
||||
});
|
||||
94
ai_agentic/static/src/discuss/messaging_menu_model_patch.js
Normal file
94
ai_agentic/static/src/discuss/messaging_menu_model_patch.js
Normal file
@@ -0,0 +1,94 @@
|
||||
import {
|
||||
MENU_TABS,
|
||||
MessagingMenu,
|
||||
} from "@mail/core/public_web/messaging_menu/messaging_menu_model";
|
||||
import { fields } from "@mail/model/export";
|
||||
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { user } from "@web/core/user";
|
||||
|
||||
MENU_TABS.AI_AUTOMATION = "ai-automation";
|
||||
|
||||
patch(MessagingMenu.prototype, {
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
this.aiAutomationTab = fields.One("MessagingMenuTab", {
|
||||
compute() {
|
||||
const agentId = this.store.discuss.scopedAiAgentId;
|
||||
if (!agentId || !user.isInternalUser) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
id: `${MENU_TABS.AI_AUTOMATION}:${agentId}`,
|
||||
icon: "flash_on",
|
||||
iconClass: "d-inline-flex justify-content-center",
|
||||
label: _t("Automation"),
|
||||
sequence: 76,
|
||||
recordType: "discuss.channel",
|
||||
appWide: false,
|
||||
includesChannel: (c) =>
|
||||
this.store.discuss.scopedAiAgentId === agentId &&
|
||||
c.isAiChat &&
|
||||
c.from_ai_automation &&
|
||||
c.ai_agent_id?.id === agentId,
|
||||
filters: [
|
||||
{
|
||||
id: "ai_automation_unread",
|
||||
text: _t("Unread"),
|
||||
includesChannel: (c) => c.isUnread,
|
||||
},
|
||||
],
|
||||
emptyState: { title: _t("No automation runs yet.") },
|
||||
};
|
||||
},
|
||||
eager: true,
|
||||
});
|
||||
this.scopedAiAgentTab = fields.One("MessagingMenuTab", {
|
||||
compute() {
|
||||
const agentId = this.store.discuss.scopedAiAgentId;
|
||||
if (!agentId || !user.isInternalUser) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
id: `ai-chat:${agentId}`,
|
||||
icon: "o_ai_icon",
|
||||
iconClass: "d-inline-flex justify-content-center",
|
||||
label: _t("AI"),
|
||||
sequence: 75,
|
||||
recordType: "discuss.channel",
|
||||
appWide: false,
|
||||
includesChannel: (c) =>
|
||||
this.store.discuss.scopedAiAgentId === agentId &&
|
||||
this.includesAiChatChannel(c) &&
|
||||
c.ai_agent_id?.id === agentId,
|
||||
filters: [
|
||||
{
|
||||
id: "ai_chat_unread",
|
||||
text: _t("Unread"),
|
||||
includesChannel: (c) => c.isUnread,
|
||||
},
|
||||
],
|
||||
emptyState: { title: _t("No AI Chats yet.") },
|
||||
};
|
||||
},
|
||||
eager: true,
|
||||
});
|
||||
},
|
||||
includesAiChatChannel(channel) {
|
||||
// automation runs live in their own tab
|
||||
return super.includesAiChatChannel(channel) && !channel.from_ai_automation;
|
||||
},
|
||||
async launchAiChat() {
|
||||
const scopedAiAgentId = this.store.discuss.scopedAiAgentId;
|
||||
if (!scopedAiAgentId) {
|
||||
return super.launchAiChat();
|
||||
}
|
||||
const result = await this.store.env.services.orm.call("ai.agent", "open_agent_chat", [
|
||||
scopedAiAgentId,
|
||||
]);
|
||||
const channelId = Number(result.context.active_id.split("_").at(-1));
|
||||
const channel = await this.store["discuss.channel"].getOrFetch(channelId);
|
||||
channel?.setAsDiscussThread();
|
||||
},
|
||||
});
|
||||
38
ai_agentic/static/src/discuss/messaging_menu_patch.js
Normal file
38
ai_agentic/static/src/discuss/messaging_menu_patch.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { MessagingMenu } from "@mail/core/public_web/messaging_menu/messaging_menu";
|
||||
|
||||
import { useOnChange } from "@odoo/owl";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(MessagingMenu.prototype, {
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
useOnChange(
|
||||
() => [this.state().scopedAiAgentId, this.state().activeTab, this.visibleTabs.length],
|
||||
(scopedAiAgentId, activeTab) => {
|
||||
if (this.visibleTabs.some((tab) => tab.eq(activeTab))) {
|
||||
return;
|
||||
}
|
||||
const fallback =
|
||||
this.visibleTabs[0] ??
|
||||
(scopedAiAgentId ? this.store.messagingMenu.scopedAiAgentTab : undefined);
|
||||
if (fallback) {
|
||||
this.state().activeTab = fallback;
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
get showAgentFilterDropdown() {
|
||||
return super.showAgentFilterDropdown && !this.state().scopedAiAgentId;
|
||||
},
|
||||
get visibleTabs() {
|
||||
const scopedAiAgentId = this.state().scopedAiAgentId;
|
||||
if (!scopedAiAgentId) {
|
||||
return super.visibleTabs;
|
||||
}
|
||||
const agent = this.store["ai.agent"].get(scopedAiAgentId);
|
||||
return agent?.has_automation_channels
|
||||
? [this.store.messagingMenu.scopedAiAgentTab, this.store.messagingMenu.aiAutomationTab]
|
||||
: [];
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import { MessagingMenuUIState } from "@mail/core/public_web/messaging_menu/messaging_menu_ui_state_model";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(MessagingMenuUIState.prototype, {
|
||||
/**
|
||||
* Agent scoping only applies to the Discuss sidebar, not the systray popover. Feeds
|
||||
* `MessagingMenuUIState.aiChatAgentId` which narrows the AI tab through the same flow
|
||||
* as the dropdown.
|
||||
*/
|
||||
get scopedAiAgentId() {
|
||||
return this.isSidebar ? this.store.discuss.scopedAiAgentId : false;
|
||||
},
|
||||
});
|
||||
23
ai_agentic/static/src/discuss/thread_actions_patch.js
Normal file
23
ai_agentic/static/src/discuss/thread_actions_patch.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { registerThreadAction } from "@mail/core/common/thread_actions";
|
||||
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { user } from "@web/core/user";
|
||||
|
||||
import { aiChatsActions } from "@ai/discuss/thread_actions_patch";
|
||||
import { AiAgentActionPanel } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_action_panel";
|
||||
|
||||
aiChatsActions.push("configure-ai-agent");
|
||||
|
||||
registerThreadAction("configure-ai-agent", {
|
||||
actionPanelComponent: AiAgentActionPanel,
|
||||
actionPanelComponentProps: ({ channel }) => ({ agent: channel.ai_agent_id }),
|
||||
condition: ({ channel, owner, store }) =>
|
||||
channel?.isAiChat &&
|
||||
!!channel.ai_agent_id &&
|
||||
user.isAdmin &&
|
||||
owner.isDiscussContent &&
|
||||
(!store.discuss.scopedAiAgentId || store.env.services.ui.isSmall),
|
||||
icon: "settings",
|
||||
name: _t("Agent configuration"),
|
||||
sequenceGroup: 30,
|
||||
});
|
||||
7
ai_agentic/static/src/img/ai_trigger_create.svg
Normal file
7
ai_agentic/static/src/img/ai_trigger_create.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M33 8L15.5 33.5H26L20.5 55L41.5 28.5H31L33 8Z" fill="#FBDBD0"/>
|
||||
<path d="M39 8L21.5 33.5H32L26.5 55L47.5 28.5H37L39 8Z" fill="white"/>
|
||||
<path d="M32 33.5L21.5 33.5L39 8L32 33.5Z" fill="#C1DBF6"/>
|
||||
<path d="M39 8L21.5 33.5H32L26.5 55L47.5 28.5H37L39 8Z" stroke="#374874" stroke-width="2.4" stroke-linejoin="round"/>
|
||||
<path d="M32 33.5L21.5 33.5" stroke="#374874" stroke-width="2.4" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 515 B |
13
ai_agentic/static/src/img/ai_trigger_cron.svg
Normal file
13
ai_agentic/static/src/img/ai_trigger_cron.svg
Normal file
@@ -0,0 +1,13 @@
|
||||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M16.376 45.5317C17.1026 33.5076 23.9747 21.4504 33.1645 13.7722C38.4136 9.4823 45.6679 6.72472 52.2221 10.3616C51.9341 10.1907 43.9663 5.15163 43.9745 5.2212C42.6941 4.60548 41.2935 4.26875 39.8761 4.17736C31.2311 3.84811 24.2539 10.041 19.251 16.5016C15.3733 21.5634 12.3934 27.347 10.6655 33.4905C8.28743 41.465 8.5365 52.7762 15.5077 56.6752C15.5075 56.6753 24.089 61.0976 24.089 61.0976C19.9257 58.925 15.8798 52.1542 16.376 45.5317Z" fill="#FBDBD0"/>
|
||||
<path d="M36.8403 11.2289C25.5026 17.8293 16.3392 33.833 16.3762 46.9724C16.4131 60.1091 25.6363 65.4088 36.974 58.8084C48.3144 52.2066 57.4776 36.2028 57.4407 23.0662C57.4037 9.9268 48.1806 4.62689 36.8403 11.2289ZM36.809 55.0952C27.2055 60.6649 19.3665 56.1774 19.3352 45.0923C19.3039 34.0038 27.092 20.4531 36.6956 14.8834C46.3021 9.31192 54.1411 13.7993 54.1724 24.888C54.2037 35.9732 46.4155 49.5239 36.809 55.0952Z" fill="white"/>
|
||||
<path d="M36.809 55.0952C27.2055 60.6649 19.3665 56.1774 19.3352 45.0923C19.3039 34.0038 27.092 20.4531 36.6956 14.8834C46.3021 9.31192 54.1411 13.7993 54.1724 24.888C54.2037 35.9732 46.4155 49.5239 36.809 55.0952Z" fill="white"/>
|
||||
<path d="M48.2282 13.2289C50.3568 15.6328 51.9008 19.8191 51.9135 24.0517C51.9476 35.3917 43.4906 49.2021 33.026 54.8997C29.727 56.6958 26.2628 56.199 23.4779 55.7818C27.781 58.7178 31.8169 57.9904 36.809 55.0952C46.4156 49.5239 54.2037 35.9732 54.1724 24.888C54.1565 19.253 52.658 15.3425 48.2282 13.2289Z" fill="#C1DBF6"/>
|
||||
<path d="M40.7406 35.8751L46.1874 38.6438L45.0732 40.4964L39.8762 37.7142L40.7406 35.8751Z" fill="#374874"/>
|
||||
<path d="M35.1716 32.7948L31.8221 23.0592L32.8727 22.3906L36.2633 31.6678L35.1716 32.7948Z" fill="#374874"/>
|
||||
<path d="M34.8618 37.2808C34.972 35.4566 36.0146 33.5669 37.4087 32.4021C38.205 31.7514 39.3785 31.1622 40.3728 31.7139C40.3291 31.688 39.0694 30.9524 39.0706 30.9629C38.8764 30.8695 38.6639 30.8184 38.4489 30.8046C37.1374 30.7546 35.9306 31.8146 35.1716 32.7948C34.5833 33.5626 34.1313 34.4401 33.8691 35.3721C33.5084 36.5818 33.5462 38.2978 34.6037 38.8893C34.6037 38.8893 35.799 39.5839 35.799 39.5839C35.1674 39.2543 34.7865 38.2854 34.8618 37.2808Z" fill="#374874"/>
|
||||
<path d="M39.522 31.9525C40.3559 31.9525 40.8557 32.6377 40.8589 33.7854C40.8642 35.6538 39.4945 38.0257 37.8678 38.9648C37.4252 39.2204 36.9888 39.3555 36.6058 39.3555C35.7496 39.3555 35.2364 38.6846 35.2333 37.5609C35.228 35.6912 36.6342 33.2972 38.3039 32.3331C38.7352 32.0841 39.1564 31.9525 39.522 31.9525ZM39.522 31.4954C39.0861 31.4954 38.5947 31.6375 38.0754 31.9373C36.2942 32.9656 34.7703 35.5155 34.7761 37.5623C34.7802 38.9998 35.538 39.8126 36.6058 39.8126C37.0583 39.8126 37.5663 39.6667 38.0964 39.3607C39.8776 38.3324 41.3219 35.8308 41.3161 33.784C41.312 32.3339 40.5811 31.4954 39.522 31.4954Z" fill="#374874"/>
|
||||
<path d="M38.0805 33.7538C37.1711 34.2788 36.4336 35.5561 36.4366 36.6012C36.4396 37.6461 37.1818 38.0692 38.0913 37.5441C39.0007 37.019 39.7382 35.7418 39.7352 34.6967C39.7322 33.6516 38.99 33.2287 38.0805 33.7538Z" fill="#374874"/>
|
||||
<path d="M39.2165 4.16477C39.4349 4.16477 39.6556 4.16903 39.8762 4.17739C41.2935 4.2688 42.6941 4.60551 43.9745 5.22137C43.9745 5.22091 43.9748 5.22071 43.9755 5.22071C44.0484 5.22071 48.222 7.84772 50.6054 9.34727C54.7836 11.2764 57.421 16.0536 57.4407 23.0662C57.4776 36.2029 48.3144 52.2066 36.974 58.8084C33.6668 60.7338 30.5403 61.6451 27.7689 61.6451C26.3434 61.6451 25.0119 61.4039 23.7981 60.9357C23.895 60.9913 23.9919 61.0471 24.089 61.0977C24.0877 61.0971 23.9331 61.0175 23.6716 60.8826C23.1017 60.6536 22.5592 60.3733 22.0449 60.0443C19.5068 58.7363 15.5076 56.6753 15.5077 56.6753C8.53651 52.7763 8.28744 41.4651 10.6655 33.4906C12.3934 27.3472 15.3733 21.5634 19.251 16.5017C24.1262 10.2059 30.8751 4.1642 39.2165 4.16477ZM39.2152 3.25049C32.0094 3.25049 25.0493 7.52057 18.5281 15.9419C14.5215 21.1719 11.5 27.1508 9.78746 33.2357C8.46776 37.6646 8.06266 42.5881 8.67615 46.7447C9.42938 51.8483 11.6374 55.5582 15.0614 57.4733L15.0654 57.4661C15.1426 57.5157 15.214 57.5525 15.2656 57.5791L15.7534 57.8305L17.4057 58.6821L21.589 60.8379C22.129 61.1803 22.7008 61.4749 23.29 61.7145L23.6583 61.9043L23.6695 61.9101C23.8036 61.9792 23.9468 62.012 24.088 62.012C24.0938 62.012 24.0996 62.012 24.1053 62.0119C25.2531 62.3754 26.4823 62.5593 27.7689 62.5593C30.8074 62.5593 34.0592 61.5631 37.4339 59.5986C43.055 56.3263 48.3229 50.7305 52.2672 43.8423C56.2112 36.9543 58.3732 29.5751 58.3549 23.0637C58.335 15.9992 55.6712 10.711 51.0434 8.54272L50.9002 8.45266C49.6953 7.69451 48.1026 6.6925 46.8023 5.88C45.2748 4.92553 44.6738 4.54999 44.3685 4.40221L44.3708 4.39753C43.0224 3.74887 41.53 3.36795 39.935 3.26505C39.9269 3.2645 39.9189 3.26416 39.9109 3.26381C39.6806 3.25499 39.447 3.25053 39.2165 3.25053L39.2152 3.25049Z" fill="#374874"/>
|
||||
<path d="M44.4976 12.4896C50.21 12.489 54.1502 17.0316 54.1723 24.888C54.2036 35.9732 46.4155 49.5239 36.809 55.0952C34.0095 56.7188 31.3597 57.4879 29.0098 57.4879C23.2984 57.4879 19.3573 52.946 19.3351 45.0923C19.3039 34.0038 27.0919 20.453 36.6955 14.8834C39.4959 13.2593 42.1472 12.4899 44.4976 12.4896ZM44.4988 12.0325V12.4896L44.4985 12.0325C41.9771 12.0327 39.275 12.8589 36.4662 14.4879C26.7364 20.1308 18.8463 33.8604 18.878 45.0936C18.889 48.9926 19.8589 52.2528 21.6827 54.5217C23.4831 56.7612 26.0167 57.945 29.0098 57.945C31.5291 57.945 34.2303 57.1192 37.0383 55.4906C46.7698 49.8469 54.6612 36.118 54.6295 24.8866C54.6185 20.9867 53.6488 17.7259 51.8254 15.4567C50.0252 13.2165 47.4917 12.0325 44.4988 12.0325Z" fill="#374874"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.5 KiB |
14
ai_agentic/static/src/img/ai_trigger_on_date.svg
Normal file
14
ai_agentic/static/src/img/ai_trigger_on_date.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M48.3166 18.2233L48.3922 44.8925L20.4179 61.0435L20.3423 34.3742L48.3166 18.2233Z" fill="white"/>
|
||||
<path d="M44.7387 9.57367C46.7281 8.4251 48.3447 9.34633 48.3512 11.6323L48.3695 18.098L20.3952 34.2489L20.3769 27.7833C20.3704 25.4973 21.9765 22.7154 23.9659 21.5669L44.7387 9.57367ZM28.1798 26.6618C28.979 26.2004 29.6227 25.0829 29.6201 24.1645C29.6175 23.2487 28.9696 22.877 28.1704 23.3384C27.3733 23.7986 26.7274 24.9173 26.73 25.8331C26.7326 26.7515 27.3827 27.122 28.1798 26.6618ZM40.5674 19.5098C41.3667 19.0484 42.0104 17.9309 42.0078 17.0125C42.0052 16.0966 41.3572 15.7249 40.558 16.1864C39.7588 16.6478 39.1151 17.7652 39.1177 18.6811C39.1203 19.5995 39.7682 19.9712 40.5674 19.5098Z" fill="#C1DBF6"/>
|
||||
<path d="M42.5321 6.5509L47.3009 9.32223C46.6463 8.9418 45.7396 8.99565 44.7386 9.57364L23.9657 21.5668L19.1969 18.7955L39.9697 6.8023C40.9708 6.22433 41.8775 6.17048 42.5321 6.5509Z" fill="#C1DBF6"/>
|
||||
<path d="M19.1969 18.7955L23.9657 21.5668C22.8296 22.2227 21.8201 23.4119 21.1629 24.7366L16.421 21.908C17.0787 20.6062 18.0771 19.442 19.1969 18.7955Z" fill="#C1DBF6"/>
|
||||
<path d="M16.4211 21.908L21.163 24.7366C20.6695 25.7315 20.374 26.8027 20.3768 27.7832L20.4179 34.2489L15.649 31.4776L15.6079 25.0119C15.6051 24.0127 15.9104 22.9188 16.4211 21.908Z" fill="#FBDBD0"/>
|
||||
<path d="M15.6491 58.2721L15.608 31.4776L20.3768 34.2489L20.4179 61.0434L15.6491 58.2721Z" fill="#FBDBD0"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.7864 11.1519C20.9143 11.6492 20.3323 12.742 20.3277 14.3852C20.3249 15.3649 20.5328 16.4154 20.9014 17.4552C20.9436 17.5741 20.8813 17.7048 20.7623 17.747C20.6433 17.7891 20.5127 17.7269 20.4705 17.6079C20.0884 16.5301 19.8676 15.427 19.8705 14.3839C19.8755 12.6432 20.4962 11.3614 21.56 10.7548C22.6233 10.1485 24.0486 10.2629 25.5615 11.1364L25.4479 11.3333L25.5615 11.1364C27.0768 12.0112 28.4341 13.5002 29.4109 15.1921C30.3876 16.8839 30.9963 18.8 30.9914 20.5419C30.9879 21.7607 30.6834 22.7506 30.1342 23.4451C29.581 24.1444 28.7935 24.5257 27.8717 24.5433C27.7454 24.5457 27.6412 24.4453 27.6388 24.3191C27.6363 24.1929 27.7367 24.0886 27.8629 24.0862C28.654 24.0711 29.3109 23.749 29.7756 23.1615C30.2442 22.5691 30.531 21.6886 30.5342 20.5406C30.5389 18.8985 29.9622 17.0613 29.015 15.4207C28.0678 13.7801 26.7626 12.3576 25.333 11.5323C23.9031 10.7068 22.6591 10.6543 21.7864 11.1519Z" fill="#374874"/>
|
||||
<path d="M41.5863 6.30812C41.9382 6.30812 42.2574 6.39127 42.5322 6.55093L47.301 9.32224C47.299 9.32119 47.2968 9.3205 47.2948 9.31938C47.9445 9.69355 48.3478 10.4933 48.3511 11.6323L48.3694 21.0828L48.3248 21.1038L48.3922 44.8925L20.4179 61.0435L15.6491 58.2721L15.6079 31.4775L15.649 31.465L15.6079 25.0119C15.6014 22.7259 17.2076 19.9441 19.197 18.7955L39.9698 6.80231C40.5507 6.46693 41.0997 6.30812 41.5863 6.30812ZM39.9191 19.7079C40.1141 19.7079 40.3343 19.6442 40.5673 19.5097C41.3665 19.0483 42.0102 17.9308 42.0077 17.0125C42.0058 16.3637 41.6803 15.988 41.2064 15.988C41.0113 15.988 40.791 16.0517 40.5579 16.1863C39.7587 16.6478 39.115 17.7652 39.1176 18.681C39.1194 19.3317 39.4451 19.7079 39.9191 19.7079ZM27.5325 26.8594C27.7275 26.8594 27.9474 26.7959 28.1797 26.6617C28.9789 26.2003 29.6226 25.0829 29.62 24.1645C29.6182 23.5157 29.2926 23.1401 28.8187 23.1401C28.6236 23.1401 28.4034 23.2038 28.1702 23.3384C27.3732 23.7985 26.7273 24.9172 26.7299 25.8331C26.7318 26.4838 27.0586 26.8594 27.5325 26.8594ZM41.5863 5.39374C40.9192 5.39374 40.2215 5.60121 39.5126 6.01047L18.7398 18.0036C16.4635 19.3179 14.6862 22.3974 14.6936 25.0144C14.7073 27.1676 14.6899 29.3326 14.6936 31.4789L14.7348 58.2734C14.7353 58.5987 14.9085 58.8991 15.1897 59.0625L19.9585 61.8339C20.1005 61.9164 20.2592 61.9577 20.4179 61.9577C20.5757 61.9577 20.7336 61.9169 20.875 61.8352L48.8494 45.6842C49.133 45.5204 49.3074 45.2174 49.3065 44.8899L49.2398 21.3628C49.2687 21.2732 49.2839 21.1782 49.2837 21.0809L49.2654 11.6304C49.26 9.73829 48.3646 8.89721 47.7975 8.55442C47.7854 8.54661 47.773 8.53902 47.7604 8.53166L42.9915 5.76034C42.5729 5.5171 42.1 5.39374 41.5863 5.39374ZM40.0354 18.7567C40.0333 18.7339 40.0319 18.7078 40.0318 18.6784C40.0301 18.0866 40.4988 17.2762 41.015 16.9781C41.0427 16.9622 41.0677 16.9494 41.09 16.9392C41.092 16.9614 41.0933 16.9867 41.0934 17.0151C41.095 17.6083 40.6264 18.4199 40.1102 18.7179C40.0826 18.7338 40.0576 18.7465 40.0354 18.7567ZM27.6478 25.9086C27.6456 25.8859 27.6443 25.8599 27.6442 25.8305C27.6425 25.2386 28.1111 24.4282 28.6273 24.1302C28.655 24.1143 28.6801 24.1014 28.7023 24.0913C28.7043 24.1134 28.7056 24.1387 28.7057 24.1671C28.7074 24.7603 28.2388 25.5719 27.7225 25.8699C27.695 25.8858 27.6699 25.8985 27.6478 25.9086Z" fill="#374874"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.0856 3.50456C34.2135 4.00185 33.6315 5.09464 33.6268 6.73787C33.6241 7.71758 33.832 8.76811 34.2006 9.80782C34.2428 9.9268 34.1805 10.0574 34.0615 10.0996C33.9425 10.1418 33.8119 10.0795 33.7697 9.96056C33.3876 8.88278 33.1668 7.77962 33.1697 6.73657C33.1746 4.99582 33.7954 3.71401 34.8592 3.10744C35.9225 2.50116 37.3478 2.61556 38.8607 3.48903L38.7464 3.68698L38.8607 3.48903C40.376 4.36386 41.7333 5.85289 42.7101 7.54477C43.6868 9.23658 44.2955 11.1527 44.2906 12.8945C44.2871 14.1134 43.9826 15.1033 43.4334 15.7977C42.8802 16.4971 42.0927 16.8783 41.1708 16.8959C41.0446 16.8984 40.9404 16.798 40.938 16.6718C40.9355 16.5456 41.0359 16.4413 41.1621 16.4389C41.9532 16.4238 42.6101 16.1017 43.0748 15.5142C43.5434 14.9218 43.8302 14.0412 43.8334 12.8932C43.8381 11.2512 43.2614 9.41395 42.3142 7.77333C41.367 6.13278 40.0618 4.7103 38.6322 3.88493C37.2023 3.05945 35.9583 3.00698 35.0856 3.50456Z" fill="#374874"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M48.5148 18.1096C48.5776 18.2191 48.5397 18.3588 48.4302 18.4216L20.4904 34.4473C20.4196 34.4879 20.3325 34.4876 20.2619 34.4466L15.493 31.6753C15.3839 31.6119 15.3468 31.472 15.4103 31.3628C15.4737 31.2537 15.6136 31.2166 15.7227 31.28L20.3775 33.9851L48.2028 18.025C48.3123 17.9622 48.452 18.0001 48.5148 18.1096Z" fill="#374874"/>
|
||||
<path d="M35.7631 32.5892L35.7676 34.1954L32.818 39.3883C33.2235 39.2173 33.6153 39.0958 33.9982 39.0319C34.3766 38.9707 34.7095 38.9933 35.0017 39.0971C35.2893 39.2088 35.5225 39.4148 35.6921 39.7204C35.8663 40.0285 35.9542 40.4704 35.9558 41.0354C35.9574 41.6058 35.8678 42.1815 35.687 42.7575C35.5063 43.3336 35.2524 43.8888 34.9302 44.4155C34.6078 44.9474 34.2171 45.4403 33.7577 45.8941C33.2984 46.3532 32.7933 46.7392 32.2469 47.0547C31.3181 47.5909 30.5208 47.8521 29.8548 47.833C29.1935 47.8166 28.632 47.622 28.1749 47.2571L29.4777 45.111C29.8617 45.4133 30.2771 45.5717 30.715 45.5915C31.1574 45.6085 31.6768 45.4448 32.2733 45.1005C32.8015 44.7955 33.2381 44.3757 33.5832 43.8411C33.9328 43.2987 34.1045 42.7489 34.1029 42.1787C34.1012 41.5613 33.8858 41.2139 33.4478 41.1419C33.0098 41.0699 32.4129 41.2468 31.6571 41.6832L30.792 42.1827L30.4832 41.0195L33.3416 35.8581L28.7431 38.5131L28.7378 36.6453L35.7631 32.5892Z" fill="#C1DBF6"/>
|
||||
<path d="M41.4268 29.2301L41.4617 41.5248L39.6086 42.5947L39.5799 32.4816L37.6694 34.1978L37.2683 32.6791L40.1201 29.9845L41.4268 29.2301Z" fill="#C1DBF6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.1 KiB |
15
ai_agentic/static/src/img/ai_trigger_update.svg
Normal file
15
ai_agentic/static/src/img/ai_trigger_update.svg
Normal file
@@ -0,0 +1,15 @@
|
||||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M3.30499 14.5467C3.30499 14.5467 1.7651 15.5784 2.47088 18.0929L2.79537 18.9714L7.77148 15.8521L5.97141 13.0286L3.30499 14.5467Z" fill="#FBDBD0"/>
|
||||
<path d="M48.0851 45.0822C45.8221 44.1028 44.0533 42.2471 43.1837 39.9396L29.8622 4.59326C28.5456 1.09996 25.9439 2.16503 25.9439 2.16503L3.24475 15.0261C3.74071 14.7608 6.13399 13.7032 7.45627 17.1662L20.7281 51.9251C21.4947 53.9328 22.9471 55.6045 24.8282 56.644L34.4979 61.9878L57.235 49.0418L48.0851 45.0822Z" fill="white"/>
|
||||
<path d="M60.1047 24.502C60.1047 24.502 60.7808 24.3089 61.2498 24.6538C61.8146 25.069 61.7189 25.5368 61.7189 25.5368L60.3531 27.3994L58.9458 26.3646L60.1047 24.502Z" fill="white"/>
|
||||
<path d="M42.8863 47.8876L57.9524 25.7852C57.9524 25.7852 58.4337 25.7919 58.9657 25.9458C59.2413 26.0256 59.5306 26.1449 59.7736 26.3232C60.6966 27.0008 60.6842 27.6063 60.6842 27.6063L45.5353 49.5432L42.8863 51.0332L42.431 50.6883L42.8863 47.8876Z" fill="#C1DBF6"/>
|
||||
<path d="M55.3172 32L59.8564 25.7851C59.8564 25.7851 59.815 25.1919 59.07 25.2885C58.3249 25.385 58.187 25.7989 58.187 25.7989L54.1307 31.5246C54.1307 31.5246 53.5926 32.2961 55.3172 32Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M34.5885 51.0485C33.7658 50.9287 32.935 50.8436 32.1408 50.8805L32.1408 50.8805C31.3417 50.9176 30.5984 51.0874 30.1327 51.4008C29.7444 51.6622 29.5945 51.9984 29.611 52.3461C29.6279 52.7043 29.8235 53.103 30.185 53.4648C30.9182 54.1986 32.1624 54.7579 33.4817 55.1848C33.5745 55.2148 33.6257 55.3154 33.5961 55.4094C33.5665 55.5035 33.4673 55.5554 33.3746 55.5254C32.0478 55.0962 30.7339 54.5165 29.9374 53.7193L30.0612 53.5921L29.9374 53.7193C29.5341 53.3157 29.2813 52.8373 29.2588 52.3632C29.2359 51.8787 29.4554 51.4276 29.9377 51.1029C30.4825 50.7362 31.3022 50.5615 32.1247 50.5233C32.9521 50.4849 33.8087 50.5738 34.6386 50.6946L34.6386 50.6946C35.593 50.8335 36.5588 51.0245 37.476 51.2832C37.9003 51.1594 38.3728 51.0883 38.8695 51.083C39.591 51.0752 40.3205 51.1979 41.0266 51.3412C41.0323 51.3043 41.0443 51.2677 41.0632 51.2328C41.1104 51.1458 41.1912 51.0865 41.2859 51.0547C41.446 51.001 41.6266 51.0043 41.7915 51.0313C41.9588 51.0588 42.125 51.1133 42.2649 51.1767C42.4127 51.2438 42.5494 51.3223 42.6696 51.4101C42.7486 51.4678 42.7666 51.5795 42.7097 51.6596C42.6528 51.7397 42.5427 51.7579 42.4636 51.7003C42.365 51.6282 42.2495 51.5615 42.1209 51.5031C42.0053 51.4506 41.8685 51.4062 41.7352 51.3843C41.5995 51.362 41.4821 51.3655 41.3966 51.3942C41.3904 51.3963 41.3855 51.3983 41.3817 51.4002C41.3868 51.406 41.3951 51.4135 41.4081 51.4206C41.446 51.4286 41.4838 51.4366 41.5215 51.4446C41.6115 51.4636 41.6719 51.5495 41.6604 51.642C41.6488 51.7344 41.5693 51.8024 41.4775 51.7981C41.4168 51.7953 41.3589 51.7837 41.3059 51.7642C40.4905 51.5922 39.6732 51.4319 38.8733 51.4405C38.6312 51.4431 38.3963 51.4623 38.1716 51.4962C39.0182 51.7769 39.8067 52.123 40.4853 52.5479C41.275 53.0423 41.8901 53.6653 42.2014 54.3175C42.516 54.9766 42.5223 55.6764 42.0671 56.273C41.8624 56.5414 41.5447 56.7953 41.0621 56.8818C40.5095 56.9807 39.8778 56.8372 39.3552 56.6735L39.4073 56.5027L39.3552 56.6735C38.0855 56.2756 36.9328 55.6588 36.2297 54.8929C35.5246 54.1248 35.2801 53.17 35.7984 52.3772C36.0331 52.0181 36.4208 51.7181 36.8968 51.4984C36.1463 51.3092 35.3664 51.1617 34.5885 51.0485ZM37.4792 51.6556C37.3639 51.6922 37.2532 51.733 37.1477 51.7775C36.6603 51.9833 36.295 52.2644 36.0922 52.5747L35.9453 52.4759L36.0922 52.5747C35.6981 53.1776 35.8453 53.9495 36.4878 54.6493C37.1323 55.3514 38.2199 55.9435 39.4593 56.3319C39.9745 56.4933 40.5367 56.6128 41.0007 56.5297C41.3838 56.4611 41.6283 56.264 41.7883 56.0542L41.9277 56.1636L41.7883 56.0542C42.144 55.588 42.1541 55.0389 41.8841 54.4733C41.6108 53.9009 41.053 53.3235 40.3001 52.8521C39.4973 52.3494 38.5266 51.9579 37.4792 51.6556ZM41.3703 51.4079C41.3703 51.4079 41.3704 51.4077 41.3707 51.4074C41.3704 51.4077 41.3703 51.4079 41.3703 51.4079Z" fill="#374874"/>
|
||||
<path d="M42.4725 50.4606L42.2933 51.2586C42.2758 51.3368 42.3625 51.3965 42.4293 51.3522L43.0864 50.9159C43.0864 50.9159 42.9447 50.6754 42.8726 50.6192C42.7877 50.5531 42.4725 50.4606 42.4725 50.4606Z" fill="#ECECEC"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M30.4401 15.3294C30.5009 15.44 30.4606 15.579 30.3501 15.6399L15.4496 23.8421C15.339 23.903 15.2 23.8627 15.1391 23.7521C15.0782 23.6415 15.1185 23.5025 15.2291 23.4416L30.1296 15.2394C30.2402 15.1786 30.3792 15.2189 30.4401 15.3294Z" fill="#374874"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M32.6941 20.1052C32.755 20.2158 32.7147 20.3548 32.6041 20.4157L17.7036 28.6178C17.593 28.6787 17.454 28.6384 17.3931 28.5278C17.3322 28.4172 17.3725 28.2782 17.4831 28.2174L32.3836 20.0152C32.4942 19.9543 32.6332 19.9946 32.6941 20.1052Z" fill="#374874"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.0534 25.2427C35.1142 25.3532 35.0739 25.4922 34.9633 25.5531L20.0628 33.7553C19.9522 33.8161 19.8132 33.7758 19.7524 33.6653C19.6915 33.5547 19.7318 33.4157 19.8424 33.3548L34.7429 25.1526C34.8535 25.0918 34.9925 25.1321 35.0534 25.2427Z" fill="#374874"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M36.9245 30.9189C36.9854 31.0295 36.9451 31.1685 36.8345 31.2294L21.9341 39.4316C21.8235 39.4924 21.6845 39.4521 21.6236 39.3415C21.5627 39.231 21.603 39.092 21.7136 39.0311L36.6141 30.8289C36.7247 30.768 36.8637 30.8083 36.9245 30.9189Z" fill="#374874"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.7958 36.5952C38.8567 36.7058 38.8164 36.8448 38.7058 36.9057L23.8053 45.1078C23.6947 45.1687 23.5557 45.1284 23.4948 45.0178C23.4339 44.9072 23.4742 44.7682 23.5848 44.7074L38.4853 36.5052C38.5959 36.4443 38.7349 36.4846 38.7958 36.5952Z" fill="#374874"/>
|
||||
<path d="M26.8526 2.01224C27.7305 2.01235 29.0444 2.42346 29.8622 4.59331L43.1837 39.9397C43.7289 41.3864 44.6278 42.6553 45.7802 43.6422L57.9524 25.7852C57.9524 25.7852 58.0436 25.7871 58.1858 25.8005L58.1869 25.799C58.1869 25.799 58.3249 25.3851 59.0699 25.2885C59.1236 25.2815 59.1732 25.2783 59.2193 25.2783C59.3697 25.2783 59.4822 25.3124 59.5704 25.3608L60.1047 24.5021C60.1047 24.5021 60.2934 24.4482 60.5405 24.4482C60.7612 24.4482 61.0285 24.4912 61.2498 24.6539C61.8145 25.0691 61.7189 25.5368 61.7189 25.5368L60.5379 27.1473C60.6869 27.4236 60.6841 27.6063 60.6841 27.6063L48.4938 45.2591L57.2349 49.0419L34.4979 61.9879L24.8281 56.6441C22.9471 55.6045 21.4947 53.9329 20.7281 51.9251L7.45625 17.1663C7.3131 16.7914 7.15689 16.4724 6.99244 16.1967L2.71333 18.8661L2.43422 18.1142C1.82716 15.9619 3.15168 15.0789 3.15168 15.0789L5.4451 13.7795L25.9439 2.16509C25.9439 2.16509 26.3171 2.01224 26.8526 2.01224ZM6.9741 16.1661C6.93273 16.0979 6.89081 16.0325 6.84839 15.9699L6.9741 16.1661ZM26.8526 1.09802C26.1717 1.09798 25.6875 1.28211 25.5974 1.31905C25.5616 1.33368 25.5268 1.35057 25.4932 1.36961L4.99436 12.984L2.70096 14.2834C2.68172 14.2943 2.66288 14.3059 2.64448 14.3182C2.56782 14.3693 0.775613 15.6018 1.55424 18.3624C1.56092 18.386 1.56853 18.4094 1.57708 18.4324L1.85618 19.1843C1.95177 19.4418 2.1581 19.6427 2.41808 19.7314C2.51424 19.7642 2.61397 19.7804 2.71326 19.7804C2.88245 19.7804 3.05036 19.7335 3.19724 19.6419L6.60994 17.5129L19.8739 52.2513C20.7164 54.4577 22.3187 56.302 24.3859 57.4443L34.0556 62.7881C34.1933 62.8642 34.3456 62.9022 34.4979 62.9022C34.654 62.9022 34.8101 62.8622 34.9503 62.7824L57.6873 49.8364C57.9884 49.665 58.1668 49.338 58.1479 48.992C58.1289 48.646 57.9161 48.3405 57.598 48.2029L49.8789 44.8623L61.4365 28.1259C61.5393 27.977 61.5956 27.801 61.5983 27.6201C61.5992 27.5585 61.5947 27.446 61.5626 27.2962L62.4562 26.0775C62.5342 25.9711 62.5883 25.8491 62.6147 25.7199C62.7128 25.2398 62.556 24.4796 61.7914 23.9173C61.4504 23.6665 61.0178 23.534 60.5405 23.534C60.1834 23.534 59.9055 23.6082 59.8534 23.6231C59.6354 23.6854 59.4482 23.8265 59.3284 24.0191L59.1119 24.3671C59.0594 24.37 59.0061 24.3749 58.9524 24.3819C58.3713 24.4572 57.9891 24.6717 57.7412 24.8957C57.5221 24.9477 57.3268 25.0797 57.1969 25.2703L45.6365 42.2297C44.9469 41.4688 44.4022 40.5805 44.0392 39.6174L30.7177 4.27089C29.6774 1.5105 27.8496 1.09811 26.8526 1.09802Z" fill="#374874"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.0 KiB |
@@ -0,0 +1,8 @@
|
||||
import { ListController } from "@web/views/list/list_controller";
|
||||
|
||||
export class AiAgentListController extends ListController {
|
||||
/** Create a blank agent and open its chat. */
|
||||
async createRecord() {
|
||||
await this.actionService.doAction("ai_agentic.ai_agent_action_create");
|
||||
}
|
||||
}
|
||||
10
ai_agentic/static/src/views/list/ai_agent_list_view.js
Normal file
10
ai_agentic/static/src/views/list/ai_agent_list_view.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { registry } from "@web/core/registry";
|
||||
import { listView } from "@web/views/list/list_view";
|
||||
import { AiAgentListController } from "@ai_agentic/views/list/ai_agent_list_controller";
|
||||
|
||||
export const aiAgentListView = {
|
||||
...listView,
|
||||
Controller: AiAgentListController,
|
||||
};
|
||||
|
||||
registry.category("views").add("ai_agent_list", aiAgentListView);
|
||||
15
ai_agentic/static/src/web/systray_action_patch.js
Normal file
15
ai_agentic/static/src/web/systray_action_patch.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import SystrayAction from "@ai/web/systray_action";
|
||||
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(SystrayAction.prototype, {
|
||||
setup() {
|
||||
super.setup();
|
||||
this.store = useService("mail.store");
|
||||
},
|
||||
onClickLaunchAIChat() {
|
||||
this.store.discuss.clearScopedAiAgent();
|
||||
return super.onClickLaunchAIChat();
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user