update pay promo
This commit is contained in:
13
app.py
13
app.py
@@ -10230,27 +10230,28 @@ def get_stock_quote_detail(stock_code):
|
|||||||
|
|
||||||
trade_date = row.get('TRADEDATE')
|
trade_date = row.get('TRADEDATE')
|
||||||
|
|
||||||
# 获取正确的昨收价:查询当前数据交易日之前的最后一个交易日的收盘价
|
# 获取正确的昨收价:始终用今天的日期查询今天之前最后一个交易日的收盘价
|
||||||
# 不使用 F002N,因为如果今天数据未入库,会返回昨天数据的 F002N(即前天收盘价)
|
# 不能用查询到的数据日期,因为如果今天数据未入库,查询到的是昨天数据
|
||||||
|
# 那样会导致用昨天的日期查询,得到前天的收盘价,涨跌幅计算错误
|
||||||
yesterday_close = 0
|
yesterday_close = 0
|
||||||
prev_close_query = text("""
|
prev_close_query = text("""
|
||||||
SELECT F007N as close_price
|
SELECT F007N as close_price
|
||||||
FROM ea_trade
|
FROM ea_trade
|
||||||
WHERE SECCODE = :stock_code
|
WHERE SECCODE = :stock_code
|
||||||
AND TRADEDATE < :current_trade_date
|
AND TRADEDATE < CURDATE()
|
||||||
ORDER BY TRADEDATE DESC
|
ORDER BY TRADEDATE DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
""")
|
""")
|
||||||
prev_close_result = conn.execute(prev_close_query, {
|
prev_close_result = conn.execute(prev_close_query, {
|
||||||
'stock_code': base_code,
|
'stock_code': base_code
|
||||||
'current_trade_date': trade_date
|
|
||||||
}).fetchone()
|
}).fetchone()
|
||||||
if prev_close_result:
|
if prev_close_result:
|
||||||
yesterday_close = float(prev_close_result[0]) if prev_close_result[0] else 0
|
yesterday_close = float(prev_close_result[0]) if prev_close_result[0] else 0
|
||||||
|
|
||||||
result_data['yesterday_close'] = yesterday_close
|
result_data['yesterday_close'] = yesterday_close
|
||||||
|
|
||||||
# 用当前价和昨收价重新计算涨跌幅
|
# 涨跌幅:前端会用实时价格和这个昨收价重新计算
|
||||||
|
# 这里也计算一个作为备用(当没有实时数据时使用)
|
||||||
if yesterday_close > 0:
|
if yesterday_close > 0:
|
||||||
result_data['change_percent'] = ((current_price - yesterday_close) / yesterday_close) * 100
|
result_data['change_percent'] = ((current_price - yesterday_close) / yesterday_close) * 100
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -278,14 +278,15 @@ export const MarkdownWithCharts = ({ content, variant = 'auto' }) => {
|
|||||||
{children}
|
{children}
|
||||||
</Box>
|
</Box>
|
||||||
),
|
),
|
||||||
// 表格渲染
|
// 表格渲染 - 提高深色模式下的对比度
|
||||||
table: ({ children }) => (
|
table: ({ children }) => (
|
||||||
<TableContainer
|
<TableContainer
|
||||||
mb={4}
|
mb={4}
|
||||||
borderRadius="md"
|
borderRadius="md"
|
||||||
border="1px solid"
|
border="1px solid"
|
||||||
borderColor={isDark ? 'rgba(255, 255, 255, 0.1)' : 'gray.200'}
|
borderColor={isDark ? 'rgba(255, 255, 255, 0.2)' : 'gray.200'}
|
||||||
overflowX="auto"
|
overflowX="auto"
|
||||||
|
bg={isDark ? 'rgba(0, 0, 0, 0.3)' : 'white'}
|
||||||
>
|
>
|
||||||
<Table size="sm" variant="simple">
|
<Table size="sm" variant="simple">
|
||||||
{children}
|
{children}
|
||||||
@@ -293,7 +294,7 @@ export const MarkdownWithCharts = ({ content, variant = 'auto' }) => {
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
),
|
),
|
||||||
thead: ({ children }) => (
|
thead: ({ children }) => (
|
||||||
<Thead bg={isDark ? 'rgba(255, 255, 255, 0.05)' : 'gray.50'}>
|
<Thead bg={isDark ? 'rgba(139, 92, 246, 0.15)' : 'gray.50'}>
|
||||||
{children}
|
{children}
|
||||||
</Thead>
|
</Thead>
|
||||||
),
|
),
|
||||||
@@ -301,7 +302,10 @@ export const MarkdownWithCharts = ({ content, variant = 'auto' }) => {
|
|||||||
tr: ({ children }) => (
|
tr: ({ children }) => (
|
||||||
<Tr
|
<Tr
|
||||||
_hover={{
|
_hover={{
|
||||||
bg: isDark ? 'rgba(255, 255, 255, 0.03)' : 'gray.50'
|
bg: isDark ? 'rgba(255, 255, 255, 0.08)' : 'gray.50'
|
||||||
|
}}
|
||||||
|
_odd={{
|
||||||
|
bg: isDark ? 'rgba(255, 255, 255, 0.02)' : 'transparent'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
@@ -310,9 +314,12 @@ export const MarkdownWithCharts = ({ content, variant = 'auto' }) => {
|
|||||||
th: ({ children }) => (
|
th: ({ children }) => (
|
||||||
<Th
|
<Th
|
||||||
fontSize="xs"
|
fontSize="xs"
|
||||||
color={headingColor}
|
fontWeight="bold"
|
||||||
borderColor={isDark ? 'rgba(255, 255, 255, 0.1)' : 'gray.200'}
|
color={isDark ? 'purple.200' : headingColor}
|
||||||
py={2}
|
borderColor={isDark ? 'rgba(255, 255, 255, 0.15)' : 'gray.200'}
|
||||||
|
py={2.5}
|
||||||
|
textTransform="none"
|
||||||
|
letterSpacing="normal"
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Th>
|
</Th>
|
||||||
@@ -320,9 +327,9 @@ export const MarkdownWithCharts = ({ content, variant = 'auto' }) => {
|
|||||||
td: ({ children }) => (
|
td: ({ children }) => (
|
||||||
<Td
|
<Td
|
||||||
fontSize="sm"
|
fontSize="sm"
|
||||||
color={textColor}
|
color={isDark ? 'gray.50' : textColor}
|
||||||
borderColor={isDark ? 'rgba(255, 255, 255, 0.1)' : 'gray.200'}
|
borderColor={isDark ? 'rgba(255, 255, 255, 0.1)' : 'gray.200'}
|
||||||
py={2}
|
py={2.5}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</Td>
|
</Td>
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ const ChatArea = ({
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<motion.div
|
<motion.div
|
||||||
style={{ maxWidth: '896px', margin: '0 auto', width: '100%', padding: '16px' }}
|
style={{ maxWidth: '1200px', margin: '0 auto', width: '100%', padding: '16px 24px' }}
|
||||||
variants={animations.staggerContainer}
|
variants={animations.staggerContainer}
|
||||||
initial="initial"
|
initial="initial"
|
||||||
animate="animate"
|
animate="animate"
|
||||||
@@ -271,7 +271,7 @@ const ChatArea = ({
|
|||||||
flexShrink={0}
|
flexShrink={0}
|
||||||
boxShadow="0 -8px 32px 0 rgba(31, 38, 135, 0.37)"
|
boxShadow="0 -8px 32px 0 rgba(31, 38, 135, 0.37)"
|
||||||
>
|
>
|
||||||
<Box maxW="896px" mx="auto">
|
<Box maxW="1200px" mx="auto">
|
||||||
{/* 已上传文件预览 */}
|
{/* 已上传文件预览 */}
|
||||||
{uploadedFiles.length > 0 && (
|
{uploadedFiles.length > 0 && (
|
||||||
<HStack mb={3} flexWrap="wrap" spacing={2}>
|
<HStack mb={3} flexWrap="wrap" spacing={2}>
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ import {
|
|||||||
Flex,
|
Flex,
|
||||||
Button,
|
Button,
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { MessageSquare, Plus, Search, ChevronLeft, ChevronDown, MoreHorizontal } from 'lucide-react';
|
import { MessageSquare, Plus, Search, ChevronLeft, MoreHorizontal } from 'lucide-react';
|
||||||
import { animations } from '../../constants/animations';
|
import { animations } from '../../constants/animations';
|
||||||
import { groupSessionsByDate } from '../../utils/sessionUtils';
|
import { groupSessionsByDate } from '../../utils/sessionUtils';
|
||||||
import DateGroup from './DateGroup';
|
|
||||||
import { GLASS_BLUR } from '@/constants/glassConfig';
|
import { GLASS_BLUR } from '@/constants/glassConfig';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,14 +82,14 @@ const LeftSidebar = ({
|
|||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<motion.div
|
<motion.div
|
||||||
style={{ width: '320px', display: 'flex', flexDirection: 'column' }}
|
style={{ width: '260px', display: 'flex', flexDirection: 'column' }}
|
||||||
initial="initial"
|
initial="initial"
|
||||||
animate="animate"
|
animate="animate"
|
||||||
exit="exit"
|
exit="exit"
|
||||||
variants={animations.slideInLeft}
|
variants={animations.slideInLeft}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
w="320px"
|
w="260px"
|
||||||
h="100%"
|
h="100%"
|
||||||
display="flex"
|
display="flex"
|
||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
@@ -213,17 +212,53 @@ const LeftSidebar = ({
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* 按日期分组显示会话 */}
|
{/* 按日期分组显示会话 - 简化版 */}
|
||||||
{visibleGroups.map((group, index) => (
|
{visibleGroups.map((group, index) => (
|
||||||
<DateGroup
|
<Box key={group.dateKey} mb={3}>
|
||||||
key={group.dateKey}
|
{/* 简洁的日期标题 */}
|
||||||
label={group.label}
|
<Text
|
||||||
sessions={group.sessions}
|
fontSize="xs"
|
||||||
currentSessionId={currentSessionId}
|
fontWeight="medium"
|
||||||
onSessionSwitch={onSessionSwitch}
|
color="gray.500"
|
||||||
defaultExpanded={index < 3} // 前3个分组默认展开
|
px={2}
|
||||||
index={index}
|
mb={1.5}
|
||||||
/>
|
textTransform="uppercase"
|
||||||
|
letterSpacing="wider"
|
||||||
|
>
|
||||||
|
{group.label}
|
||||||
|
</Text>
|
||||||
|
{/* 会话列表 */}
|
||||||
|
<VStack spacing={1} align="stretch">
|
||||||
|
{group.sessions.slice(0, index === 0 ? 10 : 5).map((session) => (
|
||||||
|
<Box
|
||||||
|
key={session.session_id}
|
||||||
|
as="button"
|
||||||
|
w="100%"
|
||||||
|
px={3}
|
||||||
|
py={2}
|
||||||
|
borderRadius="lg"
|
||||||
|
textAlign="left"
|
||||||
|
bg={currentSessionId === session.session_id ? 'rgba(139, 92, 246, 0.15)' : 'transparent'}
|
||||||
|
borderWidth={currentSessionId === session.session_id ? '1px' : '0'}
|
||||||
|
borderColor="purple.400"
|
||||||
|
_hover={{
|
||||||
|
bg: currentSessionId === session.session_id ? 'rgba(139, 92, 246, 0.2)' : 'rgba(255, 255, 255, 0.05)',
|
||||||
|
}}
|
||||||
|
onClick={() => onSessionSwitch(session.session_id)}
|
||||||
|
transition="all 0.15s"
|
||||||
|
>
|
||||||
|
<Text
|
||||||
|
fontSize="sm"
|
||||||
|
color={currentSessionId === session.session_id ? 'white' : 'gray.300'}
|
||||||
|
noOfLines={1}
|
||||||
|
fontWeight={currentSessionId === session.session_id ? 'medium' : 'normal'}
|
||||||
|
>
|
||||||
|
{session.title || '新对话'}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
))}
|
||||||
|
</VStack>
|
||||||
|
</Box>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{/* 查看更多按钮 */}
|
{/* 查看更多按钮 */}
|
||||||
@@ -315,33 +350,28 @@ const LeftSidebar = ({
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{/* 用户信息卡片 */}
|
{/* 底部信息简化 */}
|
||||||
<Box p={4} borderTop="1px solid" borderColor="rgba(255, 255, 255, 0.1)">
|
<Box p={3} borderTop="1px solid" borderColor="rgba(255, 255, 255, 0.08)">
|
||||||
<HStack spacing={3}>
|
<HStack spacing={2}>
|
||||||
<Avatar
|
<Avatar
|
||||||
src={user?.avatar}
|
src={user?.avatar}
|
||||||
name={user?.nickname}
|
name={user?.nickname}
|
||||||
size="sm"
|
size="xs"
|
||||||
bgGradient="linear(to-br, blue.500, purple.600)"
|
bgGradient="linear(to-br, blue.500, purple.600)"
|
||||||
boxShadow="0 0 12px rgba(139, 92, 246, 0.4)"
|
|
||||||
/>
|
/>
|
||||||
<Box flex={1} minW={0}>
|
<Text fontSize="xs" color="gray.400" noOfLines={1} flex={1}>
|
||||||
<Text fontSize="sm" fontWeight="medium" color="gray.100" noOfLines={1}>
|
{user?.nickname || '未登录'}
|
||||||
{user?.nickname || '未登录'}
|
</Text>
|
||||||
</Text>
|
<Badge
|
||||||
<Badge
|
bg="rgba(139, 92, 246, 0.2)"
|
||||||
bgGradient="linear(to-r, blue.500, purple.500)"
|
color="purple.300"
|
||||||
color="white"
|
px={1.5}
|
||||||
px={2}
|
borderRadius="full"
|
||||||
py={0.5}
|
fontSize="10px"
|
||||||
borderRadius="full"
|
textTransform="uppercase"
|
||||||
fontSize="xs"
|
>
|
||||||
fontWeight="semibold"
|
{user?.subscription_type || 'free'}
|
||||||
textTransform="none"
|
</Badge>
|
||||||
>
|
|
||||||
{user?.subscription_type || 'free'}
|
|
||||||
</Badge>
|
|
||||||
</Box>
|
|
||||||
</HStack>
|
</HStack>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user