This commit is contained in:
2026-11-08 20:08:53 +08:00
parent 7526a5fe4d
commit 9b924747c5
2692 changed files with 394867 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View 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();
},
});

View File

@@ -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();
}
},
});
},
});