feat: dressfor页面作为聊天起始

This commit is contained in:
zhangyahui
2025-11-17 17:38:57 +08:00
parent bb6378e409
commit d53a94a949
5 changed files with 214 additions and 26 deletions

View File

@@ -6,8 +6,8 @@
v-for="(line, index) in lines"
:key="index"
:class="['line', `line-${line.type}`]"
></div> </template
>>
></div>
</template>
</div>
</div>
</template>
@@ -44,7 +44,8 @@ const calculateLines = (): Line[] => {
// 这样当滚动到50%时,内容看起来和开始一样
const availableWidth = containerWidth
const lineWithGap = lineWidthPx + gapPx
const linesNeeded = Math.ceil(availableWidth / lineWithGap)
// 使用四舍五入让一个周期的宽度尽量接近容器宽度,减少滚动结束时的“回跳”感
const linesNeeded = Math.max(1, Math.round(availableWidth / lineWithGap))
const generatedLines: Line[] = []

View File

@@ -86,7 +86,7 @@ const shortcutList: string[] = [
const handleSend = (): void => {
if (inputValue.value.trim()) {
console.log('input发送消息:', inputValue.value)
// console.log('input发送消息:', inputValue.value)
emit('send-message', inputValue.value)
inputValue.value = ''
// 重置textarea高度

View File

@@ -30,13 +30,14 @@ import NoticeList from './components/NoticeList.vue'
import InputArea from './components/InputArea.vue'
import GenerateLoading from './components/GenerateLoading.vue'
import { ref, onMounted, onUnmounted, onActivated } from 'vue'
import { useRouter } from 'vue-router'
import { useRouter, useRoute } from 'vue-router'
import { useUserInfoStore, useGenerateStore } from '@/stores'
import { streamChatAddress } from '@/api/workshop'
import { generateUUID } from '@/utils/tools'
import { showToast } from 'vant'
const router = useRouter()
const route = useRoute()
const generateStore = useGenerateStore()
const userInfoStore = useUserInfoStore()
@@ -68,9 +69,21 @@ const isStreaming = ref<boolean>(false)
const currentStreamingMessage = ref<ChatMessage | null>(null)
const sessionId = ref<string>('')
const sendPrefilledMessage = () => {
const { message, ...restQuery } = route.query
if (typeof message === 'string' && message.trim()) {
handleSendMessage(message)
router.replace({
path: route.path,
query: restQuery
})
}
}
onMounted(() => {
sessionId.value = Math.floor(Date.now() / 1000).toString()
generateStore.setSessionId(sessionId.value)
sendPrefilledMessage()
})
onActivated(() => {