Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/simple_chat/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ class _ChatScreenState extends State<ChatScreen> {
void initState() {
super.initState();
final Catalog catalog = CoreCatalogItems.asCatalog();
_genUiManager = GenUiManager(catalog: catalog);
_genUiManager = GenUiManager(
catalog: catalog,
configuration: const GenUiConfiguration(
actions: ActionsConfig.createOnly(),
),
);

final systemInstruction =
'''You are a helpful assistant who chats with a user,
giving exactly one response for each user message.
Your responses should contain acknowledgment
of the user message.


IMPORTANT: When you generate UI in a response, you MUST always create
a new surface with a unique `surfaceId`. Do NOT reuse or update
existing `surfaceId`s. Each UI response must be in its own new surface.

${GenUiPromptFragments.basicChat}''';

// Create the appropriate content generator based on configuration
Expand Down
11 changes: 11 additions & 0 deletions examples/simple_chat/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Generated file. Do not edit.
//

// clang-format off

#include "generated_plugin_registrant.h"


void fl_register_plugins(FlPluginRegistry* registry) {
}
15 changes: 15 additions & 0 deletions examples/simple_chat/linux/flutter/generated_plugin_registrant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//

// clang-format off

#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_

#include <flutter_linux/flutter_linux.h>

// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);

#endif // GENERATED_PLUGIN_REGISTRANT_
23 changes: 23 additions & 0 deletions examples/simple_chat/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Generated file, do not edit.
#

list(APPEND FLUTTER_PLUGIN_LIST
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Copyright 2025 The Flutter Authors.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//
// Generated file. Do not edit.
//
Expand Down
4 changes: 0 additions & 4 deletions examples/simple_chat/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright 2025 The Flutter Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

#
# Generated file, do not edit.
#
Expand Down
11 changes: 11 additions & 0 deletions examples/travel_app/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Generated file. Do not edit.
//

// clang-format off

#include "generated_plugin_registrant.h"


void fl_register_plugins(FlPluginRegistry* registry) {
}
15 changes: 15 additions & 0 deletions examples/travel_app/linux/flutter/generated_plugin_registrant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//

// clang-format off

#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_

#include <flutter_linux/flutter_linux.h>

// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);

#endif // GENERATED_PLUGIN_REGISTRANT_
23 changes: 23 additions & 0 deletions examples/travel_app/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Generated file, do not edit.
#

list(APPEND FLUTTER_PLUGIN_LIST
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
41 changes: 17 additions & 24 deletions packages/genui/lib/src/core/ui_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ class SurfaceUpdateTool extends AiTool<JsonMap> {
required this.handleMessage,
required Catalog catalog,
required this.configuration,
required SurfaceUpdateMode updateMode,
super.name = 'surfaceUpdate',
super.description = 'Updates a surface with a new set of components.',
}) : super(
name: 'surfaceUpdate',
description: 'Updates a surface with a new set of components.',
parameters: A2uiSchemas.surfaceUpdateSchema(catalog),
parameters: A2uiSchemas.surfaceUpdateSchema(
catalog,
updateMode: updateMode,
),
);

/// The callback to invoke when adding or updating a surface.
Expand Down Expand Up @@ -88,27 +92,16 @@ class DeleteSurfaceTool extends AiTool<JsonMap> {
/// This tool allows the AI to specify the root component of a UI surface.
class BeginRenderingTool extends AiTool<JsonMap> {
/// Creates a [BeginRenderingTool].
BeginRenderingTool({required this.handleMessage})
: super(
name: 'beginRendering',
description:
'Signals the client to begin rendering a surface with a '
'root component.',
parameters: S.object(
properties: {
surfaceIdKey: S.string(
description:
'The unique identifier for the UI surface to render.',
),
'root': S.string(
description:
'The ID of the root widget. This ID must correspond to '
'the ID of one of the widgets in the `components` list.',
),
},
required: [surfaceIdKey, 'root'],
),
);
BeginRenderingTool({
required this.handleMessage,
SurfaceUpdateMode updateMode = SurfaceUpdateMode.both,
}) : super(
name: 'beginRendering',
description:
'Signals the client to begin rendering a surface with a '
'root component.',
parameters: A2uiSchemas.beginRenderingSchema(updateMode: updateMode),
);

/// The callback to invoke when signaling to begin rendering.
final void Function(A2uiMessage message) handleMessage;
Expand Down
Loading
Loading