mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
Refactor DashBot
This commit is contained in:
56
lib/dashbot/constants.dart
Normal file
56
lib/dashbot/constants.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
/// Role of a chat message author.
|
||||
enum MessageRole { user, system }
|
||||
|
||||
enum ChatMessageType {
|
||||
explainResponse,
|
||||
debugError,
|
||||
generateTest,
|
||||
generateDoc,
|
||||
generateCode,
|
||||
importCurl,
|
||||
importOpenApi,
|
||||
general
|
||||
}
|
||||
|
||||
enum ChatActionType {
|
||||
updateField('update_field'),
|
||||
addHeader('add_header'),
|
||||
updateHeader('update_header'),
|
||||
deleteHeader('delete_header'),
|
||||
updateBody('update_body'),
|
||||
updateUrl('update_url'),
|
||||
updateMethod('update_method'),
|
||||
showLanguages('show_languages'),
|
||||
applyCurl('apply_curl'),
|
||||
applyOpenApi('apply_openapi'),
|
||||
downloadDoc('download_doc'),
|
||||
other('other'),
|
||||
noAction('no_action'),
|
||||
uploadAsset('upload_asset');
|
||||
|
||||
const ChatActionType(this.text);
|
||||
final String text;
|
||||
}
|
||||
|
||||
enum ChatActionTarget {
|
||||
httpRequestModel,
|
||||
codegen,
|
||||
test,
|
||||
code,
|
||||
attachment,
|
||||
documentation,
|
||||
}
|
||||
|
||||
ChatActionType chatActionTypeFromString(String s) {
|
||||
return ChatActionType.values.firstWhere(
|
||||
(type) => type.text == s,
|
||||
orElse: () => ChatActionType.other,
|
||||
);
|
||||
}
|
||||
|
||||
ChatActionTarget chatActionTargetFromString(String s) {
|
||||
return ChatActionTarget.values.firstWhere(
|
||||
(target) => target.name == s,
|
||||
orElse: () => ChatActionTarget.httpRequestModel,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user