chore: sync local changes
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
81d2489649
commit
8d580ad3ab
@ -2543,9 +2543,9 @@ export function AdminSettingsClient() {
|
|||||||
</div>
|
</div>
|
||||||
{siteSettings.bannerEnabled && (
|
{siteSettings.bannerEnabled && (
|
||||||
<>
|
<>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="bannerText">横幅文字</Label>
|
<Label htmlFor="bannerText">横幅文字</Label>
|
||||||
<Input
|
<Input
|
||||||
id="bannerText"
|
id="bannerText"
|
||||||
value={siteSettings.bannerText}
|
value={siteSettings.bannerText}
|
||||||
onChange={(e) => setSiteSettings({ ...siteSettings, bannerText: e.target.value })}
|
onChange={(e) => setSiteSettings({ ...siteSettings, bannerText: e.target.value })}
|
||||||
@ -2880,11 +2880,11 @@ export function AdminSettingsClient() {
|
|||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label>视频链接 *</Label>
|
<Label>视频链接 *</Label>
|
||||||
<Input
|
<Input
|
||||||
value={tutorialVideoForm.videoUrl}
|
value={tutorialVideoForm.videoUrl}
|
||||||
onChange={(e) => setTutorialVideoForm({ ...tutorialVideoForm, videoUrl: e.target.value })}
|
onChange={(e) => setTutorialVideoForm({ ...tutorialVideoForm, videoUrl: e.target.value })}
|
||||||
placeholder="视频URL(上传后自动填充或手动输入)"
|
placeholder="视频URL(上传后自动填充或手动输入)"
|
||||||
@ -2937,7 +2937,7 @@ export function AdminSettingsClient() {
|
|||||||
</Button>
|
</Button>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label>视频描述</Label>
|
<Label>视频描述</Label>
|
||||||
@ -2984,7 +2984,7 @@ export function AdminSettingsClient() {
|
|||||||
<Button variant="outline" onClick={() => setShowTutorialVideoDialog(false)}>取消</Button>
|
<Button variant="outline" onClick={() => setShowTutorialVideoDialog(false)}>取消</Button>
|
||||||
<Button onClick={handleSaveTutorialVideo} disabled={!tutorialVideoForm.title || !tutorialVideoForm.videoUrl}>
|
<Button onClick={handleSaveTutorialVideo} disabled={!tutorialVideoForm.title || !tutorialVideoForm.videoUrl}>
|
||||||
保存
|
保存
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@ -3047,8 +3047,8 @@ export function AdminSettingsClient() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 导航链接列表 */}
|
{/* 导航链接列表 */}
|
||||||
|
|||||||
@ -79,18 +79,10 @@ export function Chat({
|
|||||||
// 最后一条已经是 AI 回复,说明生成已完成,清除 pending 状态
|
// 最后一条已经是 AI 回复,说明生成已完成,清除 pending 状态
|
||||||
console.log("[Chat] 🎉 检测到生成已完成(最后消息是 AI 回复),清除 pending 状态");
|
console.log("[Chat] 🎉 检测到生成已完成(最后消息是 AI 回复),清除 pending 状态");
|
||||||
completeGeneration();
|
completeGeneration();
|
||||||
} else if (lastMessage?.role === "user" || initialMessages.length === 0) {
|
} else if (lastMessage?.role === "user") {
|
||||||
// 最后一条是用户消息,或者消息列表为空(可能是从首页刷新)
|
// 最后一条是用户消息,可能还在生成中,或者已经完成但页面数据过期
|
||||||
// 标记已尝试刷新,然后刷新页面获取最新数据
|
// 标记已尝试刷新,然后刷新页面获取最新数据
|
||||||
hasTriedRefreshRef.current = true;
|
hasTriedRefreshRef.current = true;
|
||||||
|
|
||||||
// 🆕 如果当前在首页但有 pending generation,先尝试跳转到 /chat/${id}
|
|
||||||
if (window.location.pathname === "/" || window.location.pathname === "") {
|
|
||||||
console.log("[Chat] 🔄 检测到首页有 pending 状态,跳转到 /chat/" + id);
|
|
||||||
window.location.href = `/chat/${id}`;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("[Chat] 🔄 检测到恢复的 pending 状态,刷新页面获取最新消息...");
|
console.log("[Chat] 🔄 检测到恢复的 pending 状态,刷新页面获取最新消息...");
|
||||||
|
|
||||||
// 延迟一小段时间再刷新,避免立即刷新
|
// 延迟一小段时间再刷新,避免立即刷新
|
||||||
@ -99,7 +91,7 @@ export function Chat({
|
|||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [pendingGeneration, initialMessages, completeGeneration, router, id]);
|
}, [pendingGeneration, initialMessages, completeGeneration, router]);
|
||||||
|
|
||||||
const { mutate } = useSWRConfig();
|
const { mutate } = useSWRConfig();
|
||||||
|
|
||||||
@ -301,12 +293,6 @@ export function Chat({
|
|||||||
// 🆕 收到消息,清除持久化状态
|
// 🆕 收到消息,清除持久化状态
|
||||||
completeGeneration();
|
completeGeneration();
|
||||||
|
|
||||||
// 🆕 如果当前在首页,更新 URL 为 /chat/${id},确保刷新后不会丢失消息
|
|
||||||
if (window.location.pathname === "/" || window.location.pathname === "") {
|
|
||||||
console.log("[Chat] 更新 URL 到 /chat/" + id);
|
|
||||||
window.history.replaceState({}, "", `/chat/${id}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
setMessages((prevMessages) => {
|
setMessages((prevMessages) => {
|
||||||
if (prevMessages.some(m => m.id === messageData.id)) {
|
if (prevMessages.some(m => m.id === messageData.id)) {
|
||||||
return prevMessages;
|
return prevMessages;
|
||||||
@ -334,12 +320,6 @@ export function Chat({
|
|||||||
mutate(unstable_serialize(getChatHistoryPaginationKey));
|
mutate(unstable_serialize(getChatHistoryPaginationKey));
|
||||||
// 🆕 生成完成,清除持久化状态
|
// 🆕 生成完成,清除持久化状态
|
||||||
completeGeneration();
|
completeGeneration();
|
||||||
|
|
||||||
// 🆕 如果当前在首页,更新 URL 为 /chat/${id},确保刷新后不会丢失消息
|
|
||||||
if (window.location.pathname === "/" || window.location.pathname === "") {
|
|
||||||
console.log("[Chat] onFinish: 更新 URL 到 /chat/" + id);
|
|
||||||
window.history.replaceState({}, "", `/chat/${id}`);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
if (error instanceof ChatSDKError) {
|
if (error instanceof ChatSDKError) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user