这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@hiroshihorie
Copy link
Member

Introduces a new file attribute-typings.dart defining Dart classes and enums for agent and transcription attributes, including JSON serialization helpers. Also exports this new typings file from the main library entry point.

Introduces a new file `attribute-typings.dart` defining Dart classes and enums for agent and transcription attributes, including JSON serialization helpers. Also exports this new typings file from the main library entry point.
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

Adds a new Dart file defining models and enums for agent and transcription attributes with JSON (de)serialization, and exports it from the main library.

  • Introduce attribute-typings.dart containing AgentAttributes, TranscriptionAttributes, enums, and an EnumValues helper.
  • Export the new typings file and merge the conditional export for processor_native.dart into a single line.

Reviewed Changes

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

File Description
lib/src/types/attribute-typings.dart New models/enums with JSON serialization for agent/transcription attributes
lib/livekit_client.dart Merged conditional export line and added export for attribute typings file
Comments suppressed due to low confidence (3)

lib/livekit_client.dart:62

  • [nitpick] Dart style guide recommends using lowercase_with_underscores for file names; consider renaming attribute-typings.dart to attribute_typings.dart and updating its references.
export 'src/types/attribute-typings.dart';

lib/src/types/attribute-typings.dart:8

  • [nitpick] Consider adding doc comments to explain the purpose and usage of this JSON deserialization helper to improve clarity for public API consumers.
AgentAttributes agentAttributesFromJson(String str) => AgentAttributes.fromJson(json.decode(str));

lib/src/types/attribute-typings.dart:18

  • [nitpick] These list fields are nullable but default to empty lists in fromJson; consider making them non-nullable (List) or returning null consistently to align the API design.
  List<AgentInput>? lkAgentInputs;

lkAgentOutputs: json['lk.agent.outputs'] == null
? []
: List<AgentOutput>.from(json['lk.agent.outputs']!.map((x) => agentOutputValues.map[x]!)),
lkAgentState: agentStateValues.map[json['lk.agent.state']]!,
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

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

This force unwrap will throw if 'lk.agent.state' is missing or null; consider handling a null case (e.g., using a null-aware lookup) to avoid runtime exceptions.

Suggested change
lkAgentState: agentStateValues.map[json['lk.agent.state']]!,
lkAgentState: json['lk.agent.state'] != null ? agentStateValues.map[json['lk.agent.state']] : null,

Copilot uses AI. Check for mistakes.
@hiroshihorie hiroshihorie merged commit e342ecf into main Jun 24, 2025
9 of 11 checks passed
@hiroshihorie hiroshihorie deleted the hiroshi/attribute-helpers branch June 24, 2025 12:14
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.

3 participants