import React, { Component, useState } from 'react'
|
import { fromJS } from 'immutable'
|
import { Spin, notification, Tooltip, Input, message, Dropdown, Button, Modal } from 'antd'
|
import { LoadingOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons'
|
// import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
|
// import { dark } from 'react-syntax-highlighter/dist/esm/styles/prism'
|
import { fetchEventSource } from '@microsoft/fetch-event-source'
|
import moment from 'moment'
|
|
import Api from '@/api'
|
import Utils from '@/utils/utils.js'
|
|
import avatar from '@/assets/img/avatar.jpg'
|
import './index.scss'
|
|
const { TextArea } = Input
|
const { confirm } = Modal
|
|
let script = document.createElement('script')
|
script.src = '../marked.js'
|
document.body.appendChild(script)
|
|
const burl = window.atob('aHR0cHM6Ly9jbG91$mkZC5tazloLmNu'.replace('$mk', ''))
|
let logo = window.GLOB.doclogo || ''
|
let uavatar = sessionStorage.getItem('avatar') || avatar
|
let fullname = sessionStorage.getItem('Full_Name') || ''
|
|
const DeepSeekLogo = (props) => <span {...props} className="anticon mk-anticon-deepseek">
|
<svg viewBox="0 0 1391 1024" fill="currentColor">
|
<path d="M1361.92 83.136c-14.272-7.04-20.416 6.272-28.736 12.992-2.816 2.24-5.248 5.12-7.68 7.68-20.8 22.336-45.056 36.864-76.8 35.136-46.464-2.56-86.08 12.032-121.152 47.616-7.552-43.904-32.256-70.08-69.888-86.912-19.712-8.768-39.68-17.472-53.376-36.48-9.664-13.44-12.288-28.48-17.216-43.264-3.008-8.96-6.08-18.112-16.32-19.712-11.2-1.728-15.552 7.68-19.968 15.424-17.536 32.128-24.32 67.52-23.68 103.296 1.6 80.448 35.52 144.576 103.04 190.144 7.68 5.312 9.6 10.56 7.168 18.176-4.608 15.68-10.048 30.976-14.912 46.592-3.072 10.112-7.68 12.352-18.304 8a308.224 308.224 0 0 1-97.28-66.176c-48-46.4-91.392-97.664-145.472-137.792a655.36 655.36 0 0 0-38.528-26.432c-55.232-53.76 7.232-97.792 21.632-103.04 15.104-5.376 5.312-24.128-43.52-23.936C652.032 24.704 607.36 41.024 550.4 62.72a156.8 156.8 0 0 1-26.048 7.68 542.016 542.016 0 0 0-161.408-5.696c-105.6 11.904-189.888 61.824-251.904 147.2C36.608 314.24 19.072 430.848 40.512 552.32c22.528 128 87.808 234.048 188.16 316.992 104 85.888 223.808 128 360.512 120 82.944-4.864 175.424-16 279.68-104.32 26.368 13.056 53.888 18.24 99.712 22.272 35.2 3.328 69.184-1.792 95.424-7.232 41.216-8.704 38.4-46.848 23.424-53.888-120.576-56.32-94.208-33.408-118.272-51.84 61.376-72.768 153.792-148.224 189.952-392.768 2.816-19.392 0.384-31.552 0-47.36-0.256-9.536 1.92-13.312 12.8-14.4a231.04 231.04 0 0 0 86.592-26.56c78.272-42.88 109.696-113.024 117.184-197.184 1.088-12.928-0.256-26.24-13.76-32.96z m-681.408 757.76c-116.928-92.096-173.696-122.368-197.12-120.96-21.888 1.152-17.984 26.304-13.184 42.624 5.12 16.128 11.648 27.328 20.8 41.408 6.464 9.408 10.752 23.424-6.272 33.92-37.76 23.424-103.232-7.872-106.24-9.472-76.288-44.8-140.032-104.192-184.96-185.344-43.264-78.08-68.48-161.92-72.576-251.328-1.152-21.632 5.184-29.312 26.688-33.152a265.6 265.6 0 0 1 85.696-2.24c119.296 17.472 220.928 71.04 306.048 155.52 48.768 48.32 85.504 105.92 123.392 162.176 40.256 59.776 83.648 116.672 138.88 163.392 19.392 16.32 35.072 28.8 49.92 37.952-44.928 5.056-119.872 6.08-171.008-34.496z m56.064-361.024a17.152 17.152 0 1 1 2.752 9.6 16.896 16.896 0 0 1-2.752-9.664z m174.08 89.472a102.72 102.72 0 0 1-33.024 8.96 70.528 70.528 0 0 1-44.736-14.272c-15.296-12.8-26.176-19.968-30.848-42.496a99.264 99.264 0 0 1 0.832-32.96c4.032-18.368-0.384-30.08-13.248-40.768-10.624-8.768-23.872-11.072-38.592-11.072a31.168 31.168 0 0 1-14.272-4.416c-6.144-3.072-11.136-10.752-6.336-20.16 1.536-3.008 8.96-10.304 10.752-11.712 19.84-11.328 42.88-7.68 64.192 0.896 19.712 8.064 34.56 22.848 56 43.776 21.952 25.28 25.792 32.384 38.4 51.328 9.856 14.848 18.816 30.208 24.96 47.616 3.776 10.88-1.152 19.776-14.08 25.28z"></path>
|
</svg>
|
</span>
|
|
const DeepSeekIcon = (props) => <span {...props} className="ds-icon anticon mk-anticon-think">
|
<svg viewBox="0 0 20 20" fill="none"><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" strokeWidth=".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" strokeWidth=".2"></path></svg>
|
</span>
|
|
const NewTalk = (props) => <span {...props} className="anticon mk-anticon-new">
|
<svg viewBox="0 0 28 28" fill="none"><path d="M9.10999 27C8.92999 27 8.76001 26.96 8.60001 26.9C8.43001 26.83 8.29 26.74 8.16 26.61C8.03 26.49 7.94 26.3499 7.87 26.1899C7.79999 26.0299 7.76001 25.8599 7.76001 25.6899L7.73001 23.04C7.34001 22.98 6.95001 22.8799 6.57001 22.7599C6.19001 22.6299 5.83001 22.48 5.48001 22.29C5.13001 22.1 4.79999 21.88 4.48999 21.63C4.17999 21.39 3.89 21.1199 3.63 20.82C3.37 20.52 3.13999 20.21 2.92999 19.87C2.72999 19.53 2.56001 19.18 2.42001 18.82C2.28001 18.45 2.17001 18.07 2.10001 17.69C2.03001 17.3 2 16.92 2 16.53V9.46995C2 9.03995 2.04 8.61995 2.12 8.19995C2.21 7.77995 2.34 7.36995 2.5 6.96995C2.67 6.57995 2.88 6.19995 3.12 5.84995C3.36 5.48995 3.64001 5.15995 3.95001 4.85995C4.26001 4.55995 4.59999 4.28995 4.95999 4.04995C5.32999 3.80995 5.70999 3.60995 6.10999 3.44995C6.51999 3.27995 6.94 3.15995 7.37 3.07995C7.79999 2.98995 8.23001 2.94995 8.67001 2.94995H13.3C13.46 2.94995 13.61 2.97995 13.76 3.03995C13.9 3.09995 14.03 3.17995 14.14 3.28995C14.25 3.39995 14.33 3.51995 14.39 3.65995C14.45 3.79995 14.48 3.94995 14.48 4.09995C14.48 4.25995 14.45 4.39995 14.39 4.54995C14.33 4.68995 14.25 4.80995 14.14 4.91995C14.03 5.02995 13.9 5.10995 13.76 5.16995C13.61 5.22995 13.46 5.25995 13.3 5.25995H8.67001C8.38001 5.25995 8.09999 5.27995 7.82999 5.33995C7.54999 5.38995 7.27999 5.46995 7.01999 5.57995C6.75999 5.67995 6.50999 5.80995 6.26999 5.96995C6.03999 6.11995 5.82 6.29995 5.62 6.48995C5.42 6.68995 5.23999 6.89995 5.07999 7.12995C4.92999 7.35995 4.78999 7.59995 4.67999 7.85995C4.57999 8.10995 4.49 8.37995 4.44 8.64995C4.38 8.91995 4.35999 9.18995 4.35999 9.46995V16.53C4.35999 16.81 4.38 17.08 4.44 17.36C4.5 17.63 4.58 17.9 4.69 18.16C4.8 18.42 4.93 18.67 5.09 18.9C5.25 19.13 5.43001 19.3499 5.64001 19.5499C5.84001 19.75 6.05999 19.92 6.29999 20.08C6.53999 20.24 6.79 20.37 7.06 20.47C7.32 20.58 7.6 20.66 7.88 20.72C8.16001 20.77 8.44001 20.7999 8.73001 20.7999C8.91001 20.7999 9.08 20.83 9.25 20.9C9.41 20.97 9.55999 21.0599 9.67999 21.18C9.80999 21.3099 9.91001 21.45 9.98001 21.61C10.05 21.77 10.08 21.94 10.09 22.11L10.1 23.74L13.08 21.61C13.84 21.07 14.69 20.7999 15.63 20.7999H19.32C19.61 20.7999 19.89 20.77 20.16 20.72C20.44 20.67 20.71 20.59 20.97 20.4799C21.23 20.3699 21.48 20.24 21.72 20.09C21.95 19.94 22.17 19.76 22.37 19.57C22.57 19.3699 22.75 19.16 22.91 18.93C23.07 18.7 23.2 18.46 23.31 18.2C23.41 17.95 23.5 17.68 23.55 17.41C23.61 17.14 23.63 16.87 23.63 16.59V12.94C23.63 12.79 23.66 12.64 23.72 12.5C23.78 12.36 23.87 12.23 23.98 12.13C24.09 12.02 24.22 11.93 24.36 11.88C24.51 11.82 24.66 11.79 24.82 11.79C24.97 11.79 25.12 11.82 25.27 11.88C25.41 11.93 25.54 12.02 25.65 12.13C25.76 12.23 25.85 12.36 25.91 12.5C25.97 12.64 26 12.79 26 12.94V16.59C26 17.02 25.95 17.44 25.87 17.86C25.78 18.28 25.66 18.69 25.49 19.08C25.32 19.48 25.11 19.8499 24.87 20.2099C24.63 20.57 24.35 20.9 24.04 21.2C23.73 21.5 23.39 21.7699 23.03 22.0099C22.67 22.2499 22.28 22.45 21.88 22.61C21.47 22.77 21.06 22.9 20.63 22.9799C20.2 23.07 19.76 23.11 19.32 23.11H16.4C15.47 23.11 14.62 23.3799 13.86 23.9199L9.91 26.74C9.67 26.91 9.39999 27 9.10999 27Z" fill="currentColor"></path><path d="M24.6805 5.14453H18.1874C17.5505 5.14453 17.0342 5.66086 17.0342 6.29778C17.0342 6.9347 17.5505 7.45102 18.1874 7.45102H24.6805C25.3175 7.45102 25.8338 6.9347 25.8338 6.29778C25.8338 5.66086 25.3175 5.14453 24.6805 5.14453Z" fill="currentColor"></path><path d="M22.6137 3.1804C22.6137 2.52848 22.0852 2 21.4333 2C20.7814 2 20.2529 2.52848 20.2529 3.1804V9.4168C20.2529 10.0687 20.7814 10.5972 21.4333 10.5972C22.0852 10.5972 22.6137 10.0687 22.6137 9.4168V3.1804Z" fill="currentColor"></path></svg>
|
</span>
|
|
const MkCopy = (props) => <Tooltip placement="top" title="复制">
|
<span {...props} className="ds-icon anticon mk-anticon-copy">
|
<svg viewBox="0 0 20 20" fill="none"><defs><clipPath id="clip1248_20193"><rect width="17.052675" height="17.052441" transform="translate(1.000000 1.000000)" fill="white" fillOpacity="0"></rect></clipPath><clipPath id="clip1257_20794"><rect width="20.000000" height="20.000000" fill="white" fillOpacity="0"></rect></clipPath></defs><g clipPath="url(#clip1257_20794)"><g clipPath="url(#clip1248_20193)"><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" fillOpacity="1.000000" fillRule="evenodd"></path></g><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" fillOpacity="1.000000" fillRule="nonzero"></path></g></svg>
|
</span>
|
</Tooltip>
|
|
const MkLeft = ({ children, newContent }) => {
|
const [status, setStatus] = useState(false)
|
|
const changeStatus = () => {
|
setStatus(!status)
|
}
|
|
return (
|
<div className={'mk-left' + (status ? ' close' : '')}>
|
{!status ? <div className="logo">
|
<img src={logo} alt=""/>
|
<Tooltip placement="bottom" title="收起边栏">
|
<span className="anticon mk-anticon-close" onClick={changeStatus}>
|
<svg viewBox="0 0 30 30" fill="none"><defs><clipPath id="clip1382_20239"><rect width="30.000000" height="30.000000" fill="white" fillOpacity="0"></rect></clipPath></defs><rect width="30.000000" height="30.000000" fill="#FFFFFF" fillOpacity="0"></rect><g clipPath="url(#clip1382_20239)"><rect id="rect" x="17.420410" y="12.316406" rx="1.000947" width="5.995172" height="2.001895" transform="rotate(137.159 17.420410 12.316406)" fill="currentColor" fillOpacity="1.000000"></rect><rect id="rect" x="12.959473" y="13.728516" rx="0.995190" width="6.002943" height="1.990380" transform="rotate(40.853 12.959473 13.728516)" fill="currentColor" fillOpacity="1.000000"></rect><path id="path" d="M20.1 25.5L9.9 25.51C9.48 25.51 9.06 25.47 8.65 25.39C8.24 25.3 7.84 25.18 7.45 25.02C7.06 24.86 6.69 24.66 6.34 24.43C5.99 24.19 5.67 23.92 5.37 23.63C5.07 23.33 4.81 23 4.58 22.65C4.34 22.3 4.15 21.93 3.98 21.54C3.82 21.15 3.7 20.75 3.62 20.34C3.54 19.93 3.5 19.51 3.5 19.09L3.5 10.93C3.5 10.51 3.54 10.1 3.62 9.68C3.7 9.27 3.82 8.87 3.98 8.48C4.15 8.09 4.34 7.72 4.58 7.37C4.81 7.02 5.07 6.69 5.37 6.39C5.67 6.1 5.99 5.83 6.34 5.6C6.69 5.36 7.06 5.16 7.45 5C7.84 4.84 8.24 4.72 8.65 4.64C9.06 4.55 9.48 4.51 9.9 4.51L20.1 4.5C20.52 4.5 20.94 4.54 21.35 4.62C21.76 4.7 22.16 4.83 22.55 4.99C22.94 5.15 23.31 5.35 23.66 5.58C24 5.82 24.33 6.08 24.62 6.38C24.92 6.68 25.19 7 25.42 7.35C25.65 7.7 25.85 8.07 26.01 8.46C26.17 8.85 26.3 9.25 26.38 9.67C26.46 10.08 26.5 10.5 26.5 10.92L26.5 19.07C26.5 19.5 26.46 19.91 26.38 20.32C26.3 20.74 26.17 21.14 26.01 21.53C25.85 21.92 25.65 22.29 25.42 22.64C25.19 22.99 24.92 23.31 24.62 23.61C24.33 23.91 24 24.17 23.66 24.41C23.31 24.64 22.94 24.84 22.55 25C22.16 25.16 21.76 25.29 21.35 25.37C20.94 25.45 20.52 25.5 20.1 25.5ZM9.9 6.6C9.61 6.6 9.33 6.63 9.05 6.69C8.78 6.74 8.51 6.82 8.24 6.93C7.98 7.04 7.73 7.18 7.5 7.33C7.26 7.49 7.04 7.67 6.84 7.87C6.64 8.07 6.46 8.29 6.31 8.53C6.15 8.77 6.02 9.01 5.91 9.28C5.8 9.54 5.72 9.81 5.66 10.09C5.61 10.37 5.58 10.65 5.58 10.93L5.58 19.09C5.58 19.37 5.61 19.65 5.66 19.93C5.72 20.21 5.8 20.48 5.91 20.74C6.02 21.01 6.15 21.26 6.31 21.49C6.46 21.73 6.64 21.95 6.84 22.15C7.04 22.35 7.26 22.53 7.5 22.69C7.73 22.85 7.98 22.98 8.24 23.09C8.51 23.2 8.78 23.28 9.05 23.33C9.33 23.39 9.61 23.42 9.9 23.42L20.1 23.41C20.38 23.41 20.67 23.37 20.94 23.32C21.22 23.26 21.49 23.18 21.75 23.07C22.01 22.96 22.26 22.83 22.5 22.67C22.73 22.51 22.95 22.33 23.15 22.13C23.35 21.93 23.53 21.71 23.69 21.48C23.85 21.24 23.98 20.99 24.09 20.73C24.2 20.47 24.28 20.2 24.33 19.92C24.39 19.64 24.42 19.36 24.42 19.07L24.42 10.92C24.42 10.64 24.39 10.35 24.33 10.07C24.28 9.79 24.2 9.52 24.09 9.26C23.98 9 23.85 8.75 23.69 8.51C23.53 8.28 23.35 8.06 23.15 7.86C22.95 7.66 22.73 7.48 22.5 7.32C22.26 7.16 22.01 7.03 21.75 6.92C21.49 6.81 21.22 6.73 20.94 6.67C20.67 6.62 20.38 6.59 20.1 6.59L9.9 6.6Z" fill="currentColor" fillOpacity="1.000000" fillRule="nonzero"></path><path id="rect" d="M8.5 5.51L10.54 5.51L10.6 24.43L8.55 24.43L8.5 5.51Z" fill="currentColor" fillOpacity="1.000000" fillRule="evenodd"></path></g></svg>
|
</span>
|
</Tooltip>
|
</div> : <div className="logo-open">
|
<div className="d-l">
|
<DeepSeekLogo onClick={changeStatus}/>
|
</div>
|
<div className="d-o">
|
<Tooltip placement="top" title="打开边栏">
|
<span className="anticon mk-anticon-open" onClick={changeStatus}>
|
<svg viewBox="0 0 30 30" fill="none"><defs><clipPath id="clip1381_20236"><rect width="30.000000" height="30.000000" fill="white" fillOpacity="0"></rect></clipPath></defs><rect width="30.000000" height="30.000000" fill="#FFFFFF" fillOpacity="0"></rect><g clipPath="url(#clip1381_20236)"><rect id="rect" x="11.572754" y="17.683594" rx="1.000947" width="5.995172" height="2.001895" transform="rotate(-42.841 11.572754 17.683594)" fill="currentColor" fillOpacity="1.000000"></rect><rect id="rect" x="16.033691" y="16.271484" rx="0.995190" width="6.002943" height="1.990380" transform="rotate(-139.147 16.033691 16.271484)" fill="currentColor" fillOpacity="1.000000"></rect><path id="path" d="M20.09 25.48L9.89 25.5C9.47 25.5 9.05 25.45 8.64 25.37C8.23 25.29 7.83 25.17 7.44 25C7.05 24.84 6.68 24.64 6.33 24.41C5.98 24.18 5.66 23.91 5.36 23.61C5.07 23.31 4.8 22.99 4.57 22.64C4.34 22.29 4.14 21.92 3.98 21.53C3.82 21.14 3.69 20.74 3.61 20.32C3.53 19.91 3.49 19.49 3.49 19.07L3.49 10.92C3.49 10.5 3.53 10.08 3.61 9.67C3.69 9.25 3.82 8.85 3.98 8.46C4.14 8.07 4.34 7.7 4.57 7.35C4.8 7 5.07 6.68 5.36 6.38C5.66 6.08 5.98 5.81 6.33 5.58C6.68 5.35 7.05 5.15 7.44 4.99C7.83 4.82 8.23 4.7 8.64 4.62C9.05 4.54 9.47 4.5 9.89 4.5L20.09 4.48C20.51 4.48 20.93 4.52 21.34 4.6C21.75 4.69 22.15 4.81 22.54 4.97C22.93 5.13 23.3 5.33 23.65 5.57C24 5.8 24.32 6.06 24.62 6.36C24.92 6.66 25.18 6.98 25.41 7.33C25.65 7.69 25.84 8.06 26.01 8.45C26.17 8.84 26.29 9.24 26.37 9.65C26.45 10.06 26.49 10.48 26.5 10.91L26.5 19.06C26.49 19.48 26.45 19.89 26.37 20.31C26.29 20.72 26.17 21.12 26.01 21.51C25.84 21.9 25.65 22.27 25.41 22.62C25.18 22.97 24.92 23.3 24.62 23.6C24.32 23.89 24 24.16 23.65 24.39C23.3 24.63 22.93 24.83 22.54 24.99C22.15 25.15 21.75 25.27 21.34 25.35C20.93 25.44 20.51 25.48 20.09 25.48ZM9.89 6.59C9.61 6.59 9.32 6.62 9.05 6.67C8.77 6.73 8.5 6.81 8.24 6.92C7.98 7.03 7.73 7.16 7.49 7.32C7.26 7.48 7.04 7.66 6.84 7.86C6.64 8.06 6.46 8.28 6.3 8.51C6.14 8.75 6.01 9 5.9 9.26C5.79 9.52 5.71 9.8 5.66 10.07C5.6 10.35 5.57 10.63 5.57 10.92L5.57 19.07C5.57 19.36 5.6 19.64 5.66 19.92C5.71 20.19 5.79 20.47 5.9 20.73C6.01 20.99 6.14 21.24 6.3 21.48C6.46 21.71 6.64 21.93 6.84 22.13C7.04 22.33 7.26 22.51 7.49 22.67C7.73 22.83 7.98 22.96 8.24 23.07C8.5 23.18 8.77 23.26 9.05 23.32C9.32 23.37 9.61 23.4 9.89 23.4L20.09 23.39C20.38 23.39 20.66 23.36 20.94 23.3C21.21 23.25 21.48 23.17 21.75 23.06C22.01 22.95 22.26 22.81 22.49 22.66C22.73 22.5 22.95 22.32 23.15 22.12C23.35 21.91 23.52 21.7 23.68 21.46C23.84 21.22 23.97 20.98 24.08 20.71C24.19 20.45 24.27 20.18 24.33 19.9C24.38 19.62 24.41 19.34 24.41 19.06L24.41 10.91C24.41 10.62 24.38 10.34 24.33 10.06C24.27 9.78 24.19 9.51 24.08 9.25C23.97 8.98 23.84 8.74 23.68 8.5C23.52 8.26 23.35 8.04 23.15 7.84C22.95 7.64 22.73 7.46 22.49 7.3C22.26 7.15 22.01 7.01 21.75 6.9C21.48 6.79 21.21 6.71 20.94 6.66C20.66 6.6 20.38 6.57 20.09 6.57L9.89 6.59Z" fill="currentColor" fillOpacity="1.000000" fillRule="nonzero"></path><path id="rect" d="M8.49 5.5L10.53 5.5L10.59 24.41L8.54 24.41L8.49 5.5Z" fill="currentColor" fillOpacity="1.000000" fillRule="evenodd"></path></g></svg>
|
</span>
|
</Tooltip>
|
</div>
|
</div>}
|
<div className="new-content">
|
{!status ? <div className="wrap" onClick={newContent}>
|
<NewTalk />
|
<span>开启新对话</span>
|
</div> : <Tooltip placement="top" title="开启新对话">
|
<div className="wrap" onClick={newContent}>
|
<NewTalk />
|
</div>
|
</Tooltip>}
|
</div>
|
{children}
|
<div className="user">
|
<div className="wrap">
|
<img src={uavatar} alt=""/>
|
<span>{fullname}</span>
|
</div>
|
</div>
|
</div>
|
)
|
}
|
|
const Record = ({ item, delChat, resetTitle, selectChat }) => {
|
const [status, setStatus] = useState(false)
|
const [val, setVal] = useState('')
|
|
const reset = () => {
|
setStatus(true)
|
setVal(item.title)
|
}
|
|
const chanVal = (e) => {
|
setVal(e.target.value)
|
}
|
|
const submit = () => {
|
if (val && val !== item.title) {
|
resetTitle(item, val)
|
}
|
setStatus(false)
|
}
|
|
const del = () => {
|
confirm({
|
title: '永久删除对话',
|
content: '删除后,该对话将不可恢复。确认删除吗?',
|
okText: '删除',
|
cancelText: '取消',
|
onOk() {
|
delChat(item)
|
},
|
onCancel() {}
|
})
|
}
|
|
if (status) {
|
return (
|
<div className="item-title edit">
|
<Input value={val} autoFocus onChange={chanVal} onBlur={submit} onPressEnter={submit}/>
|
</div>
|
)
|
}
|
return (
|
<div className="item-title">
|
<div className="title" onClick={() => selectChat(item)}>{item.title}</div>
|
<Dropdown placement="bottomLeft" overlay={<div className="mk-history-dropdown-wrap">
|
<Button onClick={() => reset()}><EditOutlined/> 重命名</Button>
|
<Button onClick={() => del(item)}><DeleteOutlined/> 删除</Button>
|
</div>} trigger={['click']}>
|
<div className="ds-icon" >
|
<svg fill="none" viewBox="0 0 24 24"><path fill="currentColor" fillRule="evenodd" d="M3 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0m7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0m7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0" clipRule="evenodd"></path></svg>
|
</div>
|
</Dropdown>
|
</div>
|
)
|
}
|
|
const UserChat = ({ item, ...restProps }) => {
|
const copy = () => {
|
let oInput = document.createElement('input')
|
oInput.value = item.content
|
document.body.appendChild(oInput)
|
oInput.select()
|
document.execCommand('Copy')
|
document.body.removeChild(oInput)
|
message.success('复制成功。')
|
}
|
|
return (
|
<div className="user-wrap" {...restProps}>
|
<MkCopy onClick={copy}/>
|
<div className="content">
|
{item.content}
|
</div>
|
</div>
|
)
|
}
|
|
const DpChat = ({ item, ...restProps }) => {
|
const copy = () => {
|
let oInput = document.createElement('input')
|
oInput.value = item.oriText
|
document.body.appendChild(oInput)
|
oInput.select()
|
document.execCommand('Copy')
|
document.body.removeChild(oInput)
|
message.success('复制成功。')
|
}
|
|
return (
|
<div className="assist-wrap" {...restProps}>
|
<DeepSeekLogo/>
|
<div className="top-level">
|
<DeepSeekIcon />
|
{item.loading ? '思考中...' : '已深度思考'}
|
</div>
|
{item.loading ? <LoadingOutlined /> : null}
|
<div dangerouslySetInnerHTML={{ __html: item.content }}></div>
|
{item.oriText ? <MkCopy onClick={copy}/> : null}
|
</div>
|
)
|
}
|
|
class MkAi extends Component {
|
state = {
|
loading: true,
|
UserID: '',
|
LoginUID: '',
|
textInput: '',
|
type: 'DeepSeek-R1-Distill-Qwen-32B', // deepseek-chat deepseek-reasoner
|
currentChat: {id: '', list: [], title: ''},
|
dpChat: null,
|
chats: []
|
}
|
|
UNSAFE_componentWillMount() {
|
if (sessionStorage.getItem('UserID')) {
|
this.login()
|
}
|
}
|
|
componentDidMount() {
|
if (!sessionStorage.getItem('UserID')) {
|
this.props.history.replace('/login')
|
return
|
}
|
|
let node = document.getElementById('mk-input')
|
node && node.focus()
|
}
|
|
login = () => {
|
window.GLOB.transfer = false
|
Api.getTouristMsg('cloud').then(res => {
|
if (res.status) {
|
this.setState({
|
UserID: res.UserID,
|
LoginUID: res.LoginUID,
|
textInput: sessionStorage.getItem('deepseek_sql') || ''
|
}, () => {
|
sessionStorage.removeItem('deepseek_sql')
|
this.getList()
|
})
|
} else {
|
sessionStorage.clear()
|
this.props.history.replace('/login')
|
window.location.reload()
|
}
|
})
|
}
|
|
getList = () => {
|
const { UserID, LoginUID } = this.state
|
|
Api.genericInterface({
|
func: 's_get_deepseek_list',
|
rduri: burl + '/webapi/dostars',
|
userid: UserID,
|
LoginUID: LoginUID,
|
u_id: sessionStorage.getItem('UserID')
|
}).then(result => {
|
this.setState({loading: false})
|
|
if (!result.status) {
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
} else {
|
let chats = result.data || []
|
let _today = moment().format('YYYY-MM-DD')
|
let _yestoday = moment().subtract(1, 'days').format('YYYY-MM-DD')
|
let _sevenday = moment().subtract(7, 'days').format('YYYY-MM-DD')
|
let _thirtyday = moment().subtract(30, 'days').format('YYYY-MM-DD')
|
let last = ''
|
|
chats = chats.map(item => {
|
item.title = window.decodeURIComponent(window.atob(item.title))
|
item.date = item.createdate.substr(0, 10)
|
|
if (item.date === _today) {
|
item.date = '今天'
|
} else if (item.date === _yestoday) {
|
item.date = '昨天'
|
} else if (item.date >= _sevenday) {
|
item.date = '7天内'
|
} else if (item.date >= _thirtyday) {
|
item.date = '30天内'
|
} else {
|
item.date = item.date.substr(0, 4) + '年' + item.date.substr(5, 2) + '月' + item.date.substr(8, 2) + '日'
|
}
|
|
if (item.date === last) {
|
item.date = ''
|
} else {
|
last = item.date
|
}
|
|
return item
|
})
|
|
this.setState({
|
chats: chats
|
})
|
}
|
})
|
}
|
|
newContent = () => {
|
this.setState({textInput: '', currentChat: {id: '', list: [], title: ''}})
|
let node = document.getElementById('mk-input')
|
node && node.focus()
|
}
|
|
changeVal = (e) => {
|
this.setState({textInput: e.target.value})
|
}
|
|
selectChat = (item) => {
|
const { UserID, LoginUID } = this.state
|
|
let chat = fromJS(item).toJS()
|
chat.list = []
|
|
this.setState({currentChat: chat, loading: true})
|
|
Api.genericInterface({
|
func: 's_get_deepseek_content',
|
rduri: burl + '/webapi/dostars',
|
userid: UserID,
|
LoginUID: LoginUID,
|
ID: item.id
|
}).then(res => {
|
if (!res.status) {
|
notification.error({
|
top: 92,
|
message: res.message,
|
duration: 10
|
})
|
this.setState({loading: false})
|
} else {
|
let _chat = fromJS(chat).toJS()
|
_chat.list = res.data || []
|
_chat.list = _chat.list.map(cell => {
|
let role = cell.typechartwo === 'reply' ? 'assistant' : 'user'
|
let content = window.decodeURIComponent(window.atob(cell.content))
|
let _content = content
|
|
if (role === 'assistant') {
|
_content = this.getAssistVal(_content)
|
}
|
|
return {
|
id: cell.id,
|
content: _content,
|
oriText: content,
|
type: 'deepseek-reasoner',
|
role
|
}
|
})
|
|
this.setState({currentChat: _chat, loading: false})
|
}
|
})
|
}
|
|
// changeType = () => {
|
// const { type } = this.state
|
|
// this.setState({type: type === 'deepseek-reasoner' ? 'deepseek-chat' : 'deepseek-reasoner'})
|
// }
|
|
submit = () => {
|
const { textInput, currentChat, loading, type /*, UserID, LoginUID*/ } = this.state
|
|
let val = textInput.replace(/\t+|\v+/g, '').replace(/^\s+|\s+$/g, '')
|
|
if (!val || currentChat.loading || loading) return
|
|
let node = document.getElementById('mk-input')
|
node && node.blur()
|
|
// let isNew = false
|
const that = this
|
let chat = fromJS(currentChat).toJS()
|
|
chat.list.push({ role: 'user', content: val, id: Utils.getuuid() })
|
|
if (!chat.title) {
|
chat.title = val.substr(0, 32)
|
}
|
chat.loading = true
|
|
let reschat = { role: 'assistant', content: '', type: type, loading: true, id: Utils.getuuid() }
|
|
this.setState({textInput: '', currentChat: fromJS(chat).toJS(), dpChat: reschat})
|
|
// let list = []
|
// chat.list.forEach(item => {
|
// if (!item.loading) {
|
// list.push({
|
// role: item.role,
|
// content: item.oriText || item.content
|
// })
|
// }
|
// })
|
|
// const ctrlAbout = new AbortController()
|
// const { signal } = ctrlAbout
|
let contents = []
|
let timer = setInterval(() => {
|
if (contents.length) {
|
let _cont = contents.shift()
|
|
if (_cont === '[CLOSE]') {
|
clearInterval(timer)
|
chat.list.push(reschat)
|
that.setState({dpChat: null, currentChat: chat, loading: false})
|
} else {
|
reschat.content += _cont
|
|
if (_cont === '</think>') {
|
delete reschat.loading
|
}
|
|
that.setState({dpChat: reschat})
|
}
|
}
|
}, 30)
|
|
fetchEventSource(burl + '/chat', {
|
mode: 'cors',
|
method: 'POST',
|
headers: {
|
'Content-Type': 'application/json',
|
'Accept': 'text/event-stream'
|
},
|
body: JSON.stringify({
|
chat_session_id: chat.id || '',
|
model: type,
|
prompt: val,
|
stream: true
|
}),
|
onmessage(event) {
|
if (event.data) {
|
if (event.data === '[CLOSE]') {
|
contents.push(event.data)
|
} else {
|
let data = JSON.parse(event.data)
|
if (!chat.id && data.id) {
|
chat.id = data.id
|
}
|
contents.push(data.content)
|
}
|
}
|
},
|
onclose() {},
|
onerror(error) {
|
console.info(error)
|
}
|
})
|
|
// Api.directRequest({
|
// url: burl + '/chat/completions',
|
// method: 'post',
|
// headers: { 'Content-Type': 'application/json' },
|
// data: {
|
// model: type,
|
// messages: list,
|
// stream: false
|
// }
|
// }).then(res => {
|
// let _chat = fromJS(chat).toJS()
|
|
// delete _chat.loading
|
// _chat.list.pop()
|
|
// let _val = '服务器繁忙,请稍后再试。'
|
// let _html = _val
|
// let tokens_count = 0
|
// if (res.success && res.choices && res.choices[0]) {
|
// _val = res.choices[0].message.content
|
// _html = this.getAssistVal(_val)
|
// } else if (!res.success && res.rawStatusCode === 400 && res.message && /This\s*model's\s*maximum\s*context\s*length/.test(res.message)) {
|
// _html = `当前对话已超出${type === 'deepseek-reasoner' ? '深度思考的' : ''}最大长度限制,开启一个新对话继续思考吧~`
|
// _val = _html
|
// }
|
|
// if (res.usage && res.usage.total_tokens) {
|
// tokens_count = res.usage.total_tokens
|
// }
|
|
// _chat.list = _chat.list.map(item => {
|
// delete item.loading
|
// delete item.step
|
// return item
|
// })
|
|
// _chat.list.push({ role: 'assistant', content: _html, oriText: _val, type: type, step: true, id: Utils.getuuid() })
|
|
// this.setState({currentChat: _chat})
|
|
// Api.genericInterface({
|
// func: 's_deepseek_ai',
|
// rduri: burl + '/webapi/dostars',
|
// file_url: '',
|
// userid: UserID,
|
// LoginUID: LoginUID,
|
// u_id: sessionStorage.getItem('UserID'),
|
// content: window.btoa(window.encodeURIComponent(_val)),
|
// title: window.btoa(window.encodeURIComponent(chat.title)),
|
// data_type: 'reply',
|
// tokens_count: tokens_count,
|
// version: type,
|
// ID: chat.id
|
// }).then(r => {
|
// if (!r.status) {
|
// notification.error({
|
// top: 92,
|
// message: r.message,
|
// duration: 10
|
// })
|
// } else if (isNew) {
|
// this.getList()
|
// }
|
// })
|
// })
|
|
// Api.genericInterface({
|
// func: 's_deepseek_ai',
|
// rduri: burl + '/webapi/dostars',
|
// file_url: '',
|
// userid: UserID,
|
// LoginUID: LoginUID,
|
// u_id: sessionStorage.getItem('UserID'),
|
// content: window.btoa(window.encodeURIComponent(val)),
|
// title: window.btoa(window.encodeURIComponent(chat.title)),
|
// data_type: 'request',
|
// version: type,
|
// tokens_count: 0,
|
// ID: chat.id
|
// }).then(result => {
|
// if (!result.status) {
|
// notification.error({
|
// top: 92,
|
// message: result.message,
|
// duration: 10
|
// })
|
// }
|
// })
|
}
|
|
getAssistVal = (val) => {
|
if (!val) return ''
|
|
try {
|
// eslint-disable-next-line
|
val = marked ? marked.parse(val) : val
|
} catch(e) {
|
|
}
|
|
return val
|
}
|
|
resetTitle = (item, val) => {
|
const { UserID, LoginUID } = this.state
|
|
val = val.substr(0, 32)
|
|
this.setState({loading: true})
|
|
Api.genericInterface({
|
func: 's_deepseek_ai_up_title',
|
rduri: burl + '/webapi/dostars',
|
userid: UserID,
|
LoginUID: LoginUID,
|
title: window.btoa(window.encodeURIComponent(val)),
|
ID: item.id
|
}).then(result => {
|
this.setState({loading: false})
|
if (!result.status) {
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
} else {
|
this.getList()
|
}
|
})
|
}
|
|
delChat = (item) => {
|
const { UserID, LoginUID, currentChat } = this.state
|
|
this.setState({loading: true})
|
|
if (currentChat.id && currentChat.id === item.id) {
|
this.newContent()
|
}
|
|
Api.genericInterface({
|
func: 's_deepseek_ai_del',
|
rduri: burl + '/webapi/dostars',
|
userid: UserID,
|
LoginUID: LoginUID,
|
ID: item.id
|
}).then(result => {
|
this.setState({loading: false})
|
if (!result.status) {
|
notification.error({
|
top: 92,
|
message: result.message,
|
duration: 10
|
})
|
} else {
|
this.getList()
|
}
|
})
|
}
|
|
render () {
|
const { loading, textInput, currentChat, chats, dpChat } = this.state
|
|
let able = textInput && !/^\s+$/.test(textInput)
|
let empty = currentChat.list.length === 0
|
|
return (
|
<div className="mk-deepseek-wrap">
|
<div className="mk-deepseek-flex">
|
<MkLeft newContent={this.newContent}>
|
<div className="history-wrap mk-scrollbar">
|
{chats.map(item => {
|
return <div key={item.id} className={'item-wrap' + (currentChat.id === item.id ? ' active' : '')}>
|
{item.date ? <div className="item-date">
|
{item.date}
|
</div> : null}
|
<Record
|
item={item}
|
delChat={this.delChat}
|
selectChat={this.selectChat}
|
resetTitle={this.resetTitle}
|
/>
|
</div>
|
})}
|
</div>
|
</MkLeft>
|
{loading ? <Spin size="large" /> : null}
|
<div className="mk-right">
|
{!empty ? <div className="mk-faad">
|
<div className="title">
|
<span>{currentChat.title}</span>
|
</div>
|
</div> : null}
|
<div className="mk-ksje">
|
{empty ? <div className="tip">
|
<div className="c7e7df4d">
|
<DeepSeekLogo/>
|
我是 DeepSeek,很高兴见到你!
|
</div>
|
<div className="a8d0e1d3">我可以帮你写代码、读文件、写作各种创意内容,请把你的任务交给我吧~</div>
|
</div> : null}
|
{!empty ? <div className="chat-wrap">
|
{currentChat.list.map(item => {
|
if (item.role === 'assistant') {
|
return <DpChat key={item.id} item={item}/>
|
} else {
|
return <UserChat key={item.id} item={item}/>
|
}
|
})}
|
{dpChat ? <DpChat key='chat' item={dpChat}/> : null}
|
</div> : null}
|
{!empty ? <div className="chat-reset">
|
<div className="wrap" onClick={this.newContent}>
|
<NewTalk />
|
<span>开启新对话</span>
|
</div>
|
</div> : null}
|
<div className="input-wrap">
|
<div className="c9dd4ww">
|
<div className="dd442025">
|
<div className="fad49dec">
|
<TextArea id="mk-input" value={textInput} autoSize={{minRows: 2, maxRows: 12}} placeholder="给 DeepSeek 发送消息 " onChange={this.changeVal} onPressEnter={this.submit}/>
|
</div>
|
<div className="ec4f5d61">
|
{/* {type === 'deepseek-chat' ? <Tooltip placement="left" title="调用新模型 DeekSeek-R1,解决推理问题">
|
<div className="ds-button" onClick={this.changeType}>
|
<DeepSeekIcon/>
|
<span className="text">深度思考 (R1)</span>
|
</div>
|
</Tooltip> : <div className="ds-button active" onClick={this.changeType}>
|
<DeepSeekIcon/>
|
<span className="text">深度思考 (R1)</span>
|
</div>} */}
|
{/* <div className="ds-button">
|
<span className="ds-icon">
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none"><circle cx="10" cy="10" r="9" stroke="currentColor" strokeWidth="1.8"></circle><path d="M10 1c1.657 0 3 4.03 3 9s-1.343 9-3 9M10 19c-1.657 0-3-4.03-3-9s1.343-9 3-9M1 10h18" stroke="currentColor" strokeWidth="1.8"></path></svg>
|
</span>
|
<span className="text">联网搜索</span>
|
</div> */}
|
<div className="bf38813a">
|
{able ? <div className="ds-icon" onClick={this.submit}>
|
<svg width="14" height="16" viewBox="0 0 14 16" fill="none"><path fillRule="evenodd" clipRule="evenodd" d="M7 16c-.595 0-1.077-.462-1.077-1.032V1.032C5.923.462 6.405 0 7 0s1.077.462 1.077 1.032v13.936C8.077 15.538 7.595 16 7 16z" fill="currentColor"></path><path fillRule="evenodd" clipRule="evenodd" d="M.315 7.44a1.002 1.002 0 0 1 0-1.46L6.238.302a1.11 1.11 0 0 1 1.523 0c.421.403.421 1.057 0 1.46L1.838 7.44a1.11 1.11 0 0 1-1.523 0z" fill="currentColor"></path><path fillRule="evenodd" clipRule="evenodd" d="M13.685 7.44a1.11 1.11 0 0 1-1.523 0L6.238 1.762a1.002 1.002 0 0 1 0-1.46 1.11 1.11 0 0 1 1.523 0l5.924 5.678c.42.403.42 1.056 0 1.46z" fill="currentColor"></path></svg>
|
</div> :
|
<Tooltip placement="top" title="请输入你的问题">
|
<div className="ds-icon disabled">
|
<svg width="14" height="16" viewBox="0 0 14 16" fill="none"><path fillRule="evenodd" clipRule="evenodd" d="M7 16c-.595 0-1.077-.462-1.077-1.032V1.032C5.923.462 6.405 0 7 0s1.077.462 1.077 1.032v13.936C8.077 15.538 7.595 16 7 16z" fill="currentColor"></path><path fillRule="evenodd" clipRule="evenodd" d="M.315 7.44a1.002 1.002 0 0 1 0-1.46L6.238.302a1.11 1.11 0 0 1 1.523 0c.421.403.421 1.057 0 1.46L1.838 7.44a1.11 1.11 0 0 1-1.523 0z" fill="currentColor"></path><path fillRule="evenodd" clipRule="evenodd" d="M13.685 7.44a1.11 1.11 0 0 1-1.523 0L6.238 1.762a1.002 1.002 0 0 1 0-1.46 1.11 1.11 0 0 1 1.523 0l5.924 5.678c.42.403.42 1.056 0 1.46z" fill="currentColor"></path></svg>
|
</div>
|
</Tooltip>}
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div className={'mk-tail' + (empty ? '' : ' sticky')}>内容由 AI 生成,请仔细甄别</div>
|
</div>
|
</div>
|
</div>
|
)
|
}
|
}
|
|
export default MkAi
|