mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-09-24 23:10:56 +08:00
fix: resolve TypeScript type errors for CI build
This commit is contained in:
@@ -703,7 +703,6 @@ export const Inputbar: React.FC<InputbarProps> = ({
|
||||
isComposing?: boolean;
|
||||
};
|
||||
if (
|
||||
e.isComposing ||
|
||||
nativeEvent.isComposing ||
|
||||
nativeEvent.key === "Process" ||
|
||||
nativeEvent.keyCode === 229
|
||||
|
||||
@@ -37,7 +37,7 @@ const {
|
||||
info: vi.fn(),
|
||||
warning: vi.fn(),
|
||||
},
|
||||
mockParseSkillSlashCommand: vi.fn(() => null),
|
||||
mockParseSkillSlashCommand: vi.fn((): { skillName: string; userInput: string } | null => null),
|
||||
mockTryExecuteSlashSkillCommand: vi.fn(async () => false),
|
||||
}));
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ function Probe({
|
||||
|
||||
describe("useTopicBranchBoard", () => {
|
||||
it("当前话题应自动为进行中", async () => {
|
||||
let snapshot: ReturnType<typeof useTopicBranchBoard> | null = null;
|
||||
let snapshot = null as ReturnType<typeof useTopicBranchBoard> | null;
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
@@ -82,12 +82,12 @@ describe("useTopicBranchBoard", () => {
|
||||
);
|
||||
});
|
||||
|
||||
const current = snapshot?.branchItems.find((item) => item.id === "topic-a");
|
||||
const current = snapshot?.branchItems.find((item: { id: string }) => item.id === "topic-a");
|
||||
expect(current?.status).toBe("in_progress");
|
||||
});
|
||||
|
||||
it("应允许手动设置分支状态", async () => {
|
||||
let snapshot: ReturnType<typeof useTopicBranchBoard> | null = null;
|
||||
let snapshot = null as ReturnType<typeof useTopicBranchBoard> | null;
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
@@ -110,7 +110,7 @@ describe("useTopicBranchBoard", () => {
|
||||
snapshot?.setTopicStatus("topic-b", "merged");
|
||||
});
|
||||
|
||||
const merged = snapshot?.branchItems.find((item) => item.id === "topic-b");
|
||||
const merged = snapshot?.branchItems.find((item: { id: string }) => item.id === "topic-b");
|
||||
expect(merged?.status).toBe("merged");
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ describe("useTopicBranchBoard", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
let snapshot: ReturnType<typeof useTopicBranchBoard> | null = null;
|
||||
let snapshot = null as ReturnType<typeof useTopicBranchBoard> | null;
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const root = createRoot(container);
|
||||
@@ -142,14 +142,14 @@ describe("useTopicBranchBoard", () => {
|
||||
);
|
||||
});
|
||||
|
||||
const current = snapshot?.branchItems.find((item) => item.id === "topic-a");
|
||||
const merged = snapshot?.branchItems.find((item) => item.id === "topic-b");
|
||||
const current = snapshot?.branchItems.find((item: { id: string }) => item.id === "topic-a");
|
||||
const merged = snapshot?.branchItems.find((item: { id: string }) => item.id === "topic-b");
|
||||
expect(current?.status).toBe("in_progress");
|
||||
expect(merged?.status).toBe("merged");
|
||||
});
|
||||
|
||||
it("外部托管模式应回调状态变更", async () => {
|
||||
let snapshot: ReturnType<typeof useTopicBranchBoard> | null = null;
|
||||
let snapshot = null as ReturnType<typeof useTopicBranchBoard> | null;
|
||||
let controlledMap: Record<string, "in_progress" | "pending" | "merged" | "candidate"> = {
|
||||
"topic-a": "in_progress",
|
||||
"topic-b": "candidate",
|
||||
|
||||
@@ -310,7 +310,7 @@ interface HandleSendObserver {
|
||||
|
||||
interface HandleSendOptions {
|
||||
skipThemeSkillPrefix?: boolean;
|
||||
purpose?: "content_review";
|
||||
purpose?: "content_review" | "text_stylize";
|
||||
observer?: HandleSendObserver;
|
||||
}
|
||||
|
||||
@@ -3690,12 +3690,17 @@ export function AgentChatPage({
|
||||
return;
|
||||
}
|
||||
|
||||
const filePath = typeof selected === "string" ? selected : selected.path;
|
||||
const filePath = selected;
|
||||
if (!filePath) {
|
||||
toast.error("未选择文件");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sessionId) {
|
||||
toast.error("会话未就绪");
|
||||
return;
|
||||
}
|
||||
|
||||
toast.info("正在上传图片...");
|
||||
|
||||
// 上传图片到会话
|
||||
@@ -3742,7 +3747,7 @@ export function AgentChatPage({
|
||||
return;
|
||||
}
|
||||
|
||||
const filePath = typeof selected === "string" ? selected : selected.path;
|
||||
const filePath = selected;
|
||||
if (!filePath) {
|
||||
toast.error("未选择文件");
|
||||
return;
|
||||
@@ -4581,14 +4586,16 @@ export function AgentChatPage({
|
||||
return;
|
||||
}
|
||||
|
||||
const fileContent = file.content ?? "";
|
||||
|
||||
setCanvasState((prev) => {
|
||||
// 音乐主题:解析歌词并更新 sections
|
||||
if (mappedTheme === "music") {
|
||||
const sections = parseLyrics(file.content);
|
||||
const sections = parseLyrics(fileContent);
|
||||
if (!prev || prev.type !== "music") {
|
||||
const musicState = createInitialMusicState();
|
||||
musicState.sections = sections;
|
||||
const titleMatch = file.content.match(/^#\s*(.+)$/m);
|
||||
const titleMatch = fileContent.match(/^#\s*(.+)$/m);
|
||||
if (titleMatch) {
|
||||
musicState.spec.title = titleMatch[1].trim();
|
||||
}
|
||||
@@ -4598,16 +4605,16 @@ export function AgentChatPage({
|
||||
}
|
||||
|
||||
if (mappedTheme === "novel") {
|
||||
return upsertNovelCanvasState(prev, file.content);
|
||||
return upsertNovelCanvasState(prev, fileContent);
|
||||
}
|
||||
|
||||
// 文档类型画布
|
||||
if (!prev || prev.type !== "document") {
|
||||
return createInitialDocumentState(file.content);
|
||||
return createInitialDocumentState(fileContent);
|
||||
}
|
||||
return {
|
||||
...prev,
|
||||
content: file.content,
|
||||
content: fileContent,
|
||||
};
|
||||
});
|
||||
// 只打开画布,不关闭文件列表(让用户自己关闭)
|
||||
@@ -5267,7 +5274,6 @@ export function AgentChatPage({
|
||||
}
|
||||
|
||||
const shouldShowCanvasLoadingState =
|
||||
renderCanvasTheme !== "general" &&
|
||||
((!canvasState &&
|
||||
(shouldBootstrapCanvasOnEntry ||
|
||||
isInitialContentLoading ||
|
||||
|
||||
@@ -103,7 +103,7 @@ export interface Message {
|
||||
/** 上下文准备轨迹(可选) */
|
||||
contextTrace?: ContextTraceStep[];
|
||||
/** 消息用途(用于跳过特定副作用) */
|
||||
purpose?: "content_review";
|
||||
purpose?: "content_review" | "text_stylize";
|
||||
}
|
||||
|
||||
export interface ChatSession {
|
||||
|
||||
@@ -223,7 +223,7 @@ const NotionEditorCore = forwardRef<NotionEditorHandle, NotionEditorProps>(
|
||||
|
||||
clearIdleCommitTimer();
|
||||
const nextHtml = markdownToHtml(content);
|
||||
editor.commands.setContent(nextHtml, false);
|
||||
editor.commands.setContent(nextHtml, { emitUpdate: false });
|
||||
lastCommittedContentRef.current = content;
|
||||
dirtyRef.current = false;
|
||||
handledExternalInsertRef.current = null;
|
||||
|
||||
@@ -616,7 +616,7 @@ export const NovelCanvas: React.FC<NovelCanvasProps> = memo(
|
||||
<NotionEditor
|
||||
key={editorKey}
|
||||
content={currentChapter.content}
|
||||
onChange={handleUpdateChapter}
|
||||
onCommit={handleUpdateChapter}
|
||||
onSave={handleToggleStatus}
|
||||
onCancel={() => {}}
|
||||
onSelectionTextChange={onSelectionTextChange}
|
||||
|
||||
@@ -92,8 +92,7 @@ export const BaseComposer: React.FC<BaseComposerProps> = ({
|
||||
isComposing?: boolean;
|
||||
};
|
||||
return Boolean(
|
||||
event.isComposing ||
|
||||
nativeEvent.isComposing ||
|
||||
nativeEvent.isComposing ||
|
||||
nativeEvent.key === "Process" ||
|
||||
nativeEvent.keyCode === 229,
|
||||
);
|
||||
|
||||
@@ -589,7 +589,7 @@ describe("useCreationDialogs", () => {
|
||||
expect(loadContents).not.toHaveBeenCalled();
|
||||
expect(onEnterWorkspace).not.toHaveBeenCalledWith("content-new", {});
|
||||
|
||||
resolveCreateContent?.({ id: "content-new" });
|
||||
(resolveCreateContent as ((value: { id: string }) => void) | null)?.({ id: "content-new" });
|
||||
await flushEffects(6);
|
||||
|
||||
expect(loadContents).toHaveBeenCalledWith("project-1");
|
||||
|
||||
@@ -64,7 +64,7 @@ describe("createConfirmationService", () => {
|
||||
}
|
||||
expect(result.decision.type).toBe("continue_history");
|
||||
expect(result.decision.initialUserPrompt).toContain("大纲");
|
||||
expect(result.decision.preferredContentId).toBe("content-2");
|
||||
expect((result.decision as Extract<typeof result.decision, { type: "continue_history" }>).preferredContentId).toBe("content-2");
|
||||
});
|
||||
|
||||
it("resolveCreateConfirmationDecision 新建时应返回 create_new", () => {
|
||||
|
||||
Reference in New Issue
Block a user