Skip to content

feat: add dialog command#18

Merged
xavidop merged 2 commits intomainfrom
xavier/dialog
Mar 29, 2025
Merged

feat: add dialog command#18
xavidop merged 2 commits intomainfrom
xavier/dialog

Conversation

@xavidop
Copy link
Owner

@xavidop xavidop commented Mar 29, 2025

Added dialog commands

Summary by CodeRabbit

  • New Features

    • Introduced new Voiceflow CLI commands that allow you to start interactive dialogs and replay recorded conversations with customizable options such as user ID, environment, and recording flags.
  • Documentation

    • Expanded the CLI guide with new sections and detailed usage examples for the dialog commands, making it easier to understand and use these new features.
  • Chores

    • Updated build and quality checks to enhance overall stability and maintainability.

@coderabbitai
Copy link

coderabbitai bot commented Mar 29, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update advances the project by upgrading the linting workflow, expanding ignore patterns, and refining the Windows release configuration. New dialog commands (start, replay, and a parent dialog command) have been added and registered to the CLI. Comprehensive documentation for these commands is introduced, along with new types and utility functions for resource management. Several pkg modules have been updated to use a custom SafeClose function for improved error handling during resource cleanup.

Changes

File(s) Change Summary
.github/workflows/lint.yaml Updated golangci-lint-action version from v6 to v7
.gitignore Added new ignore patterns: file.json and test_*.yaml
.goreleaser.yml Changed Windows archive format from a string (zip) to a list ([ 'zip' ])
cmd/dialog/..., cmd/root.go Added new dialog commands (dialogCmd, replayCmd, startCmd) and registered the dialog module with the root CLI command
docs/(docs/cmd/voiceflow*, docs/docs/dialog/*, mkdocs.yml) Introduced extensive documentation for dialog commands and updated the navigation to include a new "Dialog" section
internal/types/voiceflow/dialog/dialog.go, internal/utils/closer.go, internal/utils/files.go Added new dialog-related types and introduced the SafeClose utility, updating file closure to use it
pkg/(dialog, openai, transcript, voiceflow/*) Integrated SafeClose for resource cleanup, added implementations for dialog replay/start commands, and refactored transcript conversion using a switch statement

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant CLI as CLI Application
    participant DM as Voiceflow Dialog Manager
    participant FS as File System

    U->>CLI: Execute "dialog start" command with flags
    CLI->>CLI: Setup environment & signal handlers
    CLI->>DM: Initiate dialog session
    DM-->>CLI: Return initial response
    CLI->>FS: Record conversation (if enabled)
    U->>CLI: Provide input
    CLI->>DM: Send user input
    DM-->>CLI: Return dialog response
    CLI->>FS: Append interaction to record
Loading
sequenceDiagram
    participant U as User
    participant CLI as CLI Application
    participant FS as File System
    participant DM as Voiceflow Dialog Manager

    U->>CLI: Execute "dialog replay" command with record file
    CLI->>FS: Load recorded conversation
    loop For each interaction
        CLI->>DM: Replay interaction
        DM-->>CLI: Return replay response
    end
    CLI->>U: Display conversation replay
Loading

Poem

Oh, what a hop, a joyful code parade!
New commands leap forth like a bright spring day.
SafeClose now watches o'er every file close tight,
Docs and workflows dance in pure delight.
I, the rabbit, cheer each change with a happy twirl 🐇💫!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d61092 and 384cca3.

📒 Files selected for processing (29)
  • .github/workflows/lint.yaml (1 hunks)
  • .gitignore (1 hunks)
  • .goreleaser.yml (1 hunks)
  • cmd/dialog/dialog.go (1 hunks)
  • cmd/dialog/replay.go (1 hunks)
  • cmd/dialog/start.go (1 hunks)
  • cmd/root.go (2 hunks)
  • docs/docs/cmd/voiceflow.md (1 hunks)
  • docs/docs/cmd/voiceflow_dialog.md (1 hunks)
  • docs/docs/cmd/voiceflow_dialog_replay.md (1 hunks)
  • docs/docs/cmd/voiceflow_dialog_start.md (1 hunks)
  • docs/docs/dialog/introduction.md (1 hunks)
  • docs/docs/dialog/replay.md (1 hunks)
  • docs/docs/dialog/start.md (1 hunks)
  • docs/mkdocs.yml (1 hunks)
  • internal/types/voiceflow/dialog/dialog.go (1 hunks)
  • internal/utils/closer.go (1 hunks)
  • internal/utils/files.go (1 hunks)
  • pkg/dialog/replay.go (1 hunks)
  • pkg/dialog/start.go (1 hunks)
  • pkg/openai/similarity.go (2 hunks)
  • pkg/transcript/to-test.go (2 hunks)
  • pkg/voiceflow/agent.go (2 hunks)
  • pkg/voiceflow/analytics.go (2 hunks)
  • pkg/voiceflow/document.go (4 hunks)
  • pkg/voiceflow/interact.go (2 hunks)
  • pkg/voiceflow/kb.go (2 hunks)
  • pkg/voiceflow/state.go (2 hunks)
  • pkg/voiceflow/transcript.go (4 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@v6...v7)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@xavidop xavidop requested a review from Copilot March 29, 2025 20:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds dialog commands ("start" and "replay") to the Voiceflow CLI, enabling interactive conversation sessions, conversation recording, and replay capabilities. Key changes include refactoring transcript processing for better structure, integrating a SafeClose helper for resource cleanup, and adding new command implementations and documentation for dialog functionality.

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/transcript/to-test.go Refactored conditional handling in transcript conversion with a switch statement.
pkg/openai/similarity.go Updated resource cleanup to use SafeClose for improved error handling.
pkg/dialog/replay.go Introduced the new dialog replay functionality.
internal/utils/files.go & closer.go Updated file handling to leverage SafeClose.
internal/types/voiceflow/dialog/dialog.go Added types for handling recorded dialog conversations.
docs/* Added documentation for the new dialog commands.
cmd/dialog/* Added new CLI commands for starting and replaying dialogs.
.goreleaser.yml & .github/workflows/lint.yaml Updated configuration files for releases and linting.
Comments suppressed due to low confidence (2)

cmd/dialog/start.go:40

  • [nitpick] The shorthand flag 'r' for user-id might be confusing; consider using a more intuitive option like 'u'.
startCmd.Flags().StringP("user-id", "r", "", "User ID for the dialog (optional)")

cmd/dialog/replay.go:39

  • [nitpick] The shorthand flag 'r' for user-id might be better as 'u' for clarity and consistency with common conventions.
replayCmd.Flags().StringP("user-id", "r", "", "User ID for the dialog (optional)")

}
for index, turn := range transcriptJSON {
if turn.Type == "launch" {
switch turn.Type {
Copy link

Copilot AI Mar 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a default case to the switch statement to handle unexpected turn types.

Copilot uses AI. Check for mistakes.
@xavidop xavidop merged commit 96c30d5 into main Mar 29, 2025
9 checks passed
@xavidop xavidop deleted the xavier/dialog branch March 29, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants