13a5e1dee0
Keep the chat and graph fixtures aligned with the app's Material-only UI by removing alternate Cupertino hosts, imports, and query-controlled rendering paths. Preserve the existing Material scenarios and document the focused probe coverage.
106 lines
2.7 KiB
Dart
106 lines
2.7 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pipelines_app/core/api_gateway.dart';
|
|
import 'package:pipelines_app/features/chat/screen.dart';
|
|
|
|
/// Browser fixture for the C2 markdown wiring: the real Chat destination and
|
|
/// the real thread render one server-shaped conversation whose assistant text
|
|
/// is formatted markdown and whose user text must stay byte-exact.
|
|
///
|
|
/// The Material host is the same fixture built with
|
|
/// `CHAT_MARKDOWN_WIRE_PROBE_STYLE`.
|
|
class _FixtureGateway implements ApiGateway {
|
|
final _frames = StreamController<JsonMap>.broadcast();
|
|
|
|
@override
|
|
Stream<JsonMap> get frames => _frames.stream;
|
|
|
|
@override
|
|
Future<JsonMap> call(String type, [JsonMap fields = const {}]) async {
|
|
switch (type) {
|
|
case 'chat_sessions':
|
|
return {
|
|
'chat_sessions': [
|
|
{
|
|
'id': 'probe-markdown',
|
|
'title': 'Markdown wire',
|
|
'directory': '/workspace/demo',
|
|
},
|
|
],
|
|
};
|
|
case 'chat_subscribe':
|
|
return {};
|
|
case 'chat_messages':
|
|
return {
|
|
'chat_history': {
|
|
'messages': [
|
|
{
|
|
'id': 'u-markdown',
|
|
'role': 'user',
|
|
'parts': [
|
|
{
|
|
'type': 'text',
|
|
'text': 'Keep **this** exactly: [link](javascript:alert).',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
'id': 'a-markdown',
|
|
'role': 'assistant',
|
|
'parts': [
|
|
{
|
|
'type': 'reasoning',
|
|
'text': 'Reasoning stays plain **text**.',
|
|
},
|
|
{'type': 'text', 'text': _answer},
|
|
],
|
|
},
|
|
],
|
|
'next_cursor': '',
|
|
'has_more': false,
|
|
},
|
|
};
|
|
}
|
|
return {};
|
|
}
|
|
}
|
|
|
|
const String _answer =
|
|
'## Quarterly status\n'
|
|
'\n'
|
|
'The **release** is ready, with `gateway` passing.\n'
|
|
'\n'
|
|
'- build verified\n'
|
|
'- review pending\n'
|
|
'\n'
|
|
'| Step | State |\n'
|
|
'| --- | --- |\n'
|
|
'| build | ok |\n'
|
|
'\n'
|
|
'```dart\n'
|
|
'final count = 3;\n'
|
|
'```\n'
|
|
'\n'
|
|
'Literal <b>markup</b> and [unsafe](javascript:alert) stay visible.';
|
|
|
|
void main() {
|
|
final screen = ChatScreen(
|
|
gateway: _FixtureGateway(),
|
|
onSessionSelected: null,
|
|
);
|
|
runApp(
|
|
MaterialApp(
|
|
theme: ThemeData(
|
|
brightness: Brightness.dark,
|
|
platform: TargetPlatform.android,
|
|
),
|
|
home: Scaffold(
|
|
appBar: AppBar(title: const Text('Chat')),
|
|
body: screen,
|
|
),
|
|
),
|
|
);
|
|
}
|