Commit 2ddd5326 by HoMeTown

feat: 增加控制台带银

parent f682c8e8
...@@ -19,12 +19,12 @@ export const MarkdownDetail: React.FC<MarkdownDetailProps> = ({ children }) => { ...@@ -19,12 +19,12 @@ export const MarkdownDetail: React.FC<MarkdownDetailProps> = ({ children }) => {
img: ({ ...data }): JSX.Element => ( img: ({ ...data }): JSX.Element => (
<PhotoProvider maskOpacity={0.1} bannerVisible={false}> <PhotoProvider maskOpacity={0.1} bannerVisible={false}>
<PhotoView {...(data as any)}> <PhotoView {...(data as any)}>
<img className="w-2/3 cursor-pointer" {...data} /> <img className="w-2/3 cursor-pointer mt-[24px] mb-[8px]" {...data} />
</PhotoView> </PhotoView>
</PhotoProvider> </PhotoProvider>
), ),
p(data): JSX.Element { p(data): JSX.Element {
return <p {...data} /> return <p className="leading-[24px]" {...data} />
}, },
ul(data): JSX.Element { ul(data): JSX.Element {
return <ul className="mb-[24px]" {...data} /> return <ul className="mb-[24px]" {...data} />
......
...@@ -4,11 +4,14 @@ import { NextUIProvider } from '@nextui-org/react' ...@@ -4,11 +4,14 @@ import { NextUIProvider } from '@nextui-org/react'
import App from './App' import App from './App'
import './styles/index.less' import './styles/index.less'
import 'react-photo-view/dist/react-photo-view.css' import 'react-photo-view/dist/react-photo-view.css'
import { printText2Console } from './utils/console'
const rootEl = document.getElementById('root') const rootEl = document.getElementById('root')
document.documentElement.classList.add('light') document.documentElement.classList.add('light')
printText2Console()
if (rootEl) { if (rootEl) {
const root = ReactDOM.createRoot(rootEl) const root = ReactDOM.createRoot(rootEl)
root.render( root.render(
......
...@@ -32,7 +32,7 @@ export const Chat: React.FC = () => { ...@@ -32,7 +32,7 @@ export const Chat: React.FC = () => {
const position = useScroll(scrollableRef) const position = useScroll(scrollableRef)
const handleSubmitQuestion = async (question: string) => { const handleSubmitQuestion = async (question: string) => {
const isNew = allItems.length === 0 const isNew = allItems.length <= 1
dispatch(setIsAsking(true)) dispatch(setIsAsking(true))
// 添加用户提问的问题 // 添加用户提问的问题
setAllItems(prevItems => [ setAllItems(prevItems => [
......
...@@ -31,7 +31,7 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ onTyping, on ...@@ -31,7 +31,7 @@ export const ChatAnswerParser: React.FC<ChatAnswerParserProps> = ({ onTyping, on
const timer = setTimeout(() => { const timer = setTimeout(() => {
setDisplayedText(formatAnswer.slice(0, currentIndex + 1)) setDisplayedText(formatAnswer.slice(0, currentIndex + 1))
setCurrentIndex(prevIndex => prevIndex + 1) setCurrentIndex(prevIndex => prevIndex + 1)
}, 100) // 调整此值以改变打字速度 }, 20) // 调整此值以改变打字速度
return () => clearTimeout(timer) return () => clearTimeout(timer)
} }
......
import { Button } from '@nextui-org/react' import { Button } from '@nextui-org/react'
import type React from 'react' import type React from 'react'
import { Image } from '@nextui-org/image' import { Image } from '@nextui-org/image'
import { AnimatePresence, motion } from 'framer-motion' import { motion } from 'framer-motion'
import { useCallback, useEffect, useState } from 'react' import { useCallback, useEffect, useState } from 'react'
import Refresh from '@/assets/svg/refresh.svg?react' import Refresh from '@/assets/svg/refresh.svg?react'
import { type WithAuthProps, withAuth } from '@/auth/withAuth' import { type WithAuthProps, withAuth } from '@/auth/withAuth'
...@@ -118,29 +118,27 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({ checkAu ...@@ -118,29 +118,27 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({ checkAu
animate="visible" animate="visible"
className="mt-[18px] flex flex-col gap-[8px] w-full" className="mt-[18px] flex flex-col gap-[8px] w-full"
> >
<AnimatePresence mode="wait"> {
{ displayedItems.map((item, index) => (
displayedItems.map((item, index) => ( <motion.li
<motion.li key={`${item}-${index}`}
key={`${item}-${index}`} custom={index}
custom={index} variants={itemVariants}
variants={itemVariants} initial="hidden"
initial="hidden" animate="visible"
animate="visible" exit="exit"
exit="exit" layout
layout className="w-full"
className="w-full" >
> <Button onClick={() => handleClick(item)} color="primary" variant="light" className="text-left bg-[#F7FCFF] w-full text-[#333] rounded-[23px] data-[hover=true]:bg-[#E5F6FF] data-[hover=true]:text-primary">
<Button onClick={() => handleClick(item)} color="primary" variant="light" className="text-left bg-[#F7FCFF] w-full text-[#333] rounded-[23px] data-[hover=true]:bg-[#E5F6FF] data-[hover=true]:text-primary"> <div className="w-full text-nowrap text-ellipsis overflow-hidden">
<div className="w-full text-nowrap text-ellipsis overflow-hidden"> <span style={{ color: dotColor }}>·</span>
<span style={{ color: dotColor }}>·</span> <span className="ml-[8px]">{item}</span>
<span className="ml-[8px]">{item}</span> </div>
</div> </Button>
</Button> </motion.li>
</motion.li> ))
)) }
}
</AnimatePresence>
</motion.ul> </motion.ul>
</div> </div>
) )
......
/* eslint-disable no-console */
export function printText2Console() {
console.log('%c 晓得.', 'color: #29B6FD; font-weight: bold; font-size: 44px; text-shadow:-1px -1px #fff,1px 1px #333;')
console.group(
'%c🌟 晓得.AI 📖 - 晓得解惑,让沟通更智能',
'background-color: #29B6FD ; color: #ffffff ; font-weight: bold ; padding: 6px 14px ; border-radius: 4px;',
)
console.log('%c🎉 知晓市场脉搏,引领行业潮流,晓得AI助手全方位为您保驾护航.', 'color: #29B6FD; font-weight: bold;')
console.groupEnd()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment