Skip to content

Commit

Permalink
🐛 fix: 修复模型展示样式错误
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Apr 22, 2024
1 parent 535000c commit 894c9de
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 54 deletions.
2 changes: 1 addition & 1 deletion src/app/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Chat = () => {
<Flexbox flex={1} style={{ overflow: 'hidden', position: 'relative' }}>
{viewerMode === true ? <AgentViewer /> : <ChatList />}
</Flexbox>
<Flexbox align={'center'} width={'100%'} className={styles.docker}>
<Flexbox align={'center'} width={'100%'} className={styles.docker} justify={'center'}>
<MessageInput className={styles.input} />
<div className={styles.alert}>请谨记:智能体所说的一切都是由 AI 生成的</div>
</Flexbox>
Expand Down
4 changes: 3 additions & 1 deletion src/app/chat/style.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { createStyles } from 'antd-style';

import { CHAT_INPUT_HEIGHT } from '@/constants/common';

export const useStyles = createStyles(({ css, token }) => ({
docker: css`
padding: ${token.paddingXS}px;
height: ${CHAT_INPUT_HEIGHT}px;
background-color: rgba(${token.colorBgLayout}, 0.8);
backdrop-filter: saturate(180%) blur(2px);
`,
Expand Down
2 changes: 2 additions & 0 deletions src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export const INITIAL_Z_INDEX = 10;
export const CHAT_TEXTAREA_MAX_HEIGHT = 570;
export const CHAT_TEXTAREA_HEIGHT = 200;

export const CHAT_INPUT_HEIGHT = 90;

export const HEADER_HEIGHT = 64;

export const DEFAULT_USER_AVATAR = '😀';
Expand Down
21 changes: 7 additions & 14 deletions src/features/Actions/PlayControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,20 @@ interface Props {
export default (props: Props) => {
const { style, className } = props;
const { styles } = useStyles();
const [isPlaying, togglePlayPause] = useDanceStore((s) => [s.isPlaying, s.togglePlayPause]);
const [isPlaying, togglePlayPause, playlist] = useDanceStore((s) => [
s.isPlaying,
s.togglePlayPause,
s.playlist,
]);

// return (
// <GradientButton
// className={classNames(isPlaying ? styles.spin : '', className)}
// glow={isPlaying}
// onClick={togglePlayPause}
// shape="circle"
// >
// <TikTokOutlined style={{ fontSize: 22 }} />
// </GradientButton>
// );

return (
return playlist.length ? (
<ActionIcon
className={classNames(isPlaying ? styles.spin : '', className)}
style={style}
onClick={togglePlayPause}
icon={Music2}
/>
);
) : null;

// return (
// <Avatar
Expand Down
2 changes: 1 addition & 1 deletion src/features/AgentViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function AgentViewer() {
<ChatDialog className={styles.dialog} />
<ToolBar className={styles.toolbar} />
{loading ? <PageLoading title={'模型加载中,请稍后...'} /> : null}
<canvas ref={canvasRef}></canvas>
<canvas ref={canvasRef} height={'100%'} width={'100%'}></canvas>
</div>
);
}
Expand Down
10 changes: 3 additions & 7 deletions src/features/AgentViewer/style.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { createStyles } from 'antd-style';

import { CHAT_INPUT_HEIGHT } from '@/constants/common';

export const useStyles = createStyles(({ css, token }) => ({
toolbar: css`
position: absolute;
Expand All @@ -17,14 +19,8 @@ export const useStyles = createStyles(({ css, token }) => ({
min-width: 480px;
`,
// controller: css`
// position: absolute;
// right: ${token.paddingMD}px;
// top: ${token.paddingMD}px;
// `,
viewer: css`
position: relative;
width: 100%;
height: 100%;
height: calc(100vh - 128px - ${CHAT_INPUT_HEIGHT}px);
`,
}));
7 changes: 6 additions & 1 deletion src/features/AudioPlayer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ function Player(props: PlayerProps) {
src={currentPlay?.audio}
/>
<div className={styles.player}>
<Avatar shape="circle" size={48} src={currentPlay?.cover} />
<Avatar
shape="circle"
size={48}
src={currentPlay?.cover}
className={isPlaying ? styles.spin : ''}
/>
<div className={styles.content}>
<Duration currentProgress={currentProgress} duration={duration} />
<div className={styles.controller}>
Expand Down
13 changes: 13 additions & 0 deletions src/features/AudioPlayer/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ const useStyles = createStyles(({ token, css }) => ({
display: flex;
align-items: center;
`,
spin: css`
@keyframes rotate-animation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
animation: rotate-animation 20s linear infinite;
`,
}));

export { useStyles };
5 changes: 3 additions & 2 deletions src/features/ChatHeader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Space } from 'antd';
import React from 'react';
import { Flexbox } from 'react-layout-kit';

import AgentMeta from '@/components/agent/AgentMeta';
import PlayControl from '@/features/Actions/PlayControl';
Expand All @@ -14,14 +15,14 @@ const Header = () => {
const [currentAgent] = useSessionStore((s) => [sessionSelectors.currentAgent(s)]);

return (
<div className={styles.header}>
<Flexbox justify={'space-between'} horizontal align={'center'} className={styles.header}>
<AgentMeta meta={currentAgent?.meta} />
<Space>
<Voice key={'voice'} />
<Video key={'video'} />
<PlayControl key="play" />
</Space>
</div>
</Flexbox>
);
};

Expand Down
9 changes: 2 additions & 7 deletions src/features/ChatHeader/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import { createStyles } from 'antd-style';

const useStyles = createStyles(({ token, css }) => ({
header: css`
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 16px 8px;
height: 64px;
padding: ${token.paddingSM}px;
border-bottom: 1px solid ${token.colorBorderSecondary};
`,
player: css`
Expand Down
2 changes: 1 addition & 1 deletion src/features/ChatInput/MessageInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const InputArea = memo((props: InputAreaProps) => {
]);

return (
<Flexbox height={'100%'} width={'100%'} horizontal gap={4} className={className} style={style}>
<Flexbox width={'100%'} horizontal gap={4} className={className} style={style}>
<Record />
<Input
width={'100%'}
Expand Down
30 changes: 17 additions & 13 deletions src/features/SessionList/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@ const Header = memo((props: HeaderProps) => {
const openPanel = useConfigStore((s) => s.openPanel);

return (
<div className={styles.header}>
<Flexbox flex={1} style={{ marginRight: 4 }}>
<SearchBar
enableShortKey
onChange={(e) => {
if (onChange) onChange(e.target.value);
}}
placeholder="搜索"
shortKey="f"
value={value}
/>
</Flexbox>
<Flexbox
justify={'space-between'}
horizontal
align={'center'}
className={styles.header}
gap={4}
>
<SearchBar
enableShortKey
onChange={(e) => {
if (onChange) onChange(e.target.value);
}}
placeholder="搜索"
shortKey="f"
value={value}
/>
<ActionIcon icon={Plus} onClick={() => openPanel('agent')} title={'创建对话'} />
</div>
</Flexbox>
);
});

Expand Down
8 changes: 2 additions & 6 deletions src/features/SessionList/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ export const useStyles = createStyles(({ css, token }) => ({
text-align: center;
`,
header: css`
display: flex;
justify-content: space-between;
width: 100%;
padding: 16px 8px;
height: 64px;
padding: ${token.paddingSM}px;
border-bottom: 1px solid ${token.colorBorderSecondary};
`,

Expand Down

0 comments on commit 894c9de

Please sign in to comment.