mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
fix formatting and imports
This commit is contained in:
@@ -16,10 +16,10 @@ class DocumentationFeature {
|
||||
}
|
||||
|
||||
final method = requestModel.httpRequestModel?.method
|
||||
.toString()
|
||||
.split('.')
|
||||
.last
|
||||
.toUpperCase() ??
|
||||
.toString()
|
||||
.split('.')
|
||||
.last
|
||||
.toUpperCase() ??
|
||||
"GET";
|
||||
final endpoint = requestModel.httpRequestModel?.url ?? "Unknown Endpoint";
|
||||
final headers = requestModel.httpRequestModel?.enabledHeadersMap ?? {};
|
||||
@@ -27,7 +27,7 @@ class DocumentationFeature {
|
||||
final body = requestModel.httpRequestModel?.body;
|
||||
final rawResponse = responseModel.body;
|
||||
final responseBody =
|
||||
rawResponse is String ? rawResponse : jsonEncode(rawResponse);
|
||||
rawResponse is String ? rawResponse : jsonEncode(rawResponse);
|
||||
final statusCode = responseModel.statusCode ?? 0;
|
||||
|
||||
final prompt = """
|
||||
|
||||
5
lib/dashbot/features/features.dart
Normal file
5
lib/dashbot/features/features.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
export 'debug.dart';
|
||||
export 'documentation.dart';
|
||||
export 'explain.dart';
|
||||
export 'general_query.dart';
|
||||
export 'test_generator.dart';
|
||||
@@ -6,11 +6,17 @@ class GeneralQueryFeature {
|
||||
|
||||
GeneralQueryFeature(this._client);
|
||||
|
||||
Future<String> generateResponse(String prompt, {RequestModel? requestModel, dynamic responseModel}) async {
|
||||
Future<String> generateResponse(String prompt,
|
||||
{RequestModel? requestModel, dynamic responseModel}) async {
|
||||
String enhancedPrompt = prompt;
|
||||
|
||||
if (requestModel != null && responseModel != null) {
|
||||
final method = requestModel.httpRequestModel?.method.toString().split('.').last.toUpperCase() ?? "GET";
|
||||
final method = requestModel.httpRequestModel?.method
|
||||
.toString()
|
||||
.split('.')
|
||||
.last
|
||||
.toUpperCase() ??
|
||||
"GET";
|
||||
final endpoint = requestModel.httpRequestModel?.url ?? "Unknown Endpoint";
|
||||
final statusCode = responseModel.statusCode ?? 0;
|
||||
|
||||
@@ -37,7 +43,10 @@ Respond in a helpful, direct manner that specifically answers what was asked.
|
||||
}
|
||||
|
||||
final response = await _client.generateCompletion(
|
||||
request: GenerateCompletionRequest(model: 'llama3.2:3b', prompt: enhancedPrompt),
|
||||
request: GenerateCompletionRequest(
|
||||
model: 'llama3.2:3b',
|
||||
prompt: enhancedPrompt,
|
||||
),
|
||||
);
|
||||
return response.response.toString();
|
||||
}
|
||||
|
||||
@@ -16,15 +16,15 @@ class TestGeneratorFeature {
|
||||
}
|
||||
|
||||
final method = requestModel.httpRequestModel?.method
|
||||
.toString()
|
||||
.split('.')
|
||||
.last
|
||||
.toUpperCase() ??
|
||||
.toString()
|
||||
.split('.')
|
||||
.last
|
||||
.toUpperCase() ??
|
||||
"GET";
|
||||
final endpoint = requestModel.httpRequestModel?.url ?? "Unknown Endpoint";
|
||||
final rawResponse = responseModel.body;
|
||||
final responseBody =
|
||||
rawResponse is String ? rawResponse : jsonEncode(rawResponse);
|
||||
rawResponse is String ? rawResponse : jsonEncode(rawResponse);
|
||||
final statusCode = responseModel.statusCode ?? 0;
|
||||
|
||||
Uri uri = Uri.parse(endpoint);
|
||||
@@ -75,9 +75,11 @@ Focus on creating realistic test values based on the API context (e.g., for a co
|
||||
|
||||
parameters.forEach((key, value) {
|
||||
if (RegExp(r'^[A-Z]{3}$').hasMatch(value)) {
|
||||
analysis[key] = "Appears to be a 3-letter country code (ISO 3166-1 alpha-3)";
|
||||
analysis[key] =
|
||||
"Appears to be a 3-letter country code (ISO 3166-1 alpha-3)";
|
||||
} else if (RegExp(r'^[A-Z]{2}$').hasMatch(value)) {
|
||||
analysis[key] = "Appears to be a 2-letter country code (ISO 3166-1 alpha-2)";
|
||||
analysis[key] =
|
||||
"Appears to be a 2-letter country code (ISO 3166-1 alpha-2)";
|
||||
} else if (RegExp(r'^\d+$').hasMatch(value)) {
|
||||
analysis[key] = "Numeric value";
|
||||
} else if (RegExp(r'^[a-zA-Z]+$').hasMatch(value)) {
|
||||
|
||||
Reference in New Issue
Block a user