feat(app): default new chat prompt to off
This commit is contained in:
@@ -91,7 +91,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
bool _nameEdited = false;
|
||||
|
||||
/// Whether the new chat starts with the prompt below.
|
||||
bool _sendPrompt = true;
|
||||
bool _sendPrompt = false;
|
||||
|
||||
/// The remembered prompt fills in only until the operator types one.
|
||||
bool _promptEdited = false;
|
||||
@@ -170,7 +170,9 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
if (!mounted || recall != _recall) return;
|
||||
if (_promptEdited) return;
|
||||
setState(() {
|
||||
_sendPrompt = saved?.send ?? true;
|
||||
// Prompt text can be recalled, but sending it always requires an
|
||||
// explicit choice in this new-chat dialog.
|
||||
_sendPrompt = false;
|
||||
_instructions.text = saved?.text ?? chatDefaultSessionInstructions;
|
||||
});
|
||||
}
|
||||
@@ -275,6 +277,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
),
|
||||
if (_sendPrompt) ...[
|
||||
const SizedBox(height: 4),
|
||||
const Text('Pre-filled prompt (editable)'),
|
||||
if (cupertino)
|
||||
CupertinoTextField(
|
||||
key: const Key('chat-create-instructions'),
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
@@ -0,0 +1,13 @@
|
||||
# Chat creation prompt option
|
||||
|
||||
- Prompt sending now starts off, regardless of the previous choice stored for
|
||||
the current backend and directory. When enabled, the existing default careful
|
||||
coding instructions remain editable.
|
||||
- Material browser fixture evidence: `chat-prompt-create-material.png` shows
|
||||
the create dialog with the prompt switch off by default at 320 CSS px / 2x.
|
||||
- Focused widget tests cover the Material and Cupertino controls, editing a
|
||||
custom prompt, and omission of `instructions` from the off-state create
|
||||
payload.
|
||||
- The broader pre-existing `chat_sessions_probe.mjs` completed through the
|
||||
create-dialog capture but exited later at its unrelated “New” row-marker
|
||||
assertion; that probe was not treated as a full pass.
|
||||
@@ -26,6 +26,9 @@ void main() {
|
||||
await tester.pump(const Duration(milliseconds: 400));
|
||||
expect(find.text('Loading directories…'), findsOneWidget);
|
||||
|
||||
expect(find.byKey(const Key('chat-create-instructions')), findsNothing);
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.enterText(
|
||||
find.byKey(const Key('chat-create-instructions')),
|
||||
'Keep me',
|
||||
@@ -88,6 +91,9 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.textContaining('Unable to load chat options'), findsOneWidget);
|
||||
|
||||
expect(find.byKey(const Key('chat-create-instructions')), findsNothing);
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.enterText(
|
||||
find.byKey(const Key('chat-create-instructions')),
|
||||
'Keep me too',
|
||||
@@ -118,6 +124,7 @@ void main() {
|
||||
final fields =
|
||||
gateway.lastFields('chat_create')!['chat_create']! as JsonMap;
|
||||
expect(fields['directory'], '~');
|
||||
expect(fields.containsKey('instructions'), isFalse);
|
||||
});
|
||||
|
||||
testWidgets('Cupertino create dialog uses native selectors and fields', (
|
||||
@@ -135,6 +142,9 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(CupertinoAlertDialog), findsOneWidget);
|
||||
expect(find.text('Start a chat'), findsOneWidget);
|
||||
expect(find.byKey(const Key('chat-create-instructions')), findsNothing);
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.text('Where should this chat live?: Home (~) — /work'),
|
||||
findsOneWidget,
|
||||
|
||||
@@ -24,7 +24,6 @@ class _MemoryPrompts implements ChatCreatePromptStore {
|
||||
Future<ChatDraft?> _create(
|
||||
WidgetTester tester,
|
||||
_MemoryPrompts prompts, {
|
||||
bool turnOff = false,
|
||||
String? prompt,
|
||||
}) async {
|
||||
ChatDraft? sent;
|
||||
@@ -48,16 +47,16 @@ Future<ChatDraft?> _create(
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
if (prompt != null) {
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
if (prompt != null) {
|
||||
await tester.enterText(
|
||||
find.byKey(const Key('chat-create-instructions')),
|
||||
prompt,
|
||||
);
|
||||
}
|
||||
if (turnOff) {
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
await tester.ensureVisible(find.byKey(const Key('chat-create-confirm')));
|
||||
await tester.tap(find.byKey(const Key('chat-create-confirm')));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -74,7 +73,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'a custom prompt is sent and comes back for that harness and folder',
|
||||
'a custom prompt is sent, but the next chat defaults to off',
|
||||
(tester) async {
|
||||
final prompts = _MemoryPrompts();
|
||||
final first = await _create(tester, prompts, prompt: 'Review only.');
|
||||
@@ -83,15 +82,15 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
final second = await _create(tester, prompts);
|
||||
expect(second!.instructions, 'Review only.');
|
||||
expect(second!.instructions, isEmpty);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('a chat can start without a prompt, and that is remembered', (
|
||||
testWidgets('a chat starts without a prompt even after a prior choice', (
|
||||
tester,
|
||||
) async {
|
||||
final prompts = _MemoryPrompts();
|
||||
final draft = await _create(tester, prompts, turnOff: true);
|
||||
final draft = await _create(tester, prompts);
|
||||
expect(draft!.instructions, isEmpty);
|
||||
expect(prompts.saved.values.single.send, isFalse);
|
||||
|
||||
|
||||
@@ -68,6 +68,10 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.takeException(), isNull);
|
||||
await tester.ensureVisible(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.ensureVisible(find.byKey(const Key('chat-create-server-directory')));
|
||||
|
||||
await tester.tap(find.byKey(const Key('chat-create-server-directory')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -32,6 +32,8 @@ void main() {
|
||||
|
||||
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('chat-create-confirm')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -192,6 +194,8 @@ void main() {
|
||||
|
||||
await tester.tap(find.byKey(const Key('chat-new-chat-fab')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('chat-create-confirm')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user