feat: 编辑器实时探测并显示已关联虚拟环境

fix: 按系统 ANSI 代码页解码子进程输出,修复中文日志乱码
This commit is contained in:
2026-10-24 22:30:10 +08:00
parent 23565b40a4
commit dd7612bc74
20 changed files with 1508 additions and 48 deletions
+77
View File
@@ -52,6 +52,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/v1/python/venv": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post: operations["probe_python_venv"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/runs/{run_id}": {
parameters: {
query?: never;
@@ -273,6 +289,8 @@ export interface components {
};
/** @enum {string} */
HttpMethod: "GET" | "POST";
/** @enum {string} */
InterpreterKind: "python" | "node" | "other";
LogChunkResponse: {
complete: boolean;
content: string;
@@ -389,6 +407,32 @@ export interface components {
timeout_secs?: number;
timezone?: string;
};
/** @description 编辑器在用户填写工作目录时发起的探测请求。 */
VenvProbeRequest: {
/** @description 解释器或可执行程序,对应 `action.interpreter` */
interpreter: string;
/** @description 手动填写的虚拟环境目录,对应 `action.venv` */
venv?: string | null;
/** @description 任务工作目录,对应 `action.working_dir` */
working_dir: string;
};
VenvProbeResponse: {
/** @description 供界面展示的解释器路径;位于工作目录内时使用相对路径 */
display_path?: string | null;
interpreter_kind: components["schemas"]["InterpreterKind"];
message: string;
source?: components["schemas"]["VenvSource"] | null;
status: components["schemas"]["VenvProbeStatus"];
/** @description 虚拟环境根目录的绝对路径 */
venv_path?: string | null;
};
/** @enum {string} */
VenvProbeStatus: "linked" | "invalid" | "missing" | "not_applicable" | "incomplete";
/**
* @description 虚拟环境的来源,用于在界面上说明"为什么"关联到了这个环境。
* @enum {string}
*/
VenvSource: "configured" | "interpreter" | "working_directory";
};
responses: never;
parameters: never;
@@ -471,6 +515,39 @@ export interface operations {
};
};
};
probe_python_venv: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["VenvProbeRequest"];
};
};
responses: {
/** @description Detected Python virtual environment */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["VenvProbeResponse"];
};
};
/** @description Invalid venv probe request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ErrorResponse"];
};
};
};
};
get_run: {
parameters: {
query?: never;