Skip to content

Commit 542e440

Browse files
committed
feat(chat): 添加用户提问Carousel组件并支持问答流程
- 新增AskQuestionCarousel组件实现多问题轮播问答交互 - 在App组件中集成AskQuestionCarousel,条件渲染用户提问界面 - 扩展ChatProvider状态管理,新增askUserQuestions状态字段 - 更新AskUserQuestion组件,增加类型守卫及表单验证优化 - 消息组件Messages调整,支持传递tool消息的isLastMessage属性 - 新增chatService接口addSystemMessage以记录系统问答摘要 - 调整DiffPreview组件props结构,更清晰地处理输出和元数据 - 优化InputPrompt及Messages组件的样式和结构细节 - 升级项目依赖,添加typescript-eslint相关依赖和配置
1 parent 86c2e9e commit 542e440

16 files changed

Lines changed: 954 additions & 331 deletions

File tree

package-lock.json

Lines changed: 284 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vscode-ide-companion/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
"@types/react-dom": "^19.2.2",
129129
"@types/semver": "^7.7.1",
130130
"@types/vscode": "^1.85.0",
131+
"@typescript-eslint/eslint-plugin": "^8.64.0",
132+
"@typescript-eslint/parser": "^8.64.0",
131133
"@vitejs/plugin-react-swc": "^4.2.1",
132134
"@vscode/vsce": "^3.6.0",
133135
"autoprefixer": "^10.5.0",

packages/vscode-ide-companion/src/router.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,22 @@ export const appRouter = router({
248248
vscodeApi.window.showInformationMessage(input);
249249
return { ok: true };
250250
}),
251+
252+
addSystemMessage: procedure
253+
.input(
254+
z.object({
255+
content: z.string(),
256+
meta: z.record(z.string(), z.unknown()).optional(),
257+
})
258+
)
259+
.resolve(({ ctx, input }) => {
260+
const activeSessionId = ctx.sessionManager.getActiveSessionId();
261+
if (!activeSessionId) {
262+
return { ok: false, error: "No active session" };
263+
}
264+
ctx.sessionManager.addSessionSystemMessage(activeSessionId, input.content, true, input.meta);
265+
return { ok: true };
266+
}),
251267
});
252268

253269
export type AppRouter = typeof appRouter;

packages/vscode-ide-companion/src/webview/App.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,20 @@ import InputPrompt from "@/webview/components/InputPrompt";
44
import ThinkingLiveBubble from "@/webview/components/ThinkingLiveBubble";
55
import PermissionPrompt from "@/webview/components/PermissionPrompt";
66
import { useChat } from "@/webview/context/ChatProvider";
7+
import AskQuestionCarousel from "@/webview/components/AskQuestionCarousel";
78

89
export default function App() {
910
const { state, dispatch, actions } = useChat();
1011

1112
return (
12-
<div className="flex flex-col h-screen overflow-hidden">
13+
<div className="relative flex flex-col h-screen min-h-screen w-full overflow-hidden">
1314
<Header
1415
sessions={state.sessions}
1516
activeSessionId={state.activeSessionId}
1617
onSelectSession={actions.selectSession}
1718
onCreateNewSession={actions.createNewSession}
1819
/>
19-
<Messages
20-
messages={state.messages}
21-
loading={state.loading}
22-
llmStreamProgress={state.llmStreamProgress}
23-
processes={state.processes}
24-
onEditMessage={actions.editMessage}
25-
/>
20+
<Messages messages={state.messages} loading={state.loading} onEditMessage={actions.editMessage} />
2621
<PermissionPrompt
2722
askPermissions={state.askPermissions}
2823
sessionStatus={state.activeSessionStatus}
@@ -41,6 +36,12 @@ export default function App() {
4136
shouldConnect={state.lastMessageRole !== null && state.lastMessageRole !== "user"}
4237
/>
4338
)}
39+
{state.askUserQuestions && (
40+
<AskQuestionCarousel
41+
questions={state.askUserQuestions.questions}
42+
onClose={() => dispatch({ type: "SET_ASK_USER_QUESTIONS", data: null })}
43+
/>
44+
)}
4445
<InputPrompt
4546
loading={state.loading}
4647
selectedSkills={state.selectedSkills}

0 commit comments

Comments
 (0)