Skip to content

Commit 74a85e9

Browse files
committed
refactor(settings): 移动配置文件读写及默认常量至settings模块
- 将默认模型和基础URL常量移至settings模块,统一管理 - 实现用户配置和项目配置的读取、写入接口 - 提供获取用户和项目配置路径的工具函数 - 清理ui/utils中的相关冗余代码,简化代码结构 - 统一类型引用,调整session、session-types、settings和common之间的导入路径 - 移除AsciiArt模块内容,清理无用代码
1 parent 425baa3 commit 74a85e9

39 files changed

Lines changed: 346 additions & 559 deletions

Screenshot_2026-05-23_195028.png

Whitespace-only changes.

docs/issue_0522.md

Lines changed: 0 additions & 241 deletions
This file was deleted.

src/cli.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { render } from "ink";
33
import { setShellIfWindows } from "./common/shell-utils";
4-
import { checkForNpmUpdate, promptForPendingUpdate, type PackageInfo } from "./updateCheck";
4+
import { checkForNpmUpdate, promptForPendingUpdate, type PackageInfo } from "./common/updateCheck";
55
import { AppContainer } from "./ui";
66

77
const args = process.argv.slice(2);

src/common/openai-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as os from "os";
33
import * as path from "path";
44
import OpenAI from "openai";
55
import { Agent, fetch as undiciFetch } from "undici";
6-
import { resolveCurrentSettings } from "../ui";
6+
import { resolveCurrentSettings } from "../settings";
77

88
// Custom undici Agent with a 180-second keepAlive timeout. The default
99
// global fetch (undici) only keeps connections alive for 4 seconds, which
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import * as os from "os";
55
import * as path from "path";
66
import { render, type Instance } from "ink";
77
import chalk from "chalk";
8-
import { UpdatePrompt, type UpdatePromptChoice } from "./ui";
9-
import { killProcessTree } from "./common/process-tree";
8+
import { UpdatePrompt, type UpdatePromptChoice } from "../ui";
9+
import { killProcessTree } from "./process-tree";
1010

1111
export type PackageInfo = {
1212
name: string;

src/prompt.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as os from "os";
44
import * as path from "path";
55
import { fileURLToPath } from "url";
66
import ejs from "ejs";
7-
import type { SessionMessage } from "./session";
7+
import type { SessionMessage } from "./session-types";
88
import { findGitBashPath, resolveShellPath } from "./common/shell-utils";
99
import { supportsMultimodal } from "./common/model-capabilities";
1010

@@ -166,8 +166,7 @@ function getCurrentDateAndModelPrompt(model?: string): string {
166166

167167
export function getSystemPrompt(_projectRoot: string, options: PromptToolOptions = {}): string {
168168
const toolDocs = readToolDocs(getExtensionRoot(), options);
169-
const basePrompt = toolDocs ? `${SYSTEM_PROMPT_BASE}\n\n# Available Tools\n\n${toolDocs}` : SYSTEM_PROMPT_BASE;
170-
return basePrompt;
169+
return toolDocs ? `${SYSTEM_PROMPT_BASE}\n\n# Available Tools\n\n${toolDocs}` : SYSTEM_PROMPT_BASE;
171170
}
172171

173172
export function getCompactPrompt(sessionMessages: SessionMessage[]): string {

0 commit comments

Comments
 (0)