|
|
@@ -8,6 +8,7 @@ const { messages, running, error, send, newChat } = useAgui()
|
|
|
const agents = reactive(AGENTS)
|
|
|
|
|
|
const currentId = ref(agents[0]?.id || '')
|
|
|
+const userName = ref('admin')
|
|
|
const input = ref('')
|
|
|
const listEl = ref(null)
|
|
|
const textareaEl = ref(null)
|
|
|
@@ -18,10 +19,11 @@ const agentSelectorEl = ref(null)
|
|
|
const currentAgent = computed(
|
|
|
() => agents.find((a) => a.id === currentId.value) || agents[0]
|
|
|
)
|
|
|
-// 实际请求地址 = 网关地址 + 智能体 ID
|
|
|
+// 实际请求地址:优先用智能体自带 url,否则「网关地址 + 智能体 ID」
|
|
|
const currentUrl = computed(() => {
|
|
|
const a = currentAgent.value
|
|
|
if (!a) return ''
|
|
|
+ if (a.url) return a.url
|
|
|
return `${GATEWAY_URL.replace(/\/+$/, '')}/${a.id}`
|
|
|
})
|
|
|
|
|
|
@@ -57,7 +59,7 @@ async function onSend() {
|
|
|
if (!text.trim() || running.value) return
|
|
|
input.value = ''
|
|
|
if (textareaEl.value) textareaEl.value.style.height = 'auto'
|
|
|
- await send(currentUrl.value, text)
|
|
|
+ await send(currentUrl.value, text, userName.value)
|
|
|
}
|
|
|
|
|
|
function onKeydown(e) {
|
|
|
@@ -100,6 +102,14 @@ watch(
|
|
|
<span class="new-chat-icon">+</span> 开启新对话
|
|
|
</button>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 左下角用户信息 -->
|
|
|
+ <div class="sidebar-footer">
|
|
|
+ <div class="user-info">
|
|
|
+ <div class="user-avatar-sm">{{ userName.charAt(0).toUpperCase() }}</div>
|
|
|
+ <span class="user-name">{{ userName }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</aside>
|
|
|
|
|
|
<!-- 右侧主区 -->
|
|
|
@@ -326,6 +336,50 @@ watch(
|
|
|
flex-shrink: 0;
|
|
|
}
|
|
|
|
|
|
+/* 左下角用户信息 */
|
|
|
+.sidebar-footer {
|
|
|
+ flex-shrink: 0;
|
|
|
+ padding: 12px;
|
|
|
+ border-top: 1px solid #ebebec;
|
|
|
+}
|
|
|
+
|
|
|
+.user-info {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 10px;
|
|
|
+ padding: 8px 10px;
|
|
|
+ border-radius: 10px;
|
|
|
+ cursor: default;
|
|
|
+ transition: background 0.15s;
|
|
|
+}
|
|
|
+
|
|
|
+.user-info:hover {
|
|
|
+ background: #eff0f3;
|
|
|
+}
|
|
|
+
|
|
|
+.user-avatar-sm {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #4f8cff;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 13px;
|
|
|
+ font-weight: 600;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ flex-shrink: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.user-name {
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #374151;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+}
|
|
|
+
|
|
|
/* ── 右侧主区 ── */
|
|
|
.main {
|
|
|
flex: 1;
|