修正部属问题

This commit is contained in:
xucheng 2026-01-13 18:01:18 +08:00
parent 4ea47541e9
commit 79827ad99d
3 changed files with 29 additions and 4 deletions

View File

@ -13,6 +13,15 @@ trap 'echo -e "${ERROR} 部署失败,请检查上方错误日志。"' ERR
echo -e "${INFO} 开始自动化部署脚本..."
# 0. 拉取最新代码
echo -e "${INFO} 0/6 拉取最新代码..."
if git pull; then
echo -e "${INFO} 代码拉取成功。"
else
echo -e "${ERROR} git pull 失败,请手动检查。"
exit 1
fi
# 1. 检查并安装系统级依赖
echo -e "${INFO} 1/6 检查并安装系统依赖..."
if command -v apt-get &> /dev/null; then

View File

@ -1,6 +1,7 @@
"use client"
import { useState, useEffect, useRef } from "react"
import { cn, generateUUID } from "@/lib/utils"
import { HeaderPortal } from "@/components/header-portal"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
@ -51,7 +52,7 @@ export function AiDiscussionView({ companyName, symbol, market }: { companyName:
const [leftInput, setLeftInput] = useState("")
const [leftLoading, setLeftLoading] = useState(false)
const [leftGoogleSearch, setLeftGoogleSearch] = useState(false)
const [leftSessionId, setLeftSessionId] = useState(crypto.randomUUID())
const [leftSessionId, setLeftSessionId] = useState(generateUUID())
// Right Chat State
const [rightRole, setRightRole] = useState("")
@ -60,7 +61,7 @@ export function AiDiscussionView({ companyName, symbol, market }: { companyName:
const [rightInput, setRightInput] = useState("")
const [rightLoading, setRightLoading] = useState(false)
const [rightGoogleSearch, setRightGoogleSearch] = useState(false)
const [rightSessionId, setRightSessionId] = useState(crypto.randomUUID())
const [rightSessionId, setRightSessionId] = useState(generateUUID())
// Load config on mount
useEffect(() => {
@ -304,12 +305,12 @@ export function AiDiscussionView({ companyName, symbol, market }: { companyName:
// Clear Handler - Regenerate Session ID
const handleClearLeft = () => {
setLeftMessages([])
setLeftSessionId(crypto.randomUUID())
setLeftSessionId(generateUUID())
}
const handleClearRight = () => {
setRightMessages([])
setRightSessionId(crypto.randomUUID())
setRightSessionId(generateUUID())
}
return (

View File

@ -4,3 +4,18 @@ import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function generateUUID(): string {
// Check if crypto.randomUUID is available (secure context)
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
return crypto.randomUUID()
}
// Fallback for non-secure contexts or older environments
// RFC4122 version 4 compliant solution
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = Math.random() * 16 | 0
const v = c === 'x' ? r : (r & 0x3 | 0x8)
return v.toString(16)
})
}