feat(knowledge): add channel support to knowledge entries and related components
- Introduced a new `channel` field in the Knowledge struct and associated request types to track the source channel (e.g., "web", "api", "browser_extension"). - Updated various frontend components to display channel information and enhance user experience with channel labels. - Enhanced localization files to support channel labels in English and Chinese. - Modified backend services and database migrations to accommodate the new channel feature, ensuring consistent tracking across knowledge entries. - Refactored related functions to integrate channel handling, improving overall knowledge management and context.
This commit is contained in:
@@ -400,6 +400,23 @@ const getDisplayTitle = () => {
|
||||
return props.details.title;
|
||||
};
|
||||
|
||||
const channelLabelMap: Record<string, string> = {
|
||||
web: 'knowledgeBase.channelWeb',
|
||||
api: 'knowledgeBase.channelApi',
|
||||
browser_extension: 'knowledgeBase.channelBrowserExtension',
|
||||
wechat: 'knowledgeBase.channelWechat',
|
||||
wecom: 'knowledgeBase.channelWecom',
|
||||
feishu: 'knowledgeBase.channelFeishu',
|
||||
dingtalk: 'knowledgeBase.channelDingtalk',
|
||||
slack: 'knowledgeBase.channelSlack',
|
||||
im: 'knowledgeBase.channelIm',
|
||||
};
|
||||
|
||||
const getChannelLabel = (channel: string) => {
|
||||
const key = channelLabelMap[channel];
|
||||
return key ? t(key) : t('knowledgeBase.channelUnknown');
|
||||
};
|
||||
|
||||
// 获取类型标签
|
||||
const getTypeLabel = () => {
|
||||
switch (props.details.type) {
|
||||
@@ -714,6 +731,9 @@ const handleDetailsScroll = () => {
|
||||
</div>
|
||||
<div class="meta-row">
|
||||
<span class="time"> {{ getTimeLabel() }}:{{ details.time }} </span>
|
||||
<t-tag v-if="details.channel && details.channel !== 'web'" size="small" variant="light" theme="warning" class="channel-tag">
|
||||
{{ getChannelLabel(details.channel) }}
|
||||
</t-tag>
|
||||
<div class="view-mode-buttons">
|
||||
<t-button
|
||||
v-if="canPreview()"
|
||||
@@ -1057,6 +1077,10 @@ const handleDetailsScroll = () => {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.channel-tag {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.chunk-count {
|
||||
color: var(--td-brand-color);
|
||||
font-size: 12px;
|
||||
|
||||
Reference in New Issue
Block a user