Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Conversation

@SamSaffron
Copy link
Member

@SamSaffron SamSaffron commented Jun 20, 2025

Introduces import/export feature for tools and personas.

Uploads are omitted for now, and will be added in a future PR

  • Backend:

    • Adds import and export actions to Admin::AiPersonasController and Admin::AiToolsController.
    • Introduces DiscourseAi::PersonaExporter and DiscourseAi::PersonaImporter services to manage JSON serialization and deserialization.
    • The export format for a persona embeds its associated custom tools. To ensure portability, AiTool references are serialized using their tool_name rather than their internal database id.
    • The import logic detects conflicts by name. A force=true parameter can be passed to overwrite existing records.
  • Frontend:

    • AiPersonaListEditor and AiToolListEditor components now include an "Import" button that handles file selection and POSTs the JSON data to the respective import endpoint.
    • AiPersonaEditorForm and AiToolEditorForm components feature an "Export" button that triggers a download of the serialized record.
    • Handles import conflicts (HTTP 409 for tools, 422 for personas) by showing a dialog.confirm prompt to allow the user to force an overwrite.
  • Testing:

    • Adds comprehensive request specs for the new controller actions (#import, #export).
    • Includes unit specs for the PersonaExporter and PersonaImporter services.

@SamSaffron SamSaffron changed the title demo builder FEATURE: persona/tool import and export Jun 23, 2025
@SamSaffron SamSaffron marked this pull request as ready for review June 23, 2025 07:35
@SamSaffron SamSaffron merged commit 9f2a409 into main Jun 24, 2025
6 checks passed
@SamSaffron SamSaffron deleted the demo-builder branch June 24, 2025 02:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants