feat: add /compact (#289)
Added the ability to compact. Not sure if I should switch the model over to gpt-4.1 for longer context or if keeping the current model is fine. Also I'm not sure if setting the compacted to system is best practice, would love feedback 😄 Mentioned in this issue: https://github.com/openai/codex/issues/230
This commit is contained in:
31
codex-cli/tests/terminal-chat-input-compact.test.tsx
Normal file
31
codex-cli/tests/terminal-chat-input-compact.test.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import React from "react";
|
||||
import type { ComponentProps } from "react";
|
||||
import { renderTui } from "./ui-test-helpers.js";
|
||||
import TerminalChatInput from "../src/components/chat/terminal-chat-input.js";
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
describe("TerminalChatInput compact command", () => {
|
||||
it("shows /compact hint when context is low", async () => {
|
||||
const props: ComponentProps<typeof TerminalChatInput> = {
|
||||
isNew: false,
|
||||
loading: false,
|
||||
submitInput: () => {},
|
||||
confirmationPrompt: null,
|
||||
explanation: undefined,
|
||||
submitConfirmation: () => {},
|
||||
setLastResponseId: () => {},
|
||||
setItems: () => {},
|
||||
contextLeftPercent: 10,
|
||||
openOverlay: () => {},
|
||||
openModelOverlay: () => {},
|
||||
openApprovalOverlay: () => {},
|
||||
openHelpOverlay: () => {},
|
||||
onCompact: () => {},
|
||||
interruptAgent: () => {},
|
||||
active: true,
|
||||
};
|
||||
const { lastFrameStripped } = renderTui(<TerminalChatInput {...props} />);
|
||||
const frame = lastFrameStripped();
|
||||
expect(frame).toContain("/compact");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user