2025-03-13 11:08:19 +08:00

653 lines
38 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div id="root">
<div class="cb86951c">
<div class="c3ecdb44">
<div class="f2eea526">
<div class="a5cd95be">
<div class="b83ee326" style="overflow-y: auto;">
<div class="f6004764" :style="{height:!showList?'120%':'100%'}">
<div class="dad65929" v-if="showList" @wheel="handleScroll"
style="flex-grow: 0;margin: 0px auto;overflow: auto;" ref="chatContainerRef">
<div v-for="item in paramMsg">
<div v-if="item.role == 'user'" class="fa81">
<div class="fbb737a4" style="background-color:#F8F8F8">{{ item.content }}<div class="ds-flex e0558cb1"
style="position: absolute; right: calc(100% + 18px); top: 12px; gap: 12px;">
<div class="ds-icon-button" tabindex="0"
style="--ds-icon-button-text-color: #909090; --ds-icon-button-size: 20px;">
<div @click="copy(item.content)" class="ds-icon"
style="font-size: 20px; width: 20px; height: 20px;"><svg viewBox="0 0 20 20" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<clippath id="clip1257_20794">
<rect id="复制" width="20.000000" height="20.000000" fill="white" fill-opacity="0">
</rect>
</clippath>
</defs>
<g clip-path="url(#clip1257_20794)">
<g clip-path="url(#clip1248_20193)">
<path id="path"
d="M5.03 14.64C4.77 14.64 4.5 14.62 4.24 14.56C3.98 14.51 3.73 14.43 3.49 14.33C3.24 14.23 3.01 14.1 2.79 13.96C2.57 13.81 2.37 13.64 2.18 13.45C1.99 13.26 1.82 13.05 1.68 12.83C1.53 12.61 1.4 12.37 1.3 12.13C1.2 11.88 1.13 11.63 1.07 11.36C1.02 11.1 1 10.84 1 10.57L1 5.07C1 4.8 1.02 4.54 1.07 4.27C1.13 4.01 1.2 3.76 1.3 3.51C1.4 3.26 1.53 3.03 1.68 2.81C1.82 2.58 1.99 2.38 2.18 2.19C2.37 2 2.57 1.83 2.79 1.68C3.01 1.53 3.24 1.41 3.49 1.31C3.73 1.2 3.98 1.13 4.24 1.07C4.5 1.02 4.77 1 5.03 1L10.49 1C10.75 1 11.01 1.02 11.27 1.07C11.53 1.13 11.78 1.2 12.03 1.31C12.27 1.41 12.51 1.53 12.73 1.68C12.95 1.83 13.15 2 13.34 2.19C13.53 2.38 13.69 2.58 13.84 2.81C13.99 3.03 14.11 3.26 14.21 3.51C14.31 3.76 14.39 4.01 14.44 4.27C14.5 4.54 14.52 4.8 14.52 5.07L12.94 5.07C12.94 4.91 12.92 4.75 12.89 4.58C12.86 4.43 12.81 4.27 12.75 4.12C12.69 3.97 12.61 3.83 12.52 3.69C12.43 3.56 12.33 3.43 12.22 3.32C12.1 3.2 11.98 3.1 11.85 3.01C11.71 2.92 11.57 2.84 11.42 2.78C11.27 2.72 11.12 2.67 10.96 2.64C10.81 2.61 10.65 2.59 10.49 2.59L5.03 2.59C4.87 2.59 4.71 2.61 4.55 2.64C4.4 2.67 4.24 2.72 4.09 2.78C3.95 2.84 3.8 2.92 3.67 3.01C3.54 3.1 3.41 3.2 3.3 3.32C3.18 3.43 3.08 3.56 2.99 3.69C2.9 3.83 2.83 3.97 2.77 4.12C2.71 4.27 2.66 4.43 2.63 4.58C2.6 4.75 2.58 4.91 2.58 5.07L2.58 10.57C2.58 10.73 2.6 10.89 2.63 11.05C2.66 11.21 2.71 11.37 2.77 11.52C2.83 11.67 2.9 11.81 2.99 11.94C3.08 12.08 3.18 12.2 3.3 12.32C3.41 12.43 3.54 12.54 3.67 12.63C3.8 12.72 3.95 12.79 4.09 12.86C4.24 12.92 4.4 12.96 4.55 13C4.71 13.03 4.87 13.04 5.03 13.04L5.03 14.64Z"
fill="currentColor" fill-opacity="1.000000" fill-rule="evenodd"></path>
</g>
<path id="path"
d="M14.75 18.91L9.3 18.91C9.03 18.91 8.77 18.88 8.51 18.83C8.25 18.78 8 18.7 7.75 18.6C7.51 18.49 7.27 18.37 7.05 18.22C6.83 18.07 6.63 17.9 6.44 17.71C6.25 17.52 6.09 17.32 5.94 17.1C5.79 16.87 5.67 16.64 5.57 16.39C5.47 16.14 5.39 15.89 5.34 15.63C5.28 15.37 5.26 15.1 5.26 14.83L5.26 9.33C5.26 9.06 5.28 8.8 5.34 8.54C5.39 8.28 5.47 8.02 5.57 7.77C5.67 7.53 5.79 7.29 5.94 7.07C6.09 6.85 6.25 6.64 6.44 6.45C6.63 6.26 6.83 6.09 7.05 5.95C7.27 5.8 7.51 5.67 7.75 5.57C8 5.47 8.25 5.39 8.51 5.34C8.77 5.29 9.03 5.26 9.3 5.26L14.75 5.26C15.01 5.26 15.28 5.29 15.54 5.34C15.8 5.39 16.05 5.47 16.29 5.57C16.54 5.67 16.77 5.8 16.99 5.95C17.21 6.09 17.41 6.26 17.6 6.45C17.79 6.64 17.96 6.85 18.1 7.07C18.25 7.29 18.37 7.53 18.48 7.77C18.58 8.02 18.65 8.28 18.71 8.54C18.76 8.8 18.78 9.06 18.78 9.33L18.78 14.83C18.78 15.1 18.76 15.37 18.71 15.63C18.65 15.89 18.58 16.14 18.48 16.39C18.37 16.64 18.25 16.87 18.1 17.1C17.96 17.32 17.79 17.52 17.6 17.71C17.41 17.9 17.21 18.07 16.99 18.22C16.77 18.37 16.54 18.49 16.29 18.6C16.05 18.7 15.8 18.78 15.54 18.83C15.28 18.88 15.01 18.91 14.75 18.91ZM9.3 6.86C9.13 6.86 8.97 6.87 8.82 6.91C8.66 6.94 8.51 6.98 8.36 7.05C8.21 7.11 8.07 7.18 7.93 7.28C7.8 7.37 7.68 7.47 7.56 7.58C7.45 7.7 7.35 7.82 7.26 7.96C7.17 8.09 7.09 8.24 7.03 8.38C6.97 8.54 6.92 8.69 6.89 8.85C6.86 9.01 6.84 9.17 6.84 9.33L6.84 14.83C6.84 15 6.86 15.16 6.89 15.32C6.92 15.48 6.97 15.63 7.03 15.78C7.09 15.93 7.17 16.07 7.26 16.21C7.35 16.34 7.45 16.47 7.56 16.58C7.68 16.7 7.8 16.8 7.93 16.89C8.07 16.98 8.21 17.06 8.36 17.12C8.51 17.18 8.66 17.23 8.82 17.26C8.97 17.29 9.13 17.31 9.3 17.31L14.75 17.31C14.91 17.31 15.07 17.29 15.23 17.26C15.38 17.23 15.54 17.18 15.69 17.12C15.83 17.06 15.98 16.98 16.11 16.89C16.24 16.8 16.37 16.7 16.48 16.58C16.59 16.47 16.7 16.34 16.79 16.21C16.87 16.07 16.95 15.93 17.01 15.78C17.07 15.63 17.12 15.48 17.15 15.32C17.18 15.16 17.2 15 17.2 14.83L17.2 9.33C17.2 9.17 17.18 9.01 17.15 8.85C17.12 8.69 17.07 8.54 17.01 8.38C16.95 8.24 16.87 8.09 16.79 7.96C16.7 7.82 16.59 7.7 16.48 7.58C16.37 7.47 16.24 7.37 16.11 7.28C15.98 7.19 15.83 7.11 15.69 7.05C15.54 6.98 15.38 6.94 15.23 6.91C15.07 6.87 14.91 6.86 14.75 6.86L9.3 6.86Z"
fill="currentColor" fill-opacity="1.000000" fill-rule="nonzero"></path>
</g>
</svg></div>
</div>
</div>
</div>
</div>
<div v-if="item.role == 'assistant'" class="f9bf7997 d7dc56a8 c05b5566">
<div class="eb23581b dfa60d66">
<img src="@/assets/icon4.png" style="width: 100%;border-radius: 50%;">
</div>
<div class="edb250b1">
<div v-if="item.skLong && item.msgCode == 1" class="a6d716f5 db5991dd">
<div class="ds-icon acbf4957" style="font-size: 12px; width: 12px; height: 12px;"><svg
width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M2.656 17.344c-1.016-1.015-1.15-2.75-.313-4.925.325-.825.73-1.617 1.205-2.365L3.582 10l-.033-.054c-.5-.799-.91-1.596-1.206-2.365-.836-2.175-.703-3.91.313-4.926.56-.56 1.364-.86 2.335-.86 1.425 0 3.168.636 4.957 1.756l.053.034.053-.034c1.79-1.12 3.532-1.757 4.957-1.757.972 0 1.776.3 2.335.86 1.014 1.015 1.148 2.752.312 4.926a13.892 13.892 0 0 1-1.206 2.365l-.034.054.034.053c.5.8.91 1.596 1.205 2.365.837 2.175.704 3.911-.311 4.926-.56.56-1.364.861-2.335.861-1.425 0-3.168-.637-4.957-1.757L10 16.415l-.053.033c-1.79 1.12-3.532 1.757-4.957 1.757-.972 0-1.776-.3-2.335-.86zm13.631-4.399c-.187-.488-.429-.988-.71-1.492l-.075-.132-.092.12a22.075 22.075 0 0 1-3.968 3.968l-.12.093.132.074c1.308.734 2.559 1.162 3.556 1.162.563 0 1.006-.138 1.298-.43.3-.3.436-.774.428-1.346-.008-.575-.159-1.264-.449-2.017zm-6.345 1.65l.058.042.058-.042a19.881 19.881 0 0 0 4.551-4.537l.043-.058-.043-.058a20.123 20.123 0 0 0-2.093-2.458 19.732 19.732 0 0 0-2.458-2.08L10 5.364l-.058.042A19.883 19.883 0 0 0 5.39 9.942L5.348 10l.042.059c.631.874 1.332 1.695 2.094 2.457a19.74 19.74 0 0 0 2.458 2.08zm6.366-10.902c-.293-.293-.736-.431-1.298-.431-.998 0-2.248.429-3.556 1.163l-.132.074.12.092a21.938 21.938 0 0 1 3.968 3.968l.092.12.074-.132c.282-.504.524-1.004.711-1.492.29-.753.442-1.442.45-2.017.007-.572-.129-1.045-.429-1.345zM3.712 7.055c.202.514.44 1.013.712 1.493l.074.13.092-.119a21.94 21.94 0 0 1 3.968-3.968l.12-.092-.132-.074C7.238 3.69 5.987 3.262 4.99 3.262c-.563 0-1.006.138-1.298.43-.3.301-.436.774-.428 1.346.007.575.159 1.264.448 2.017zm0 5.89c-.29.753-.44 1.442-.448 2.017-.008.572.127 1.045.428 1.345.293.293.736.431 1.298.431.997 0 2.247-.428 3.556-1.162l.131-.074-.12-.093a21.94 21.94 0 0 1-3.967-3.968l-.093-.12-.074.132a11.712 11.712 0 0 0-.71 1.492z"
fill="currentColor" stroke="currentColor" stroke-width=".1"></path>
<path d="M10.706 11.704A1.843 1.843 0 0 1 8.155 10a1.845 1.845 0 1 1 2.551 1.704z"
fill="currentColor" stroke="currentColor" stroke-width=".2"></path>
</svg>
</div>思考中...
</div>
<div v-if="!item.skLong && item.msgCode == 0" class="a6d716f5 db5991dd">
<div class="ds-icon acbf4957" style="font-size: 12px; width: 12px; height: 12px;"><svg
width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M2.656 17.344c-1.016-1.015-1.15-2.75-.313-4.925.325-.825.73-1.617 1.205-2.365L3.582 10l-.033-.054c-.5-.799-.91-1.596-1.206-2.365-.836-2.175-.703-3.91.313-4.926.56-.56 1.364-.86 2.335-.86 1.425 0 3.168.636 4.957 1.756l.053.034.053-.034c1.79-1.12 3.532-1.757 4.957-1.757.972 0 1.776.3 2.335.86 1.014 1.015 1.148 2.752.312 4.926a13.892 13.892 0 0 1-1.206 2.365l-.034.054.034.053c.5.8.91 1.596 1.205 2.365.837 2.175.704 3.911-.311 4.926-.56.56-1.364.861-2.335.861-1.425 0-3.168-.637-4.957-1.757L10 16.415l-.053.033c-1.79 1.12-3.532 1.757-4.957 1.757-.972 0-1.776-.3-2.335-.86zm13.631-4.399c-.187-.488-.429-.988-.71-1.492l-.075-.132-.092.12a22.075 22.075 0 0 1-3.968 3.968l-.12.093.132.074c1.308.734 2.559 1.162 3.556 1.162.563 0 1.006-.138 1.298-.43.3-.3.436-.774.428-1.346-.008-.575-.159-1.264-.449-2.017zm-6.345 1.65l.058.042.058-.042a19.881 19.881 0 0 0 4.551-4.537l.043-.058-.043-.058a20.123 20.123 0 0 0-2.093-2.458 19.732 19.732 0 0 0-2.458-2.08L10 5.364l-.058.042A19.883 19.883 0 0 0 5.39 9.942L5.348 10l.042.059c.631.874 1.332 1.695 2.094 2.457a19.74 19.74 0 0 0 2.458 2.08zm6.366-10.902c-.293-.293-.736-.431-1.298-.431-.998 0-2.248.429-3.556 1.163l-.132.074.12.092a21.938 21.938 0 0 1 3.968 3.968l.092.12.074-.132c.282-.504.524-1.004.711-1.492.29-.753.442-1.442.45-2.017.007-.572-.129-1.045-.429-1.345zM3.712 7.055c.202.514.44 1.013.712 1.493l.074.13.092-.119a21.94 21.94 0 0 1 3.968-3.968l.12-.092-.132-.074C7.238 3.69 5.987 3.262 4.99 3.262c-.563 0-1.006.138-1.298.43-.3.301-.436.774-.428 1.346.007.575.159 1.264.448 2.017zm0 5.89c-.29.753-.44 1.442-.448 2.017-.008.572.127 1.045.428 1.345.293.293.736.431 1.298.431.997 0 2.247-.428 3.556-1.162l.131-.074-.12-.093a21.94 21.94 0 0 1-3.967-3.968l-.093-.12-.074.132a11.712 11.712 0 0 0-.71 1.492z"
fill="currentColor" stroke="currentColor" stroke-width=".1"></path>
<path d="M10.706 11.704A1.843 1.843 0 0 1 8.155 10a1.845 1.845 0 1 1 2.551 1.704z"
fill="currentColor" stroke="currentColor" stroke-width=".2"></path>
</svg>
</div>您的请求过于频繁请您稍后再试...
</div>
<!--思考的转圈图标-->
<div v-if="item.skLong && item.msgCode == 1" class="ds-loading b4e4476b"
style="font-size: 20px;">
<svg viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
data-icon="spin">
<defs>
<linearGradient x1="0%" y1="100%" x2="100%" y2="100%" id="linearGradient-1">
<stop stop-color="currentColor" stop-opacity="0" offset="0%"></stop>
<stop stop-color="currentColor" stop-opacity="0.50" offset="39.9430698%"></stop>
<stop stop-color="currentColor" offset="100%"></stop>
</linearGradient>
</defs>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect fill-opacity="0.01" fill="none" x="0" y="0" width="36" height="36"></rect>
<path
d="M34,18 C34,9.163444 26.836556,2 18,2 C11.6597233,2 6.18078805,5.68784135 3.59122325,11.0354951"
stroke="url(#linearGradient-1)" stroke-width="4" stroke-linecap="round"></path>
</g>
</svg>
</div>
<!--思考的内容-->
<div class="e1675d8b" v-if="isNotEmpty(item.sk)">
<div class="ecc93a3b"></div>
<p class="ba94db8a">
{{ item.sk }}
</p>
</div>
</div>
<!--回答的内容-->
<div class="ds-markdown ds-markdown--block" style="--ds-md-zoom: 1.143;">
<div v-html="item.content"></div>
</div>
<div v-if="item.emptyShow">
<div class="a6d716f5 db5991dd">
<div class="ds-icon acbf4957" style="font-size: 12px; width: 12px; height: 12px;"><svg t="1741138938671" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2618" width="200" height="200"><path d="M512 29.538462a482.461538 482.461538 0 1 0 482.461538 482.461538A482.461538 482.461538 0 0 0 512 29.538462z m55.138462 206.178461l-15.753847 354.461539h-78.76923l-15.753847-354.461539zM512 788.283077a68.923077 68.923077 0 1 1 68.923077-68.923077 68.923077 68.923077 0 0 1-68.923077 68.923077z" p-id="2619"></path></svg>
</div>系统访问超时请稍候重试...
</div>
</div>
<div class="ds-flex" style="margin-top: 12px; height: 20px; align-items: center; gap: 12px;">
<div class="ds-flex abe97156" style="align-items: center; gap: 12px;">
<div class="ds-icon-button" tabindex="0"
style="--ds-icon-button-text-color: #909090; --ds-icon-button-size: 20px;">
<div @click="copy(item.content)" class="ds-icon"
style="font-size: 20px; width: 20px; height: 20px;"><svg viewBox="0 0 20 20" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<clippath id="clip1257_20794">
<rect id="复制" width="20.000000" height="20.000000" fill="white" fill-opacity="0">
</rect>
</clippath>
</defs>
<g clip-path="url(#clip1257_20794)">
<g clip-path="url(#clip1248_20193)">
<path id="path"
d="M5.03 14.64C4.77 14.64 4.5 14.62 4.24 14.56C3.98 14.51 3.73 14.43 3.49 14.33C3.24 14.23 3.01 14.1 2.79 13.96C2.57 13.81 2.37 13.64 2.18 13.45C1.99 13.26 1.82 13.05 1.68 12.83C1.53 12.61 1.4 12.37 1.3 12.13C1.2 11.88 1.13 11.63 1.07 11.36C1.02 11.1 1 10.84 1 10.57L1 5.07C1 4.8 1.02 4.54 1.07 4.27C1.13 4.01 1.2 3.76 1.3 3.51C1.4 3.26 1.53 3.03 1.68 2.81C1.82 2.58 1.99 2.38 2.18 2.19C2.37 2 2.57 1.83 2.79 1.68C3.01 1.53 3.24 1.41 3.49 1.31C3.73 1.2 3.98 1.13 4.24 1.07C4.5 1.02 4.77 1 5.03 1L10.49 1C10.75 1 11.01 1.02 11.27 1.07C11.53 1.13 11.78 1.2 12.03 1.31C12.27 1.41 12.51 1.53 12.73 1.68C12.95 1.83 13.15 2 13.34 2.19C13.53 2.38 13.69 2.58 13.84 2.81C13.99 3.03 14.11 3.26 14.21 3.51C14.31 3.76 14.39 4.01 14.44 4.27C14.5 4.54 14.52 4.8 14.52 5.07L12.94 5.07C12.94 4.91 12.92 4.75 12.89 4.58C12.86 4.43 12.81 4.27 12.75 4.12C12.69 3.97 12.61 3.83 12.52 3.69C12.43 3.56 12.33 3.43 12.22 3.32C12.1 3.2 11.98 3.1 11.85 3.01C11.71 2.92 11.57 2.84 11.42 2.78C11.27 2.72 11.12 2.67 10.96 2.64C10.81 2.61 10.65 2.59 10.49 2.59L5.03 2.59C4.87 2.59 4.71 2.61 4.55 2.64C4.4 2.67 4.24 2.72 4.09 2.78C3.95 2.84 3.8 2.92 3.67 3.01C3.54 3.1 3.41 3.2 3.3 3.32C3.18 3.43 3.08 3.56 2.99 3.69C2.9 3.83 2.83 3.97 2.77 4.12C2.71 4.27 2.66 4.43 2.63 4.58C2.6 4.75 2.58 4.91 2.58 5.07L2.58 10.57C2.58 10.73 2.6 10.89 2.63 11.05C2.66 11.21 2.71 11.37 2.77 11.52C2.83 11.67 2.9 11.81 2.99 11.94C3.08 12.08 3.18 12.2 3.3 12.32C3.41 12.43 3.54 12.54 3.67 12.63C3.8 12.72 3.95 12.79 4.09 12.86C4.24 12.92 4.4 12.96 4.55 13C4.71 13.03 4.87 13.04 5.03 13.04L5.03 14.64Z"
fill="currentColor" fill-opacity="1.000000" fill-rule="evenodd"></path>
</g>
<path id="path"
d="M14.75 18.91L9.3 18.91C9.03 18.91 8.77 18.88 8.51 18.83C8.25 18.78 8 18.7 7.75 18.6C7.51 18.49 7.27 18.37 7.05 18.22C6.83 18.07 6.63 17.9 6.44 17.71C6.25 17.52 6.09 17.32 5.94 17.1C5.79 16.87 5.67 16.64 5.57 16.39C5.47 16.14 5.39 15.89 5.34 15.63C5.28 15.37 5.26 15.1 5.26 14.83L5.26 9.33C5.26 9.06 5.28 8.8 5.34 8.54C5.39 8.28 5.47 8.02 5.57 7.77C5.67 7.53 5.79 7.29 5.94 7.07C6.09 6.85 6.25 6.64 6.44 6.45C6.63 6.26 6.83 6.09 7.05 5.95C7.27 5.8 7.51 5.67 7.75 5.57C8 5.47 8.25 5.39 8.51 5.34C8.77 5.29 9.03 5.26 9.3 5.26L14.75 5.26C15.01 5.26 15.28 5.29 15.54 5.34C15.8 5.39 16.05 5.47 16.29 5.57C16.54 5.67 16.77 5.8 16.99 5.95C17.21 6.09 17.41 6.26 17.6 6.45C17.79 6.64 17.96 6.85 18.1 7.07C18.25 7.29 18.37 7.53 18.48 7.77C18.58 8.02 18.65 8.28 18.71 8.54C18.76 8.8 18.78 9.06 18.78 9.33L18.78 14.83C18.78 15.1 18.76 15.37 18.71 15.63C18.65 15.89 18.58 16.14 18.48 16.39C18.37 16.64 18.25 16.87 18.1 17.1C17.96 17.32 17.79 17.52 17.6 17.71C17.41 17.9 17.21 18.07 16.99 18.22C16.77 18.37 16.54 18.49 16.29 18.6C16.05 18.7 15.8 18.78 15.54 18.83C15.28 18.88 15.01 18.91 14.75 18.91ZM9.3 6.86C9.13 6.86 8.97 6.87 8.82 6.91C8.66 6.94 8.51 6.98 8.36 7.05C8.21 7.11 8.07 7.18 7.93 7.28C7.8 7.37 7.68 7.47 7.56 7.58C7.45 7.7 7.35 7.82 7.26 7.96C7.17 8.09 7.09 8.24 7.03 8.38C6.97 8.54 6.92 8.69 6.89 8.85C6.86 9.01 6.84 9.17 6.84 9.33L6.84 14.83C6.84 15 6.86 15.16 6.89 15.32C6.92 15.48 6.97 15.63 7.03 15.78C7.09 15.93 7.17 16.07 7.26 16.21C7.35 16.34 7.45 16.47 7.56 16.58C7.68 16.7 7.8 16.8 7.93 16.89C8.07 16.98 8.21 17.06 8.36 17.12C8.51 17.18 8.66 17.23 8.82 17.26C8.97 17.29 9.13 17.31 9.3 17.31L14.75 17.31C14.91 17.31 15.07 17.29 15.23 17.26C15.38 17.23 15.54 17.18 15.69 17.12C15.83 17.06 15.98 16.98 16.11 16.89C16.24 16.8 16.37 16.7 16.48 16.58C16.59 16.47 16.7 16.34 16.79 16.21C16.87 16.07 16.95 15.93 17.01 15.78C17.07 15.63 17.12 15.48 17.15 15.32C17.18 15.16 17.2 15 17.2 14.83L17.2 9.33C17.2 9.17 17.18 9.01 17.15 8.85C17.12 8.69 17.07 8.54 17.01 8.38C16.95 8.24 16.87 8.09 16.79 7.96C16.7 7.82 16.59 7.7 16.48 7.58C16.37 7.47 16.24 7.37 16.11 7.28C15.98 7.19 15.83 7.11 15.69 7.05C15.54 6.98 15.38 6.94 15.23 6.91C15.07 6.87 14.91 6.86 14.75 6.86L9.3 6.86Z"
fill="currentColor" fill-opacity="1.000000" fill-rule="nonzero"></path>
</g>
</svg></div>
</div>
</div>
<div style="flex: 1 1 0%;"></div>
</div>
</div>
</div>
</div>
<div class="a85a674a" v-if="!showList">
<div class="c7e7df4d" style="align-items: center;">
<img src="@/assets/ai.png" alt="logo" style="width: 200px;">
</div>
<div class="a8d0e1d3" style="color: #A1A1A1;">我可以帮你写代码读文件写作各种创意内容请把你的任务交给我吧~</div>
</div>
<div v-if="false" class="e886deb9">
<div class="e214291b"><svg width="18" height="18" viewBox="0 0 18 18" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
d="M5.856 17.121a.979.979 0 0 1-.327-.06.839.839 0 0 1-.283-.177.739.739 0 0 1-.187-.255.724.724 0 0 1-.07-.303l-.02-1.609a4.663 4.663 0 0 1-1.446-.455 4.252 4.252 0 0 1-.637-.401c-.199-.146-.385-.31-.553-.492a4.442 4.442 0 0 1-.45-.577 4.303 4.303 0 0 1-.327-.637 3.823 3.823 0 0 1-.206-.686 3.729 3.729 0 0 1-.064-.704V6.478c0-.261.025-.516.077-.771a4.43 4.43 0 0 1 .244-.747 4.062 4.062 0 0 1 .932-1.28c.2-.183.418-.347.65-.493.23-.145.482-.267.739-.364a4.21 4.21 0 0 1 .81-.225c.27-.054.553-.078.835-.078H8.55c.103 0 .2.018.29.054a.7.7 0 0 1 .411.376.667.667 0 0 1-.161.766.736.736 0 0 1-.25.151.764.764 0 0 1-.29.055H5.573c-.186 0-.366.012-.54.049-.18.03-.353.079-.52.145-.52.145-.167.061-.328.14-.482.267-.739.364a4.21 4.21 0 0 1 .81-.225c.27-.054.553-.078.835-.078H8.55c.103 0 .2.018.29.054a.7.7 0 0 1 .411.376.667.667 0 0 1-.161.766.736.736 0 0 1-.25.151.764.764 0 0 1-.29.055H5.573c-.186 0-.366.012-.54.049-.18.03-.353.079-.52.145-.52.145-.167.061-.328.14-.482.267-.148.091-.29.2-.418.316a2.897 2.897 0 0 0-.347.388c-.097.14-.187.286-.257.444a2.473 2.473 0 0 0-.206.977v4.287c0 .17.013.333.051.503a2.549 2.549 0 0 0 .772 1.33 2.721 2.721 0 0 0 .913.559c.167.066.347.115.527.152.18.03.36.048.546.048a.904.904 0 0 1 .61.23.848.848 0 0 1 .194.262.84.84 0 0 1 .07.303l.007.99 1.915-1.293a2.877 2.877 0 0 1 1.64-.492h2.372c.186 0 .366-.018.54-.048.18-.03.353-.08.52-.146.168-.067.329-.146.483-.237.148-.091.29-.2.418-.316.128-.121.244-.249.347-.388a2.8 2.8 0 0 0 .257-.444 2.47 2.47 0 0 0 .206-.977V8.585a.646.646 0 0 1 .225-.492.679.679 0 0 1 .244-.152.814.814 0 0 1 .585 0c.09.03.174.085.244.244.244.244.244.244.244.244.244.152a.657.657 0 0 1 .225.492V10.8c0 .261-.032.516-.083.771a4.192 4.192 0 0 1-.245.74c-.109.244-.244.468-.398.687a3.735 3.735 0 0 1-.534.6c-.2.183-.418.347-.65.493a4.134 4.134 0 0 1-.738.364 4.7 4.7 0 0 1-.81.225c-.27.054-.553.079-.836.079h-1.877c-.604 0-1.144.164-1.633.491l-2.54 1.713a.913.913 0 0 1-.514.157z"
fill="currentColor"></path>
<path
d="M15.866 4.125h-4.174c-.41 0-.741.313-.741.7 0 .387.332.741.7h4.174c.41 0 .742-.313.742-.7 0-.387-.332-.7-.742-.7z"
fill="currentColor"></path>
<path
d="M14.537 2.932c0-.396-.34-.717-.759-.717s-.758.32-.758.717v3.786c0 .396.34.717.758.717.717.717.42 0 .76-.321.76-.717V2.932z"
fill="currentColor"></path>
</svg><span>开启新对话</span></div>
</div>
<div class="cbcaa82c" :style="{ bottom: getBottomDistance }">
<div class="aaff8b8f">
<div class="cefa5c26">
<div class="dd442025 b699646e" @click="focusTextarea">
<div class="fad49dec">
<textarea v-model="message" id="chat-input" class="c92459f0" placeholder="有问题,尽管问内容由 AI 生成,请仔细甄别"
rows="2" @keyup.enter.prevent="handleEnterPress" ref="textareaRef"
maxlength="200"></textarea>
<div class="b13855df">
</div>
</div>
<div class="ec4f5d61">
<div class="bf38813a">
<div @click="MesdsetQuestionStorp" v-if="!chatHdEnd" role="button" aria-disabled="false"
class="f6d670">
<div class="f286936b">
<div class="be24146b"></div>
</div>
</div>
<div @click="MesdsetQuestion" v-if="chatHdEnd" role="button" aria-disabled="false"
class="f6d670">
<div class="f286936b">
<div class="ds-icon" style="font-size: 28px; width: 28px; height: 28px;background-color:#4d6bfe;border-radius: 50% ;"><svg t="1741340438740" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3615" width="200" height="200"><path d="M512.877641 511.997001m-301.216175 301.216175a425.984 425.984 0 1 0 602.43235-602.43235 425.984 425.984 0 1 0-602.43235 602.43235Z" fill="#4d6bfe" p-id="3616" data-spm-anchor-id="a313x.search_index.0.i0.f9d53a81k9ICPM" class="selected"></path><path d="M266.24 427.7248l422.5024-103.5776a24.9856 24.9856 0 0 1 28.4672 34.9696l-188.2624 395.1616a24.9344 24.9344 0 0 1-46.08-3.072l-47.9744-149.4016a24.7808 24.7808 0 0 1 5.12-24.3712L522.24 486.4a6.6048 6.6048 0 0 0-8.192-10.24l-109.0048 63.6416a24.9856 24.9856 0 0 1-24.6272 0.3072L260.2496 473.8048a24.9856 24.9856 0 0 1 5.9904-46.08z" fill="#FFFFFF" p-id="3617"></path></svg></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div v-if="!showList" class="fcaa63f8" style="margin-top:30px;font-size: 16px;font-weight: 600;color: #999999;">
<div style="margin-bottom: 20px;text-align: center;">支持单位</div>
<div class="support-units">
<div class="support-item">
<img src="@/assets/icon1.png" class="support-icon" />
<a target="_blank" href="https://zwfw.ly.gov.cn/zwdt/lyzwdt/pages/index/index">
洛阳市行政审批和政务信息管理局
</a>
</div>
<div class="support-item" >
<img src="@/assets/icon1.png" class="support-icon" />
<a target="_blank" href="https://zwfw.ly.gov.cn/zwdt/lyzwdt/pages/index/index">
洛龙区人民政府
</a>
</div>
<div class="support-item">
<img src="@/assets/icon2.png" class="support-icon" />
<a target="_blank" href="https://www.lygsjt.com/">
洛阳国晟投资控股集团有限公司
</a>
</div>
<div class="support-item">
<img src="@/assets/icon3.png" class="support-icon" />
<a target="_blank" href="http://www.lyhygysy.com/">
洛阳弘义公用事业投资发展集团有限公司
</a>
</div>
<div class="support-item">
<img src="@/assets/icon4.png" class="support-icon" />
<a target="_blank" href="http://www.lyzhcs.com/">
洛阳弘义智慧城市建设服务有限公司
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { getQuestion, setQuestion } from "@/api/index";
import "highlight.js/styles/monokai-sublime.css";
import { marked } from 'marked';
import { computed, nextTick, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
const Nevkey = ref('');
const showList = ref(false);
const message = ref('');
const paramMsg = ref([]);
//分页
const page = reactive({ page: 1, limit: 1 });
//记录已处理的数据ID避免重复
const processedIds = ref(new Set());
const chatContainerRef = ref(null);
// 添加用户是否手动滚动的标志
const userScrolled = ref(false);
const chatHdEnd = ref(true);
// 修改滚动到底部的函数
const scrollToBottom = async () => {
await nextTick();
setTimeout(() => {
const container = chatContainerRef.value;
// 只有当用户没有手动滚动或者是新消息时才自动滚动到底部
if (container && (!userScrolled.value || chatHdEnd.value)) {
container.scrollTop = container.scrollHeight;
}
}, 100);
};
const handleScroll = (event: WheelEvent) => {
const container = event.currentTarget as HTMLElement;
const isAtBottom = Math.abs(container.scrollHeight - container.scrollTop - container.clientHeight) < 50;
console.log(container.scrollHeight - container.scrollTop - container.clientHeight);
// 如果不在底部,说明用户手动滚动了
if (!isAtBottom) {
userScrolled.value = true;
} else {
userScrolled.value = false;
}
};
onMounted(() => {
Nevkey.value = Date.now().toString();
})
//查询超时次数
const emptyCount = ref(0);
//提问回答列表
const getQuestionList = () => {
if (storp.value == true) {
storp.value = false;
chatHdEnd.value = true;
return;
}
const index = paramMsg.value.length - 1;
if (paramMsg.value[index].role != 'assistant') {
paramMsg.value.push({ role: 'assistant', sk: '', content: '', skLong: false, msgCode: 1,emptyShow:false });
}
if (paramMsg.value[index].msgCode == 0) {
storp.value = false;
chatHdEnd.value = true;
return;
}
getQuestion({ 'key': Nevkey.value, 'page': page.page, 'limit': page.limit }).then(res => {
if (res.code == 1) {
// 检查是否为空数组
if (res.data.list.length === 0) {
emptyCount.value++;
// 如果空数组计数达到30次结束递归
if (emptyCount.value >= 100) {
const lIndex = paramMsg.value.length - 1;
paramMsg.value[lIndex].content = marked(paramMsg.value[lIndex].content);
paramMsg.value[lIndex].skLong = false;
chatHdEnd.value = true;
paramMsg.value[lIndex].emptyShow = true;
// 重置计数器
emptyCount.value = 0;
return;
}
// 继续轮询
getQuestionList();
return;
}
// 如果收到非空数据,重置计数器
emptyCount.value = 0;
// ... 原有的数据处理逻辑 ...
for (let i = 0; i < res.data.list.length; i++) {
const item = res.data.list[i];
if (!processedIds.value.has(item.id)) {
processedIds.value.add(item.id);
const lastIndex = paramMsg.value.length - 1;
if (item.reasoning == 1) {
paramMsg.value[lastIndex].skLong = true;
paramMsg.value[lastIndex].sk += item.content;
} else {
paramMsg.value[lastIndex].skLong = false;
paramMsg.value[lastIndex].content += item.content;
}
}
if (item.usage_json.length > 0 || item.usage_json.prompt_tokens) {
const lIndex = paramMsg.value.length - 1;
paramMsg.value[lIndex].content = marked(paramMsg.value[lIndex].content);
paramMsg.value[lIndex].skLong = false;
chatHdEnd.value = true;
return;
}
scrollToBottom();
}
if (res.data.list.length == page.limit) {
page.page++;
getQuestionList();
} else {
getQuestionList();
}
}
})
}
// 添加检测微信浏览器的方法
const isWeixinBrowser = computed(() => {
const ua = navigator.userAgent.toLowerCase();
return ua.indexOf('micromessenger') !== -1;
});
// 添加检测设备类型的计算属性
const isPc = computed(() => {
return window.innerWidth > 768;
});
// 计算底部距离
const getBottomDistance = computed(() => {
return showList.value ? '30px' : '0px';
});
const storp = ref(false);
// 发送问题时重置状态
const MesdsetQuestion = () => {
if (!message.value || message.value.trim() === '') return
console.log(chatHdEnd.value);
if (chatHdEnd.value == true) {
showList.value = true;
paramMsg.value.push({ role: 'user', content: message.value })
Nevkey.value = Date.now().toString();
// 重置各种状态
page.page = 1;
processedIds.value.clear();
message.value = '';
chatHdEnd.value = false;
userScrolled.value = false;
let lastElement = paramMsg.value[paramMsg.value.length - 1];
if (lastElement.role == 'assistant' && lastElement.content == '') {
paramMsg.value.pop();
}
scrollToBottom(); // 添加滚动到底部
setQuestion({ 'key': Nevkey.value, 'messages': JSON.stringify(paramMsg.value) }).then(res => {
console.log(res);
if (res.code == 0) {
const lastIndex = paramMsg.value.length - 1;
paramMsg.value[lastIndex].skLong = false;
paramMsg.value[lastIndex].msgCode = 0;
}
});
getQuestionList();
}
}
const MesdsetQuestionStorp = () => {
window.location.reload();
// storp.value = true;
// paramMsg.value = [];
// chatHdEnd.value = true;
// showList.value = false;
// const lIndex = paramMsg.value.length - 1;
// paramMsg.value[lIndex].skLong = false;
}
// 清理状态
onUnmounted(() => {
processedIds.value.clear();
page.page = 1;
});
const copy = (d) => {
navigator.clipboard.writeText(d);
//AllMessage.success('复制成功!');
}
// 添加计算属性来处理移动端高度
const getMobileHeight = computed(() => {
// 检查是否为移动设备
const isMobile = window.innerWidth <= 768;
//return isMobile ? '30%' : '60%';
return '10%';
});
// 在 script setup 部分添加处理函数
const handleEnterPress = (e: KeyboardEvent) => {
// 如果同时按下 shift 键,则不提交
if (e.shiftKey) {
return;
}
// 阻止默认的换行行为
e.preventDefault();
// 调用发送消息的方法
MesdsetQuestion();
};
// 在 script setup 中添加
const isNotEmpty = (str: string) => {
return str && str.trim().replace(/[\s\r\n\t]/g, '').length > 0;
}
// 在 script setup 部分添加:
const textareaRef = ref<HTMLTextAreaElement | null>(null);
const focusTextarea = () => {
if (textareaRef.value) {
textareaRef.value.focus();
}
};
</script>
<style src="@/assets/home.css"></style>
import "highlight.js/styles/monokai-sublime.css";
<style>
.language-markdown {
color: #000 !important;
}
.ds-markdown .ds-markdown--block {
color: #000 !important;
}
code[class*=language-],
pre[class*=language-] {
color: #000 !important;
}
.support-units {
display: flex;
flex-wrap: wrap;
gap: 15px;
max-width: 800px;
margin: 0 auto;
justify-content: center;
}
.support-item {
display: flex;
flex-direction: row;
align-items: center;
background: #ffffff;
padding: 15px;
border-radius: 5px;
width: calc(50% - 8px);
box-sizing: border-box;
text-align: left;
box-shadow: 0px 1px 10px 1px rgba(0,0,0,0.16);
}
.support-icon {
width: 40px;
height: 40px;
margin-right: 20px;
}
.support-units a {
color: #768597;
text-decoration: none;
line-height: 1.4;
font-size: 14px;
display: block;
width: 100%;
}
/* 移动端样式调整 */
@media screen and (max-width: 768px) {
.support-item {
width: calc(50% - 8px); /* 保持两列布局 */
padding: 12px;
font-size: 12px;
flex-direction: column;
text-align: center;
}
.support-icon {
width: 45px;
height: 45px;
margin-bottom: 8px;
margin-right: 0px;
}
.support-units a {
font-size: 12px;
}
}
/* 修改输入框容器的样式 */
.cbcaa82c {
position: sticky;
bottom: 0;
/* 移动端默认值 */
background: #fff;
z-index: 10;
margin-top: auto;
}
/* PC端的底部间距调整 */
@media screen and (min-width: 769px) {
.cbcaa82c {
bottom: 0px;
/* PC端的底部间距 */
}
}
/* 移动端的底部间距保持为0 */
@media screen and (max-width: 768px) {
.cbcaa82c {
bottom: 0;
}
}
/* 确保聊天内容区域可以正常滚动 */
.f6004764 {
display: flex;
flex-direction: column;
overflow-y: auto;
}
/* 聊天内容容器样式 */
.f72b0bab {
flex: 1;
overflow-y: auto;
padding-bottom: 20px;
/* 添加底部padding防止内容被输入框遮挡 */
}
/* 调整欢迎内容与顶部的距离 - 基础样式 */
.a85a674a {
padding-top: 10px;
/* 减少默认的顶部padding */
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 150px;
/* 减少最小高度 */
}
/* PC端的样式调整 */
@media screen and (min-width: 769px) {
.a85a674a {
padding-top: 5px;
/* PC端更小的顶部间距 */
min-height: 120px;
/* PC端更小的最小高度 */
}
.c7e7df4d {
margin-bottom: 12px;
/* PC端更小的底部间距 */
}
.a8d0e1d3 {
margin-top: 6px;
color: #A1A1A1;
/* PC端更小的顶部间距 */
}
}
/* 移动端的样式保持原样 */
@media screen and (max-width: 768px) {
.a85a674a {
padding-top: 20px;
min-height: 200px;
}
}
/* 调整欢迎文字的样式 */
.c7e7df4d {
margin-bottom: 16px;
/* 减少底部间距 */
font-size: 18px;
font-weight: 500;
}
.a85a674a .c7e7df4d {
margin-top: 100px;
}
/* 调整描述文字的样式 */
.a8d0e1d3 {
margin-top: 8px;
/* 减少与上方内容的间距 */
color: #A1A1A1;
}
/* ... existing code ... */
/* 确保容器有正确的滚动行为 */
.dad65929 {
overflow: auto !important;
height: 100% !important;
}
.support-units a {
text-decoration: none;
}
.fcaa63f8{
max-width: 800px;
padding-bottom: 50px;
}
.cefa5c26 .dd442025{
background: #FFFFFF;
box-shadow: 0px 2px 20px 1px rgba(0,0,0,0.13);
border-radius: 20px 20px 20px 20px;
border: 1px solid #DEDEDE;
}
</style>