feat: implement UI

This commit is contained in:
Henry Li 2025-05-18 11:52:25 +08:00
parent c6bbc595c3
commit 8abfd2d9ae
4 changed files with 34 additions and 0 deletions

View File

@ -32,6 +32,9 @@ const generalFormSchema = z.object({
maxStepNum: z.number().min(1, { maxStepNum: z.number().min(1, {
message: "Max step number must be at least 1.", message: "Max step number must be at least 1.",
}), }),
maxSearchResults: z.number().min(1, {
message: "Max search results must be at least 1.",
}),
}); });
export const GeneralTab: Tab = ({ export const GeneralTab: Tab = ({
@ -143,6 +146,30 @@ export const GeneralTab: Tab = ({
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="maxSearchResults"
render={({ field }) => (
<FormItem>
<FormLabel>Max search results</FormLabel>
<FormControl>
<Input
className="w-60"
type="number"
defaultValue={field.value}
min={1}
onChange={(event) =>
field.onChange(parseInt(event.target.value || "0"))
}
/>
</FormControl>
<FormDescription>
By default, each search step has 3 results.
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
</form> </form>
</Form> </Form>
</main> </main>

View File

@ -18,6 +18,7 @@ export async function* chatStream(
auto_accepted_plan: boolean; auto_accepted_plan: boolean;
max_plan_iterations: number; max_plan_iterations: number;
max_step_num: number; max_step_num: number;
max_search_results?: number;
interrupt_feedback?: string; interrupt_feedback?: string;
enable_background_investigation: boolean; enable_background_investigation: boolean;
mcp_settings?: { mcp_settings?: {
@ -61,12 +62,14 @@ async function* chatReplayStream(
auto_accepted_plan: boolean; auto_accepted_plan: boolean;
max_plan_iterations: number; max_plan_iterations: number;
max_step_num: number; max_step_num: number;
max_search_results?: number;
interrupt_feedback?: string; interrupt_feedback?: string;
} = { } = {
thread_id: "__mock__", thread_id: "__mock__",
auto_accepted_plan: false, auto_accepted_plan: false,
max_plan_iterations: 3, max_plan_iterations: 3,
max_step_num: 1, max_step_num: 1,
max_search_results: 3,
interrupt_feedback: undefined, interrupt_feedback: undefined,
}, },
options: { abortSignal?: AbortSignal } = {}, options: { abortSignal?: AbortSignal } = {},
@ -157,6 +160,7 @@ export async function fetchReplayTitle() {
auto_accepted_plan: false, auto_accepted_plan: false,
max_plan_iterations: 3, max_plan_iterations: 3,
max_step_num: 1, max_step_num: 1,
max_search_results: 3,
}, },
{}, {},
); );

View File

@ -13,6 +13,7 @@ const DEFAULT_SETTINGS: SettingsState = {
enableBackgroundInvestigation: false, enableBackgroundInvestigation: false,
maxPlanIterations: 1, maxPlanIterations: 1,
maxStepNum: 3, maxStepNum: 3,
maxSearchResults: 3,
}, },
mcp: { mcp: {
servers: [], servers: [],
@ -25,6 +26,7 @@ export type SettingsState = {
enableBackgroundInvestigation: boolean; enableBackgroundInvestigation: boolean;
maxPlanIterations: number; maxPlanIterations: number;
maxStepNum: number; maxStepNum: number;
maxSearchResults: number;
}; };
mcp: { mcp: {
servers: MCPServerMetadata[]; servers: MCPServerMetadata[];

View File

@ -104,6 +104,7 @@ export async function sendMessage(
settings.enableBackgroundInvestigation ?? true, settings.enableBackgroundInvestigation ?? true,
max_plan_iterations: settings.maxPlanIterations, max_plan_iterations: settings.maxPlanIterations,
max_step_num: settings.maxStepNum, max_step_num: settings.maxStepNum,
max_search_results: settings.maxSearchResults,
mcp_settings: settings.mcpSettings, mcp_settings: settings.mcpSettings,
}, },
options, options,