ai*
This commit is contained in:
BIN
ai_agentic_knowledge/static/img/icon.png
Normal file
BIN
ai_agentic_knowledge/static/img/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
24
ai_agentic_knowledge/static/src/ai_agent_source_row_patch.js
Normal file
24
ai_agentic_knowledge/static/src/ai_agent_source_row_patch.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { SOURCE_ICON_CONFIGS } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_sources/ai_agent_source_icons";
|
||||
import { AiAgentSourceRow } from "@ai_agentic/discuss/core/web/ai_agent_panel/ai_agent_panel_sources/ai_agent_source_row";
|
||||
|
||||
SOURCE_ICON_CONFIGS.knowledge_article = () => ({
|
||||
type: "image",
|
||||
src: "/ai_agentic_knowledge/static/img/icon.png",
|
||||
title: _t("Knowledge Article"),
|
||||
});
|
||||
|
||||
patch(AiAgentSourceRow.prototype, {
|
||||
sourcesCountLabel() {
|
||||
if (this.record.data.type === "knowledge_article") {
|
||||
const count = this.record.data.file_sources_count || 0;
|
||||
const childrenCount = count - 1;
|
||||
if (childrenCount <= 0) {
|
||||
return "";
|
||||
}
|
||||
return `+${childrenCount} ${childrenCount === 1 ? _t("Article") : _t("Articles")}`;
|
||||
}
|
||||
return super.sourcesCountLabel();
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { AgentSourceAddDialog } from "@ai_agentic/components/agent_add_source_dialog/agent_add_source_dialog";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
|
||||
patch(AgentSourceAddDialog.prototype, {
|
||||
get cardsData() {
|
||||
return [
|
||||
...super.cardsData,
|
||||
{
|
||||
image: "/ai_agentic_knowledge/static/img/icon.png",
|
||||
title: _t("Add from Knowledge"),
|
||||
onClick: () => this.onAddKnowledgeSourceClick(),
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
onAddKnowledgeSourceClick() {
|
||||
const onSourcesAdded = this.props.onSourcesAdded;
|
||||
this.props.close();
|
||||
return this.actionService.doAction("ai_knowledge.action_ai_add_knowledge_articles", {
|
||||
additionalContext: {
|
||||
default_agent_id: this.agentId,
|
||||
},
|
||||
onClose: async (closeInfo) => {
|
||||
if (closeInfo?.sourcesAdded) {
|
||||
await onSourcesAdded();
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user