2025-03-28 03:17:09 +08:00
|
|
|
<template>
|
2026-03-16 21:39:49 +08:00
|
|
|
<div class="input-box" :class="customClasses" @click="focusInput">
|
2025-11-12 14:04:34 +08:00
|
|
|
<div class="top-slot">
|
|
|
|
|
<slot name="top"></slot>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
<div class="expand-options" v-if="hasOptionsLeft">
|
2026-01-24 15:24:25 +08:00
|
|
|
<a-popover
|
|
|
|
|
v-model:open="optionsExpanded"
|
|
|
|
|
placement="bottomLeft"
|
|
|
|
|
trigger="click"
|
|
|
|
|
:overlay-inner-style="{ padding: '4px' }"
|
|
|
|
|
>
|
2025-08-09 23:18:19 +08:00
|
|
|
<template #content>
|
2025-11-12 03:41:22 +08:00
|
|
|
<slot name="options-left">
|
|
|
|
|
<div class="no-options">没有配置 options</div>
|
|
|
|
|
</slot>
|
2025-08-09 23:18:19 +08:00
|
|
|
</template>
|
2026-01-15 06:01:34 +08:00
|
|
|
<a-button type="text" class="expand-btn">
|
2025-08-09 23:18:19 +08:00
|
|
|
<template #icon>
|
2026-01-15 06:01:34 +08:00
|
|
|
<PlusOutlined :class="{ rotated: optionsExpanded }" />
|
2025-08-09 23:18:19 +08:00
|
|
|
</template>
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-popover>
|
2025-11-12 03:41:22 +08:00
|
|
|
<slot name="actions-left"></slot>
|
2025-03-28 03:17:09 +08:00
|
|
|
</div>
|
2025-08-09 23:18:19 +08:00
|
|
|
|
|
|
|
|
<textarea
|
|
|
|
|
ref="inputRef"
|
|
|
|
|
class="user-input"
|
|
|
|
|
:value="inputValue"
|
|
|
|
|
@keydown="handleKeyPress"
|
2026-02-04 17:05:26 +08:00
|
|
|
@keyup="handleKeyUp"
|
2025-08-09 23:18:19 +08:00
|
|
|
@input="handleInput"
|
|
|
|
|
@focus="focusInput"
|
|
|
|
|
:placeholder="placeholder"
|
|
|
|
|
:disabled="disabled"
|
|
|
|
|
/>
|
|
|
|
|
|
2026-02-04 17:05:26 +08:00
|
|
|
<!-- @ 提及选择弹窗 -->
|
|
|
|
|
<div
|
|
|
|
|
v-if="mentionPopupVisible"
|
|
|
|
|
ref="mentionDropdownRef"
|
|
|
|
|
class="mention-dropdown-wrapper"
|
|
|
|
|
:style="mentionDropdownStyle"
|
|
|
|
|
>
|
|
|
|
|
<div class="mention-popup">
|
|
|
|
|
<!-- 文件列表 -->
|
|
|
|
|
<div v-if="mentionItems.files.length > 0" class="mention-group">
|
|
|
|
|
<div class="mention-group-title">文件</div>
|
|
|
|
|
<div
|
|
|
|
|
v-for="(item, index) in mentionItems.files"
|
|
|
|
|
:key="'file-' + item.value"
|
|
|
|
|
:class="['mention-item', { active: isItemSelected('file', index) }]"
|
|
|
|
|
@click="insertMention(item)"
|
|
|
|
|
>
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 知识库列表 -->
|
|
|
|
|
<div v-if="mentionItems.knowledgeBases.length > 0" class="mention-group">
|
|
|
|
|
<div class="mention-group-title">知识库</div>
|
|
|
|
|
<div
|
|
|
|
|
v-for="(item, index) in mentionItems.knowledgeBases"
|
|
|
|
|
:key="'kb-' + item.value"
|
|
|
|
|
:class="['mention-item', { active: isItemSelected('knowledge', index) }]"
|
|
|
|
|
@click="insertMention(item)"
|
|
|
|
|
>
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- MCP 列表 -->
|
|
|
|
|
<div v-if="mentionItems.mcps.length > 0" class="mention-group">
|
|
|
|
|
<div class="mention-group-title">MCP</div>
|
|
|
|
|
<div
|
|
|
|
|
v-for="(item, index) in mentionItems.mcps"
|
|
|
|
|
:key="'mcp-' + item.value"
|
|
|
|
|
:class="['mention-item', { active: isItemSelected('mcp', index) }]"
|
|
|
|
|
@click="insertMention(item)"
|
|
|
|
|
>
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-16 19:18:45 +08:00
|
|
|
<!-- Skills 列表 -->
|
|
|
|
|
<div v-if="mentionItems.skills.length > 0" class="mention-group">
|
|
|
|
|
<div class="mention-group-title">Skills</div>
|
|
|
|
|
<div
|
|
|
|
|
v-for="(item, index) in mentionItems.skills"
|
|
|
|
|
:key="'skill-' + item.value"
|
|
|
|
|
:class="['mention-item', { active: isItemSelected('skill', index) }]"
|
|
|
|
|
@click="insertMention(item)"
|
|
|
|
|
>
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-20 17:51:12 +08:00
|
|
|
<!-- Subagents 列表 -->
|
|
|
|
|
<div v-if="mentionItems.subagents.length > 0" class="mention-group">
|
|
|
|
|
<div class="mention-group-title">Subagents</div>
|
|
|
|
|
<div
|
|
|
|
|
v-for="(item, index) in mentionItems.subagents"
|
|
|
|
|
:key="'subagent-' + item.value"
|
|
|
|
|
:class="['mention-item', { active: isItemSelected('subagent', index) }]"
|
|
|
|
|
@click="insertMention(item)"
|
|
|
|
|
>
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-04 17:05:26 +08:00
|
|
|
<!-- 无结果 -->
|
|
|
|
|
<div v-if="!hasAnyItems" class="mention-empty">暂无可引用的项</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
<div class="send-button-container">
|
2025-11-12 03:41:22 +08:00
|
|
|
<slot name="actions-right"></slot>
|
2025-08-09 23:18:19 +08:00
|
|
|
<a-tooltip :title="isLoading ? '停止回答' : ''">
|
|
|
|
|
<a-button
|
|
|
|
|
@click="handleSendOrStop"
|
|
|
|
|
:disabled="sendButtonDisabled"
|
|
|
|
|
type="link"
|
|
|
|
|
class="send-button"
|
|
|
|
|
>
|
2025-03-28 03:17:09 +08:00
|
|
|
<template #icon>
|
2026-01-15 06:01:34 +08:00
|
|
|
<component :is="getIcon" class="send-btn" />
|
2025-03-28 03:17:09 +08:00
|
|
|
</template>
|
2025-08-09 23:18:19 +08:00
|
|
|
</a-button>
|
|
|
|
|
</a-tooltip>
|
2025-03-28 03:17:09 +08:00
|
|
|
</div>
|
2025-11-12 14:04:34 +08:00
|
|
|
|
|
|
|
|
<div class="bottom-slot">
|
|
|
|
|
<slot name="bottom"></slot>
|
|
|
|
|
</div>
|
2025-03-28 03:17:09 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-03-16 21:39:49 +08:00
|
|
|
import { ref, computed, onMounted, nextTick, watch, onBeforeUnmount, useSlots } from 'vue'
|
2026-03-24 21:48:28 +08:00
|
|
|
import { SendOutlined, ArrowUpOutlined, PauseOutlined, PlusOutlined } from '@ant-design/icons-vue'
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2026-02-04 17:05:26 +08:00
|
|
|
// 点击外部关闭下拉框
|
|
|
|
|
const mentionDropdownRef = ref(null)
|
|
|
|
|
const closeMentionPopup = (e) => {
|
|
|
|
|
if (!mentionPopupVisible.value) return
|
|
|
|
|
if (inputRef.value?.contains(e.target)) return
|
|
|
|
|
if (mentionDropdownRef.value?.contains(e.target)) return
|
|
|
|
|
mentionPopupVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
const inputRef = ref(null)
|
|
|
|
|
const optionsExpanded = ref(false)
|
2025-08-09 23:18:19 +08:00
|
|
|
// 用于防抖的定时器
|
2026-01-15 06:01:34 +08:00
|
|
|
const debounceTimer = ref(null)
|
2025-03-28 03:17:09 +08:00
|
|
|
const props = defineProps({
|
|
|
|
|
modelValue: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ''
|
|
|
|
|
},
|
|
|
|
|
placeholder: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '输入问题...'
|
|
|
|
|
},
|
|
|
|
|
isLoading: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
disabled: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
sendButtonDisabled: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
autoSize: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => ({ minRows: 2, maxRows: 6 })
|
|
|
|
|
},
|
|
|
|
|
sendIcon: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'ArrowUpOutlined'
|
|
|
|
|
},
|
|
|
|
|
customClasses: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => ({})
|
2026-01-24 15:24:25 +08:00
|
|
|
},
|
2026-02-04 17:05:26 +08:00
|
|
|
mention: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => null
|
2025-03-28 03:17:09 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
})
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
const emit = defineEmits(['update:modelValue', 'send', 'keydown'])
|
|
|
|
|
const slots = useSlots()
|
2026-01-24 15:24:25 +08:00
|
|
|
|
2026-02-04 17:05:26 +08:00
|
|
|
// @ 提及功能是否启用
|
|
|
|
|
const mentionEnabled = computed(() => {
|
|
|
|
|
if (!props.mention) return false
|
2026-03-20 17:51:12 +08:00
|
|
|
const { files, knowledgeBases, mcps, skills, subagents } = props.mention
|
2026-02-04 17:05:26 +08:00
|
|
|
return (
|
|
|
|
|
(Array.isArray(files) && files.length > 0) ||
|
|
|
|
|
(Array.isArray(knowledgeBases) && knowledgeBases.length > 0) ||
|
2026-03-16 19:18:45 +08:00
|
|
|
(Array.isArray(mcps) && mcps.length > 0) ||
|
2026-03-20 17:51:12 +08:00
|
|
|
(Array.isArray(skills) && skills.length > 0) ||
|
|
|
|
|
(Array.isArray(subagents) && subagents.length > 0)
|
2026-02-04 17:05:26 +08:00
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-16 19:18:45 +08:00
|
|
|
const mentionTypePrefixMap = {
|
|
|
|
|
file: 'file',
|
|
|
|
|
knowledge: 'knowledge',
|
|
|
|
|
mcp: 'mcp',
|
2026-03-20 17:51:12 +08:00
|
|
|
skill: 'skill',
|
|
|
|
|
subagent: 'subagent'
|
2026-03-16 19:18:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const formatMentionToken = (type, value) => {
|
|
|
|
|
const prefix = mentionTypePrefixMap[type] || type
|
|
|
|
|
return `@${prefix}:${value}`
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-04 17:05:26 +08:00
|
|
|
// 检测是否在 @ 触发位置
|
|
|
|
|
const checkMentionTrigger = (textarea) => {
|
|
|
|
|
if (!textarea || !mentionEnabled.value) return false
|
|
|
|
|
|
|
|
|
|
const cursorPos = textarea.selectionStart
|
|
|
|
|
const textBeforeCursor = inputValue.value.slice(0, cursorPos)
|
|
|
|
|
|
|
|
|
|
// 检查是否以 @ 结尾(刚输入 @)或 @ 后有内容
|
|
|
|
|
const atMatch = textBeforeCursor.match(/@(\S*)$/)
|
|
|
|
|
if (atMatch) {
|
|
|
|
|
mentionQuery.value = atMatch[1]
|
|
|
|
|
mentionPopupVisible.value = true
|
|
|
|
|
mentionSelectedIndex.value = 0
|
|
|
|
|
updateMentionItems(mentionQuery.value)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mentionPopupVisible.value = false
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 更新提及候选项
|
|
|
|
|
const updateMentionItems = (query = '') => {
|
|
|
|
|
if (!props.mention) {
|
2026-03-20 17:51:12 +08:00
|
|
|
mentionItems.value = { files: [], knowledgeBases: [], mcps: [], skills: [], subagents: [] }
|
2026-02-04 17:05:26 +08:00
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const lowerQuery = query.toLowerCase()
|
2026-03-20 17:51:12 +08:00
|
|
|
const { files = [], knowledgeBases = [], mcps = [], skills = [], subagents = [] } = props.mention
|
2026-02-04 17:05:26 +08:00
|
|
|
|
2026-03-16 19:18:45 +08:00
|
|
|
const filterItems = (list) =>
|
2026-02-04 17:05:26 +08:00
|
|
|
list.filter((item) => {
|
2026-03-16 19:18:45 +08:00
|
|
|
const searchTexts = [
|
|
|
|
|
item.label,
|
|
|
|
|
item.value,
|
|
|
|
|
item.description,
|
|
|
|
|
item.tokenLabel,
|
|
|
|
|
item.type,
|
|
|
|
|
mentionTypePrefixMap[item.type]
|
|
|
|
|
]
|
2026-03-16 21:39:49 +08:00
|
|
|
return searchTexts.some((text) =>
|
|
|
|
|
String(text || '')
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.includes(lowerQuery)
|
|
|
|
|
)
|
2026-02-04 17:05:26 +08:00
|
|
|
})
|
|
|
|
|
|
2026-03-16 19:18:45 +08:00
|
|
|
const fileItems = files.map((f) => {
|
|
|
|
|
const path = f.path || ''
|
|
|
|
|
const fileName = path.split('/').pop() || path
|
|
|
|
|
return {
|
|
|
|
|
value: path,
|
|
|
|
|
label: fileName,
|
2026-02-04 17:05:26 +08:00
|
|
|
type: 'file',
|
2026-03-16 19:18:45 +08:00
|
|
|
insertValue: path || fileName,
|
|
|
|
|
tokenLabel: formatMentionToken('file', fileName),
|
|
|
|
|
description: path
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const knowledgeItems = knowledgeBases.map((kb) => {
|
|
|
|
|
const kbName = kb.name || ''
|
|
|
|
|
return {
|
|
|
|
|
value: kbName,
|
|
|
|
|
label: kbName,
|
2026-02-04 17:05:26 +08:00
|
|
|
type: 'knowledge',
|
2026-03-16 19:18:45 +08:00
|
|
|
insertValue: kbName,
|
|
|
|
|
tokenLabel: formatMentionToken('knowledge', kbName),
|
2026-02-04 17:05:26 +08:00
|
|
|
description: kb.db_id
|
2026-03-16 19:18:45 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const mcpItems = mcps.map((m) => {
|
|
|
|
|
const mcpName = m.name || ''
|
|
|
|
|
return {
|
|
|
|
|
value: mcpName,
|
|
|
|
|
label: mcpName,
|
2026-02-04 17:05:26 +08:00
|
|
|
type: 'mcp',
|
2026-03-16 19:18:45 +08:00
|
|
|
insertValue: mcpName,
|
|
|
|
|
tokenLabel: formatMentionToken('mcp', mcpName),
|
2026-02-04 17:05:26 +08:00
|
|
|
description: m.description || ''
|
2026-03-16 19:18:45 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const skillItems = skills.map((skill) => {
|
|
|
|
|
const skillValue = skill.slug || skill.name || skill.id || ''
|
|
|
|
|
return {
|
|
|
|
|
value: skillValue,
|
|
|
|
|
label: skillValue,
|
|
|
|
|
type: 'skill',
|
|
|
|
|
insertValue: skillValue,
|
|
|
|
|
tokenLabel: formatMentionToken('skill', skillValue),
|
|
|
|
|
description: skill.description || ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-20 17:51:12 +08:00
|
|
|
const subagentItems = subagents.map((subagent) => {
|
|
|
|
|
const subagentValue = subagent.id || subagent.value || subagent.name || ''
|
|
|
|
|
const subagentLabel = subagent.name || subagent.label || subagentValue
|
|
|
|
|
return {
|
|
|
|
|
value: subagentValue,
|
|
|
|
|
label: subagentLabel,
|
|
|
|
|
type: 'subagent',
|
|
|
|
|
insertValue: subagentValue,
|
|
|
|
|
tokenLabel: formatMentionToken('subagent', subagentValue),
|
|
|
|
|
description: subagent.description || ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-16 19:18:45 +08:00
|
|
|
mentionItems.value = {
|
|
|
|
|
files: filterItems(fileItems),
|
|
|
|
|
knowledgeBases: filterItems(knowledgeItems),
|
|
|
|
|
mcps: filterItems(mcpItems),
|
2026-03-20 17:51:12 +08:00
|
|
|
skills: filterItems(skillItems),
|
|
|
|
|
subagents: filterItems(subagentItems)
|
2026-02-04 17:05:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 检查项是否被选中
|
|
|
|
|
const isItemSelected = (type, index) => {
|
|
|
|
|
if (mentionSelectedIndex.value < 0) return false
|
|
|
|
|
|
|
|
|
|
const filesLen = mentionItems.value.files.length
|
|
|
|
|
const kbLen = mentionItems.value.knowledgeBases.length
|
2026-03-16 19:18:45 +08:00
|
|
|
const mcpLen = mentionItems.value.mcps.length
|
2026-03-20 17:51:12 +08:00
|
|
|
const skillsLen = mentionItems.value.skills.length
|
2026-02-04 17:05:26 +08:00
|
|
|
|
|
|
|
|
if (type === 'file') {
|
|
|
|
|
return mentionSelectedIndex.value === index
|
|
|
|
|
} else if (type === 'knowledge') {
|
|
|
|
|
return mentionSelectedIndex.value === filesLen + index
|
2026-03-16 19:18:45 +08:00
|
|
|
} else if (type === 'mcp') {
|
2026-02-04 17:05:26 +08:00
|
|
|
return mentionSelectedIndex.value === filesLen + kbLen + index
|
2026-03-20 17:51:12 +08:00
|
|
|
} else if (type === 'skill') {
|
2026-03-16 19:18:45 +08:00
|
|
|
return mentionSelectedIndex.value === filesLen + kbLen + mcpLen + index
|
2026-03-20 17:51:12 +08:00
|
|
|
} else {
|
|
|
|
|
return mentionSelectedIndex.value === filesLen + kbLen + mcpLen + skillsLen + index
|
2026-02-04 17:05:26 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 是否有任何候选项
|
|
|
|
|
const hasAnyItems = computed(() => {
|
|
|
|
|
const items = mentionItems.value
|
2026-03-16 19:18:45 +08:00
|
|
|
return (
|
|
|
|
|
items.files.length > 0 ||
|
|
|
|
|
items.knowledgeBases.length > 0 ||
|
|
|
|
|
items.mcps.length > 0 ||
|
2026-03-20 17:51:12 +08:00
|
|
|
items.skills.length > 0 ||
|
|
|
|
|
items.subagents.length > 0
|
2026-03-16 19:18:45 +08:00
|
|
|
)
|
2026-02-04 17:05:26 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 获取弹出框位置
|
|
|
|
|
const mentionDropdownStyle = computed(() => {
|
|
|
|
|
if (!inputRef.value) return {}
|
|
|
|
|
|
|
|
|
|
const textarea = inputRef.value
|
|
|
|
|
const rect = textarea.getBoundingClientRect()
|
|
|
|
|
const parentRect = textarea.parentElement.getBoundingClientRect()
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
bottom: `${parentRect.bottom - rect.top + 4}px`,
|
|
|
|
|
left: `${rect.left - parentRect.left}px`,
|
|
|
|
|
zIndex: 1000
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const insertMention = (item) => {
|
|
|
|
|
if (!inputRef.value) return
|
|
|
|
|
|
|
|
|
|
const textarea = inputRef.value
|
|
|
|
|
const cursorPos = textarea.selectionStart
|
|
|
|
|
const textBeforeCursor = inputValue.value.slice(0, cursorPos)
|
2026-03-16 19:18:45 +08:00
|
|
|
const mentionValue = item.insertValue || item.value
|
|
|
|
|
const mentionText = formatMentionToken(item.type, mentionValue)
|
2026-02-04 17:05:26 +08:00
|
|
|
|
|
|
|
|
// 移除 @ 及后面的查询内容,插入完整的提及项
|
2026-03-16 19:18:45 +08:00
|
|
|
const newTextBefore = textBeforeCursor.replace(/@(\S*)$/, `${mentionText} `)
|
2026-02-04 17:05:26 +08:00
|
|
|
const textAfterCursor = inputValue.value.slice(cursorPos)
|
|
|
|
|
|
|
|
|
|
const newValue = newTextBefore + textAfterCursor
|
|
|
|
|
emit('update:modelValue', newValue)
|
|
|
|
|
|
|
|
|
|
// 重置光标位置到插入内容之后
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
const newCursorPos = newTextBefore.length
|
|
|
|
|
textarea.setSelectionRange(newCursorPos, newCursorPos)
|
|
|
|
|
textarea.focus()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
mentionPopupVisible.value = false
|
|
|
|
|
mentionQuery.value = ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 滚动到选中项
|
|
|
|
|
const scrollToItem = (index) => {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
const popup = mentionDropdownRef.value?.querySelector('.mention-popup')
|
|
|
|
|
if (!popup) return
|
|
|
|
|
|
|
|
|
|
// 查找所有 mention-item 元素
|
|
|
|
|
const items = popup.querySelectorAll('.mention-item')
|
|
|
|
|
const selectedItem = items[index]
|
|
|
|
|
|
|
|
|
|
if (selectedItem) {
|
|
|
|
|
// 检查元素是否在可视区域内
|
|
|
|
|
const popupRect = popup.getBoundingClientRect()
|
|
|
|
|
const itemRect = selectedItem.getBoundingClientRect()
|
|
|
|
|
|
|
|
|
|
if (itemRect.bottom > popupRect.bottom) {
|
|
|
|
|
selectedItem.scrollIntoView({ block: 'nearest', behavior: 'smooth' })
|
|
|
|
|
} else if (itemRect.top < popupRect.top) {
|
|
|
|
|
selectedItem.scrollIntoView({ block: 'nearest', behavior: 'smooth' })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理键盘导航
|
|
|
|
|
const handleMentionNavigation = (e) => {
|
|
|
|
|
if (!mentionPopupVisible.value) return
|
|
|
|
|
|
|
|
|
|
const allItems = [
|
|
|
|
|
...mentionItems.value.files,
|
|
|
|
|
...mentionItems.value.knowledgeBases,
|
2026-03-16 19:18:45 +08:00
|
|
|
...mentionItems.value.mcps,
|
2026-03-20 17:51:12 +08:00
|
|
|
...mentionItems.value.skills,
|
|
|
|
|
...mentionItems.value.subagents
|
2026-02-04 17:05:26 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const total = allItems.length
|
|
|
|
|
if (total === 0) return
|
|
|
|
|
|
|
|
|
|
if (e.key === 'ArrowDown') {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
mentionSelectedIndex.value = (mentionSelectedIndex.value + 1) % total
|
|
|
|
|
scrollToItem(mentionSelectedIndex.value)
|
|
|
|
|
} else if (e.key === 'ArrowUp') {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
mentionSelectedIndex.value = (mentionSelectedIndex.value - 1 + total) % total
|
|
|
|
|
scrollToItem(mentionSelectedIndex.value)
|
|
|
|
|
} else if (e.key === 'Enter' || e.key === 'Tab') {
|
|
|
|
|
if (mentionSelectedIndex.value >= 0 && mentionSelectedIndex.value < total) {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
insertMention(allItems[mentionSelectedIndex.value])
|
|
|
|
|
}
|
|
|
|
|
} else if (e.key === 'Escape') {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
mentionPopupVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-15 13:29:33 +08:00
|
|
|
const hasOptionsLeft = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
const slot = slots['options-left']
|
2025-10-15 13:29:33 +08:00
|
|
|
if (!slot) {
|
2026-01-15 06:01:34 +08:00
|
|
|
return false
|
2025-10-15 13:29:33 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
const renderedNodes = slot()
|
|
|
|
|
return Boolean(renderedNodes && renderedNodes.length)
|
|
|
|
|
})
|
2025-03-28 03:17:09 +08:00
|
|
|
|
|
|
|
|
// 图标映射
|
|
|
|
|
const iconComponents = {
|
2026-01-15 06:01:34 +08:00
|
|
|
SendOutlined: SendOutlined,
|
|
|
|
|
ArrowUpOutlined: ArrowUpOutlined,
|
|
|
|
|
PauseOutlined: PauseOutlined
|
|
|
|
|
}
|
2025-03-28 03:17:09 +08:00
|
|
|
|
|
|
|
|
// 根据传入的图标名动态获取组件
|
|
|
|
|
const getIcon = computed(() => {
|
|
|
|
|
if (props.isLoading) {
|
2026-01-15 06:01:34 +08:00
|
|
|
return PauseOutlined
|
2025-03-28 03:17:09 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
return iconComponents[props.sendIcon] || ArrowUpOutlined
|
|
|
|
|
})
|
2025-03-28 03:17:09 +08:00
|
|
|
|
|
|
|
|
// 创建本地引用以进行双向绑定
|
|
|
|
|
const inputValue = computed({
|
|
|
|
|
get: () => props.modelValue,
|
|
|
|
|
set: (val) => emit('update:modelValue', val)
|
2026-01-15 06:01:34 +08:00
|
|
|
})
|
2025-11-12 14:04:34 +08:00
|
|
|
|
2025-03-28 03:17:09 +08:00
|
|
|
// 处理键盘事件
|
|
|
|
|
const handleKeyPress = (e) => {
|
2026-02-04 17:05:26 +08:00
|
|
|
// @ 提及键盘导航
|
|
|
|
|
if (mentionPopupVisible.value) {
|
|
|
|
|
if (['ArrowDown', 'ArrowUp', 'Enter', 'Tab', 'Escape'].includes(e.key)) {
|
|
|
|
|
handleMentionNavigation(e)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
emit('keydown', e)
|
|
|
|
|
}
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2026-02-04 17:05:26 +08:00
|
|
|
// 检测 @ 触发
|
|
|
|
|
const handleKeyUp = (e) => {
|
|
|
|
|
if (e.key === '@' && mentionEnabled.value) {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
checkMentionTrigger(e.target)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
// 处理输入事件
|
|
|
|
|
const handleInput = (e) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
const value = e.target.value
|
|
|
|
|
emit('update:modelValue', value)
|
2026-02-04 17:05:26 +08:00
|
|
|
|
|
|
|
|
// 检测 @ 触发(每次输入后检查)
|
|
|
|
|
if (mentionEnabled.value && !mentionPopupVisible.value) {
|
|
|
|
|
const cursorPos = e.target.selectionStart
|
|
|
|
|
const textBeforeCursor = value.slice(0, cursorPos)
|
|
|
|
|
if (textBeforeCursor.endsWith('@')) {
|
|
|
|
|
checkMentionTrigger(e.target)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果弹出框打开,更新查询结果
|
|
|
|
|
if (mentionPopupVisible.value) {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
checkMentionTrigger(e.target)
|
|
|
|
|
})
|
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
}
|
2025-08-09 23:18:19 +08:00
|
|
|
|
2025-03-28 03:17:09 +08:00
|
|
|
// 处理发送按钮点击
|
2025-03-30 20:46:26 +08:00
|
|
|
const handleSendOrStop = () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
emit('send')
|
|
|
|
|
}
|
2025-05-18 17:39:11 +08:00
|
|
|
|
2026-02-04 17:05:26 +08:00
|
|
|
// @ 提及功能状态
|
|
|
|
|
const mentionPopupVisible = ref(false)
|
|
|
|
|
const mentionQuery = ref('')
|
2026-03-20 17:51:12 +08:00
|
|
|
const mentionItems = ref({ files: [], knowledgeBases: [], mcps: [], skills: [], subagents: [] })
|
2026-02-04 17:05:26 +08:00
|
|
|
const mentionSelectedIndex = ref(0)
|
|
|
|
|
|
2026-03-16 21:39:49 +08:00
|
|
|
const adjustTextareaHeight = () => {
|
|
|
|
|
if (!inputRef.value) {
|
2026-01-15 06:01:34 +08:00
|
|
|
return
|
2025-08-09 23:18:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-03-16 21:39:49 +08:00
|
|
|
const textarea = inputRef.value
|
|
|
|
|
textarea.style.height = 'auto'
|
|
|
|
|
textarea.style.height = `${textarea.scrollHeight}px`
|
2026-01-15 06:01:34 +08:00
|
|
|
}
|
2025-08-09 23:18:19 +08:00
|
|
|
|
2025-05-20 20:49:50 +08:00
|
|
|
// 聚焦输入框
|
|
|
|
|
const focusInput = () => {
|
|
|
|
|
if (inputRef.value && !props.disabled) {
|
2026-01-15 06:01:34 +08:00
|
|
|
inputRef.value.focus()
|
2025-05-20 20:49:50 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
}
|
2025-05-18 17:39:11 +08:00
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
// 监听输入值变化
|
|
|
|
|
watch(inputValue, () => {
|
2026-03-16 21:39:49 +08:00
|
|
|
if (debounceTimer.value) {
|
|
|
|
|
clearTimeout(debounceTimer.value)
|
2025-08-09 23:18:19 +08:00
|
|
|
}
|
2026-03-16 21:39:49 +08:00
|
|
|
debounceTimer.value = setTimeout(() => {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
adjustTextareaHeight()
|
|
|
|
|
})
|
|
|
|
|
}, 100)
|
|
|
|
|
})
|
2025-08-09 23:18:19 +08:00
|
|
|
|
2025-05-18 17:39:11 +08:00
|
|
|
onMounted(() => {
|
2026-02-04 17:05:26 +08:00
|
|
|
document.addEventListener('click', closeMentionPopup)
|
2025-08-09 23:18:19 +08:00
|
|
|
nextTick(() => {
|
2025-05-18 17:39:11 +08:00
|
|
|
if (inputRef.value) {
|
2026-03-16 21:39:49 +08:00
|
|
|
adjustTextareaHeight()
|
2026-01-15 06:01:34 +08:00
|
|
|
inputRef.value.focus()
|
2025-05-18 17:39:11 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
})
|
|
|
|
|
})
|
2025-08-09 23:18:19 +08:00
|
|
|
|
2026-02-04 17:05:26 +08:00
|
|
|
// 组件卸载时清除定时器和事件监听器
|
2025-08-09 23:18:19 +08:00
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
if (debounceTimer.value) {
|
2026-01-15 06:01:34 +08:00
|
|
|
clearTimeout(debounceTimer.value)
|
2025-08-09 23:18:19 +08:00
|
|
|
}
|
2026-02-04 17:05:26 +08:00
|
|
|
document.removeEventListener('click', closeMentionPopup)
|
2026-01-15 06:01:34 +08:00
|
|
|
})
|
2025-05-18 17:39:11 +08:00
|
|
|
|
2025-11-12 14:04:34 +08:00
|
|
|
// 公开方法供父组件调用
|
|
|
|
|
defineExpose({
|
|
|
|
|
focus: () => inputRef.value?.focus(),
|
|
|
|
|
closeOptions: () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
optionsExpanded.value = false
|
2025-11-12 14:04:34 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
})
|
2025-03-28 03:17:09 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.input-box {
|
2025-08-09 23:18:19 +08:00
|
|
|
display: grid;
|
2025-03-28 03:17:09 +08:00
|
|
|
width: 100%;
|
|
|
|
|
margin: 0 auto;
|
2025-11-23 01:39:44 +08:00
|
|
|
border: 1px solid var(--gray-150);
|
2025-03-28 03:17:09 +08:00
|
|
|
border-radius: 0.8rem;
|
2025-11-23 01:39:44 +08:00
|
|
|
box-shadow: 0 2px 8px var(--shadow-1);
|
2025-03-28 03:17:09 +08:00
|
|
|
transition: all 0.3s ease;
|
2026-03-29 10:55:00 +08:00
|
|
|
background: var(--gray-0);
|
2025-11-12 14:04:34 +08:00
|
|
|
gap: 0px;
|
2026-02-04 17:05:26 +08:00
|
|
|
position: relative;
|
2025-08-09 23:18:19 +08:00
|
|
|
|
2025-11-12 14:04:34 +08:00
|
|
|
/* Default: Multi-line layout with top/bottom slots */
|
2025-08-09 23:18:19 +08:00
|
|
|
padding: 0.8rem 0.75rem 0.6rem 0.75rem;
|
|
|
|
|
grid-template-columns: auto 1fr;
|
2025-11-12 14:04:34 +08:00
|
|
|
grid-template-rows: auto auto auto;
|
2025-08-09 23:18:19 +08:00
|
|
|
grid-template-areas:
|
2026-01-15 06:01:34 +08:00
|
|
|
'top top'
|
|
|
|
|
'input input'
|
|
|
|
|
'options send';
|
2025-08-09 23:18:19 +08:00
|
|
|
|
2025-11-12 14:04:34 +08:00
|
|
|
.top-slot {
|
|
|
|
|
display: flex;
|
|
|
|
|
grid-area: top;
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
.expand-options {
|
2025-11-12 14:04:34 +08:00
|
|
|
grid-area: options;
|
2025-08-09 23:18:19 +08:00
|
|
|
justify-self: start;
|
2025-11-12 03:41:22 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
2025-08-09 23:18:19 +08:00
|
|
|
}
|
2025-11-12 14:04:34 +08:00
|
|
|
|
|
|
|
|
.user-input {
|
|
|
|
|
grid-area: input;
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
.send-button-container {
|
2025-11-12 14:04:34 +08:00
|
|
|
grid-area: send;
|
2025-08-09 23:18:19 +08:00
|
|
|
justify-self: end;
|
|
|
|
|
}
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2025-11-12 14:04:34 +08:00
|
|
|
.bottom-slot {
|
|
|
|
|
grid-column: 1 / -1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-25 13:57:47 +08:00
|
|
|
// &:focus-within {
|
|
|
|
|
// border-color: var(--main-500);
|
2025-11-23 01:39:44 +08:00
|
|
|
// background: var(--gray-0);
|
2025-08-25 13:57:47 +08:00
|
|
|
// box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
|
|
|
|
// }
|
2025-08-09 23:18:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.expand-options {
|
|
|
|
|
grid-area: options;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-input {
|
|
|
|
|
grid-area: input;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 0;
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
border: none;
|
|
|
|
|
margin: 0;
|
2026-01-24 15:24:25 +08:00
|
|
|
margin-bottom: 0.5rem;
|
2025-11-23 01:39:44 +08:00
|
|
|
color: var(--gray-1000);
|
2025-08-09 23:18:19 +08:00
|
|
|
font-size: 15px;
|
|
|
|
|
outline: none;
|
|
|
|
|
resize: none;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
font-family: inherit;
|
|
|
|
|
min-height: 44px; /* Default min-height for multi-line */
|
|
|
|
|
max-height: 200px;
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
&:focus {
|
2025-03-28 03:17:09 +08:00
|
|
|
outline: none;
|
2025-08-09 23:18:19 +08:00
|
|
|
box-shadow: none;
|
|
|
|
|
}
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
&::placeholder {
|
2025-11-23 01:39:44 +08:00
|
|
|
color: var(--gray-400);
|
2025-08-09 23:18:19 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
.send-button-container {
|
|
|
|
|
grid-area: send;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
.expand-btn {
|
2025-11-12 03:41:22 +08:00
|
|
|
width: 28px;
|
|
|
|
|
height: 28px;
|
|
|
|
|
border-radius: 8px;
|
2025-08-09 23:18:19 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
color: var(--gray-600);
|
|
|
|
|
transition: all 0.2s ease;
|
2025-11-12 03:41:22 +08:00
|
|
|
border: 1px solid transparent;
|
|
|
|
|
background-color: transparent;
|
2025-08-09 23:18:19 +08:00
|
|
|
|
|
|
|
|
&:hover {
|
2025-11-12 03:41:22 +08:00
|
|
|
color: var(--main-color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
|
color: var(--main-color);
|
2026-03-09 01:23:15 +08:00
|
|
|
// 移除点击缩小效果
|
2025-03-28 03:17:09 +08:00
|
|
|
}
|
|
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
.anticon {
|
2025-11-12 03:41:22 +08:00
|
|
|
font-size: 14px;
|
|
|
|
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
&.rotated {
|
|
|
|
|
transform: rotate(45deg);
|
2025-03-28 03:17:09 +08:00
|
|
|
}
|
2025-08-09 23:18:19 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Popover 选项样式
|
|
|
|
|
.popover-options {
|
2025-11-12 03:41:22 +08:00
|
|
|
min-width: 160px;
|
|
|
|
|
max-width: 200px;
|
|
|
|
|
padding: 4px;
|
2025-08-09 23:18:19 +08:00
|
|
|
|
|
|
|
|
.no-options {
|
2025-11-12 03:41:22 +08:00
|
|
|
color: var(--gray-500);
|
2025-08-09 23:18:19 +08:00
|
|
|
font-size: 12px;
|
|
|
|
|
text-align: center;
|
2025-11-12 03:41:22 +08:00
|
|
|
padding: 12px 8px;
|
2025-08-09 23:18:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.opt-item) {
|
2025-11-12 03:41:22 +08:00
|
|
|
border-radius: 8px;
|
|
|
|
|
padding: 6px 10px;
|
2025-08-09 23:18:19 +08:00
|
|
|
cursor: pointer;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
transition: all 0.2s ease;
|
2025-11-12 03:41:22 +08:00
|
|
|
margin: 2px;
|
2025-08-09 23:18:19 +08:00
|
|
|
display: inline-block;
|
2025-03-28 03:17:09 +08:00
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
&:hover {
|
|
|
|
|
background-color: var(--main-10);
|
2025-11-12 03:41:22 +08:00
|
|
|
color: var(--main-600);
|
2025-03-28 03:17:09 +08:00
|
|
|
}
|
|
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
&.active {
|
2025-11-12 03:41:22 +08:00
|
|
|
color: var(--main-600);
|
2025-08-09 23:18:19 +08:00
|
|
|
background-color: var(--main-10);
|
2025-03-28 03:17:09 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-09 23:18:19 +08:00
|
|
|
.send-button.ant-btn-icon-only {
|
2025-03-28 03:17:09 +08:00
|
|
|
height: 32px;
|
|
|
|
|
width: 32px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
background-color: var(--main-500);
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
border: none;
|
|
|
|
|
transition: all 0.2s ease;
|
2025-11-23 01:39:44 +08:00
|
|
|
box-shadow: 0 2px 6px var(--shadow-2);
|
|
|
|
|
color: var(--gray-0);
|
2025-03-28 03:17:09 +08:00
|
|
|
padding: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
2025-07-26 03:36:54 +08:00
|
|
|
background-color: var(--main-color);
|
2025-11-23 01:39:44 +08:00
|
|
|
box-shadow: 0 4px 8px var(--shadow-3);
|
|
|
|
|
color: var(--gray-0);
|
2025-03-28 03:17:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:active {
|
2025-11-23 01:39:44 +08:00
|
|
|
box-shadow: 0 2px 4px var(--shadow-2);
|
2026-03-09 01:23:15 +08:00
|
|
|
// 移除点击动画效果
|
2025-03-28 03:17:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:disabled {
|
2025-11-06 21:59:48 +08:00
|
|
|
opacity: 0.5;
|
2025-03-28 03:17:09 +08:00
|
|
|
cursor: not-allowed;
|
|
|
|
|
transform: none;
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 520px) {
|
|
|
|
|
.input-box {
|
|
|
|
|
border-radius: 15px;
|
|
|
|
|
padding: 0.625rem 0.875rem;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-04 17:05:26 +08:00
|
|
|
|
|
|
|
|
// @ 提及弹窗样式
|
|
|
|
|
.mention-dropdown-wrapper {
|
|
|
|
|
position: absolute;
|
|
|
|
|
z-index: 1000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mention-popup {
|
|
|
|
|
min-width: 240px;
|
|
|
|
|
max-height: 280px;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
background: var(--gray-0);
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
|
|
|
border: 1px solid var(--gray-200);
|
|
|
|
|
|
|
|
|
|
.mention-group {
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mention-group-title {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 4px;
|
|
|
|
|
border-bottom: 1px solid var(--gray-100);
|
|
|
|
|
margin-bottom: 2px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mention-item {
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
transition: all 0.15s ease;
|
|
|
|
|
margin: 1px 4px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
&.active {
|
|
|
|
|
background-color: var(--main-10);
|
|
|
|
|
color: var(--main-600);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mention-empty {
|
|
|
|
|
text-align: center;
|
|
|
|
|
padding: 12px 8px;
|
|
|
|
|
color: var(--gray-400);
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-15 13:29:33 +08:00
|
|
|
</style>
|