fix(build): 修复 v0.5.0-beta 前端编译错误
跑 npm run build 验收时发现 2 个前端项目编译失败(vue-tsc 报错),修复 4 处:
frontend-h5:
- src/components/chat/InputBox.vue:185 多余右括号
computed(() => inputText.value.length)) -> computed(() => inputText.value.length)
- src/components/chat/MessageList.vue:134 pollMessages 调用签名错
pollMessages(convId, afterMessageId) -> pollMessages(afterMessageId)
(api/message.ts:71 签名只接 1 个 afterMessageId 参数,endpoint 走 current 不需要 convId)
frontend-agent:
- src/components/chat/InputBox.vue 4 处错
L91/234/292 conversationStore.loading 不存在(store 暴露的是 loadingMessages)
-> conversationStore.loadingMessages
L136 import onUnmounted 死引用,移除
components.d.ts: 触发 unplugin-vue-components 重新生成 6 行(新组件类型)
验证:
- frontend-h5: vue-tsc 0 错,417 modules transformed, dist/ 生成
- frontend-agent: vue-tsc 0 错,1750 modules transformed, dist/ 生成
不影响业务逻辑,纯 build fix。
This commit is contained in:
@@ -88,7 +88,7 @@
|
|||||||
:disabled="!canSend"
|
:disabled="!canSend"
|
||||||
@click="handleSend"
|
@click="handleSend"
|
||||||
>
|
>
|
||||||
<svg v-if="!conversationStore.loading" class="send-icon" viewBox="0 0 24 24" fill="currentColor">
|
<svg v-if="!conversationStore.loadingMessages" class="send-icon" viewBox="0 0 24 24" fill="currentColor">
|
||||||
<path d="M2.01 21L23 12 2.01 3 2 10l15-2-15-2z"/>
|
<path d="M2.01 21L23 12 2.01 3 2 10l15-2-15-2z"/>
|
||||||
</svg>
|
</svg>
|
||||||
<van-loading v-else size="16px" color="#fff" />
|
<van-loading v-else size="16px" color="#fff" />
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
* 底部显示字数统计,右下角发送按钮
|
* 底部显示字数统计,右下角发送按钮
|
||||||
* Enter发送,Shift+Enter换行
|
* Enter发送,Shift+Enter换行
|
||||||
*/
|
*/
|
||||||
import { ref, computed, watch, nextTick, onUnmounted } from 'vue'
|
import { ref, computed, watch, nextTick } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import html2canvas from 'html2canvas-pro'
|
import html2canvas from 'html2canvas-pro'
|
||||||
import { useConversationStore } from '@/stores/conversation'
|
import { useConversationStore } from '@/stores/conversation'
|
||||||
@@ -227,11 +227,11 @@ const commonEmojis = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
/** 当前字符数 */
|
/** 当前字符数 */
|
||||||
const charCount = computed(() => inputText.value.length))
|
const charCount = computed(() => inputText.value.length)
|
||||||
|
|
||||||
/** 是否可以发送 */
|
/** 是否可以发送 */
|
||||||
const canSend = computed(() => {
|
const canSend = computed(() => {
|
||||||
return inputText.value.trim().length > 0 && !conversationStore.loading && charCount.value <= maxChars
|
return inputText.value.trim().length > 0 && !conversationStore.loadingMessages && charCount.value <= maxChars
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 已在参与者列表中的ID */
|
/** 已在参与者列表中的ID */
|
||||||
@@ -289,7 +289,7 @@ function handleKeydown(event: KeyboardEvent): void {
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
async function handleSend(): Promise<void> {
|
async function handleSend(): Promise<void> {
|
||||||
const content = inputText.value.trim()
|
const content = inputText.value.trim()
|
||||||
if (!content || conversationStore.loading) return
|
if (!content || conversationStore.loadingMessages) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
emit('send', content)
|
emit('send', content)
|
||||||
|
|||||||
Vendored
+6
@@ -8,12 +8,16 @@ export {}
|
|||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AiHelperPanel: typeof import('./src/components/assistant/AiHelperPanel.vue')['default']
|
AiHelperPanel: typeof import('./src/components/assistant/AiHelperPanel.vue')['default']
|
||||||
|
ApprovalCardModal: typeof import('./src/components/chat/ApprovalCardModal.vue')['default']
|
||||||
ApprovalLinks: typeof import('./src/components/assistant/ApprovalLinks.vue')['default']
|
ApprovalLinks: typeof import('./src/components/assistant/ApprovalLinks.vue')['default']
|
||||||
CallAgentModal: typeof import('./src/components/chat/CallAgentModal.vue')['default']
|
CallAgentModal: typeof import('./src/components/chat/CallAgentModal.vue')['default']
|
||||||
ChatPanel: typeof import('./src/components/chat/ChatPanel.vue')['default']
|
ChatPanel: typeof import('./src/components/chat/ChatPanel.vue')['default']
|
||||||
ComingSoon: typeof import('./src/components/assistant/ComingSoon.vue')['default']
|
ComingSoon: typeof import('./src/components/assistant/ComingSoon.vue')['default']
|
||||||
InputBar: typeof import('./src/components/chat/InputBar.vue')['default']
|
InputBar: typeof import('./src/components/chat/InputBar.vue')['default']
|
||||||
|
InputBox: typeof import('./src/components/chat/InputBox.vue')['default']
|
||||||
MessageBubble: typeof import('./src/components/chat/MessageBubble.vue')['default']
|
MessageBubble: typeof import('./src/components/chat/MessageBubble.vue')['default']
|
||||||
|
MessageItem: typeof import('./src/components/chat/MessageItem.vue')['default']
|
||||||
|
MessageList: typeof import('./src/components/chat/MessageList.vue')['default']
|
||||||
ParticipantList: typeof import('./src/components/chat/ParticipantList.vue')['default']
|
ParticipantList: typeof import('./src/components/chat/ParticipantList.vue')['default']
|
||||||
RightPanel: typeof import('./src/components/assistant/RightPanel.vue')['default']
|
RightPanel: typeof import('./src/components/assistant/RightPanel.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
@@ -27,5 +31,7 @@ declare module 'vue' {
|
|||||||
VanConfigProvider: typeof import('vant/es')['ConfigProvider']
|
VanConfigProvider: typeof import('vant/es')['ConfigProvider']
|
||||||
VanEmpty: typeof import('vant/es')['Empty']
|
VanEmpty: typeof import('vant/es')['Empty']
|
||||||
VanField: typeof import('vant/es')['Field']
|
VanField: typeof import('vant/es')['Field']
|
||||||
|
VanIcon: typeof import('vant/es')['Icon']
|
||||||
|
VanPopup: typeof import('vant/es')['Popup']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ const showScreenshotEditor = ref(false)
|
|||||||
let screenshotCanvas: HTMLCanvasElement | null = null
|
let screenshotCanvas: HTMLCanvasElement | null = null
|
||||||
|
|
||||||
/** 当前字符数 */
|
/** 当前字符数 */
|
||||||
const charCount = computed(() => inputText.value.length))
|
const charCount = computed(() => inputText.value.length)
|
||||||
|
|
||||||
/** 是否可以发送消息 */
|
/** 是否可以发送消息 */
|
||||||
const canSend = computed(() => {
|
const canSend = computed(() => {
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ async function fetchNewMessages(): Promise<void> {
|
|||||||
const lastMsg = messages.value[messages.value.length - 1]
|
const lastMsg = messages.value[messages.value.length - 1]
|
||||||
const afterMessageId = lastMsg?.message_id
|
const afterMessageId = lastMsg?.message_id
|
||||||
|
|
||||||
const newMessages = await pollMessages(convId, afterMessageId)
|
const newMessages = await pollMessages(afterMessageId)
|
||||||
|
|
||||||
if (newMessages && newMessages.length > 0) {
|
if (newMessages && newMessages.length > 0) {
|
||||||
// 添加新消息到列表
|
// 添加新消息到列表
|
||||||
|
|||||||
Reference in New Issue
Block a user