fix: 修复 showPlan 工具交互逻辑和 JWT Token 问题
- 修复 pendingQuestions 缺失时无法提交回答的问题 - 添加 fallbackTaskId 参数支持直接发送到后端 - apiClient 自动获取 JWT Token - 取消按钮改为中止对话而非发送消息
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import * as vscode from "vscode";
|
||||
import { getWebviewContent } from "./webviewContent";
|
||||
import { isTokenExpired } from "../utils/jwtUtils";
|
||||
import {
|
||||
handleUserMessage,
|
||||
insertCodeToEditor,
|
||||
@ -138,7 +139,17 @@ export class ICViewProvider implements vscode.WebviewViewProvider {
|
||||
private async checkLoginStatus(): Promise<boolean> {
|
||||
try {
|
||||
const session = await vscode.authentication.getSession("iccoder", [], { createIfNone: false });
|
||||
return !!session;
|
||||
if (!session) {
|
||||
return false;
|
||||
}
|
||||
// 检查 token 是否过期
|
||||
const expired = isTokenExpired(session.accessToken);
|
||||
// 如果已过期或无法判断(null),都认为未登录
|
||||
if (expired === true || expired === null) {
|
||||
console.log("Token 已过期或无法判断过期状态");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log("检查登录状态失败:", error);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user