Add image-designer skill, align billing to DeepSeek ×1, and enrich Plaza demo.
Introduce AI image generation with chat shortcut and agent API, improve MindSpace chat-to-page save resolution, and seed Plaza covers with production deploy scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+32
-19
@@ -507,30 +507,43 @@ export function useTKMindChat(
|
||||
setChatState('loading');
|
||||
setError(null);
|
||||
|
||||
let sessionId = readStoredSessionId(userRef.current?.id);
|
||||
let staleSession = false;
|
||||
let sessionId: string | null = null;
|
||||
let freshSession: Session | null = null;
|
||||
|
||||
if (sessionId) {
|
||||
try {
|
||||
await getSession(sessionId);
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && (err.status === 403 || err.status === 404 || err.status === 400)) {
|
||||
clearStoredSessionId(userRef.current?.id);
|
||||
sessionId = null;
|
||||
staleSession = true;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
setSessionsLoading(true);
|
||||
try {
|
||||
const items = sortAndTrim(await listSessions());
|
||||
setSessions(items);
|
||||
sessionId = items[0]?.id ?? null;
|
||||
} catch {
|
||||
// Fall back to stored session or create a new one when the list is unavailable.
|
||||
} finally {
|
||||
setSessionsLoading(false);
|
||||
}
|
||||
|
||||
if (!sessionId) {
|
||||
freshSession = await startSession();
|
||||
sessionId = freshSession.id;
|
||||
writeStoredSessionId(userRef.current?.id, sessionId);
|
||||
if (staleSession) {
|
||||
setNotice('上次会话已失效,已为你新建对话');
|
||||
let staleSession = false;
|
||||
sessionId = readStoredSessionId(userRef.current?.id);
|
||||
if (sessionId) {
|
||||
try {
|
||||
await getSession(sessionId);
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && (err.status === 403 || err.status === 404 || err.status === 400)) {
|
||||
clearStoredSessionId(userRef.current?.id);
|
||||
sessionId = null;
|
||||
staleSession = true;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!sessionId) {
|
||||
freshSession = await startSession();
|
||||
sessionId = freshSession.id;
|
||||
if (staleSession) {
|
||||
setNotice('上次会话已失效,已为你新建对话');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user