create an fix assistants
This commit is contained in:
parent
9d7b607844
commit
a2c0c97337
|
|
@ -19,6 +19,7 @@ import 'package:didvan/services/notification/firebase_api.dart';
|
||||||
import 'package:didvan/services/notification/notification_service.dart';
|
import 'package:didvan/services/notification/notification_service.dart';
|
||||||
import 'package:didvan/utils/my_custom_scroll_behavior.dart';
|
import 'package:didvan/utils/my_custom_scroll_behavior.dart';
|
||||||
import 'package:didvan/views/ai/ai_state.dart';
|
import 'package:didvan/views/ai/ai_state.dart';
|
||||||
|
import 'package:didvan/views/ai/bot_assistants_state.dart';
|
||||||
import 'package:didvan/views/ai/create_bot_assistants_state.dart';
|
import 'package:didvan/views/ai/create_bot_assistants_state.dart';
|
||||||
import 'package:didvan/views/ai/history_ai_chat_state.dart';
|
import 'package:didvan/views/ai/history_ai_chat_state.dart';
|
||||||
import 'package:didvan/views/ai/tools_state.dart';
|
import 'package:didvan/views/ai/tools_state.dart';
|
||||||
|
|
@ -182,6 +183,9 @@ class _DidvanState extends State<Didvan> with WidgetsBindingObserver {
|
||||||
ChangeNotifierProvider<CreateBotAssistantsState>(
|
ChangeNotifierProvider<CreateBotAssistantsState>(
|
||||||
create: (context) => CreateBotAssistantsState(),
|
create: (context) => CreateBotAssistantsState(),
|
||||||
),
|
),
|
||||||
|
ChangeNotifierProvider<BotAssistantsState>(
|
||||||
|
create: (context) => BotAssistantsState(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: Consumer<ThemeProvider>(
|
child: Consumer<ThemeProvider>(
|
||||||
builder: (context, themeProvider, child) => Container(
|
builder: (context, themeProvider, child) => Container(
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,19 @@ class BotAssistantsModel {
|
||||||
|
|
||||||
class BotAssistants {
|
class BotAssistants {
|
||||||
int? id;
|
int? id;
|
||||||
|
int? userId;
|
||||||
|
int? botId;
|
||||||
String? name;
|
String? name;
|
||||||
String? description;
|
String? description;
|
||||||
String? createdAt;
|
String? createdAt;
|
||||||
String? image;
|
String? image;
|
||||||
|
String? type;
|
||||||
|
String? prompt;
|
||||||
|
bool? private;
|
||||||
BotsModel? bot;
|
BotsModel? bot;
|
||||||
User? user;
|
User? user;
|
||||||
|
List<String>? files;
|
||||||
|
List<String>? websites;
|
||||||
|
|
||||||
BotAssistants(
|
BotAssistants(
|
||||||
{this.id,
|
{this.id,
|
||||||
|
|
@ -39,16 +46,40 @@ class BotAssistants {
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.image,
|
this.image,
|
||||||
this.bot,
|
this.bot,
|
||||||
this.user});
|
this.private,
|
||||||
|
this.user,
|
||||||
|
this.botId,
|
||||||
|
this.prompt,
|
||||||
|
this.type,
|
||||||
|
this.websites,
|
||||||
|
this.files,
|
||||||
|
this.userId});
|
||||||
|
|
||||||
BotAssistants.fromJson(Map<String, dynamic> json) {
|
BotAssistants.fromJson(Map<String, dynamic> json) {
|
||||||
id = json['id'];
|
id = json['id'];
|
||||||
|
userId = json['userId'];
|
||||||
|
botId = json['botId'];
|
||||||
name = json['name'];
|
name = json['name'];
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
createdAt = json['createdAt'];
|
createdAt = json['createdAt'];
|
||||||
image = json['image'];
|
image = json['image'];
|
||||||
|
type = json['type'];
|
||||||
|
prompt = json['prompt'];
|
||||||
|
private = json['private'];
|
||||||
bot = json['bot'] != null ? BotsModel.fromJson(json['bot']) : null;
|
bot = json['bot'] != null ? BotsModel.fromJson(json['bot']) : null;
|
||||||
user = json['user'] != null ? User.fromJson(json['user']) : null;
|
user = json['user'] != null ? User.fromJson(json['user']) : null;
|
||||||
|
if (json['files'] != null) {
|
||||||
|
files = <String>[];
|
||||||
|
json['files'].forEach((v) {
|
||||||
|
files!.add(v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (json['websites'] != null) {
|
||||||
|
websites = <String>[];
|
||||||
|
json['websites'].forEach((v) {
|
||||||
|
websites!.add(v);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
|
|
@ -58,6 +89,7 @@ class BotAssistants {
|
||||||
data['description'] = description;
|
data['description'] = description;
|
||||||
data['createdAt'] = createdAt;
|
data['createdAt'] = createdAt;
|
||||||
data['image'] = image;
|
data['image'] = image;
|
||||||
|
data['private'] = private;
|
||||||
if (bot != null) {
|
if (bot != null) {
|
||||||
data['bot'] = bot!.toJson();
|
data['bot'] = bot!.toJson();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,20 @@ class BotAssistantsReqModel {
|
||||||
this.youtubeLink,
|
this.youtubeLink,
|
||||||
this.webLinks,
|
this.webLinks,
|
||||||
this.isPrivate = true});
|
this.isPrivate = true});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['type'] = type;
|
||||||
|
data['name'] = name;
|
||||||
|
data['botId'] = botId;
|
||||||
|
data['prompt'] = prompt;
|
||||||
|
data['isPrivate'] = isPrivate;
|
||||||
|
if (youtubeLink != null) {
|
||||||
|
data['youtubeLink'] = youtubeLink;
|
||||||
|
}
|
||||||
|
if (webLinks != null) {
|
||||||
|
data['webLinks'] = webLinks;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,9 @@ class RouteGenerator {
|
||||||
case Routes.botAssistants:
|
case Routes.botAssistants:
|
||||||
return _createRoute(const BotAssistantsPage());
|
return _createRoute(const BotAssistantsPage());
|
||||||
case Routes.createBotAssistants:
|
case Routes.createBotAssistants:
|
||||||
return _createRoute(const CreateBotAssistantsPage());
|
return _createRoute(CreateBotAssistantsPage(
|
||||||
|
id: settings.arguments as int?,
|
||||||
|
));
|
||||||
case Routes.info:
|
case Routes.info:
|
||||||
return _createRoute(const InfoPage());
|
return _createRoute(const InfoPage());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,44 @@ class MediaService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<FilePickerResult?> pickMultiFile() async {
|
||||||
|
try {
|
||||||
|
return await FilePicker.platform
|
||||||
|
.pickFiles(
|
||||||
|
type: FileType.custom,
|
||||||
|
allowedExtensions: [
|
||||||
|
'pdf',
|
||||||
|
'doc',
|
||||||
|
'docx',
|
||||||
|
'xls',
|
||||||
|
'xlsx',
|
||||||
|
'ppt',
|
||||||
|
'pptx',
|
||||||
|
'txt',
|
||||||
|
'mp3',
|
||||||
|
'wav',
|
||||||
|
'aac',
|
||||||
|
'ogg',
|
||||||
|
'flac'
|
||||||
|
], // You can specify allowed extensions if needed
|
||||||
|
allowMultiple: true,
|
||||||
|
// Note: The maxFiles parameter is not directly supported by FilePicker.
|
||||||
|
// You will need to handle the limit after selection if necessary.
|
||||||
|
)
|
||||||
|
.then((result) {
|
||||||
|
if (result != null && result.files.length > 3) {
|
||||||
|
// Handle the case where the selected files exceed the max limit
|
||||||
|
// You can show an error message or return null
|
||||||
|
return null; // or show a message to the user
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
e.printError(info: 'Pick Multi File Fail');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Future<FilePickerResult?> pickAudioFile() async {
|
static Future<FilePickerResult?> pickAudioFile() async {
|
||||||
try {
|
try {
|
||||||
return await FilePicker.platform.pickFiles(
|
return await FilePicker.platform.pickFiles(
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:didvan/services/storage/storage.dart';
|
import 'package:didvan/services/storage/storage.dart';
|
||||||
|
|
||||||
// ignore: depend_on_referenced_packages
|
// ignore: depend_on_referenced_packages
|
||||||
|
|
@ -10,6 +10,8 @@ import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
// ignore: depend_on_referenced_packages
|
// ignore: depend_on_referenced_packages
|
||||||
import 'package:http_parser/http_parser.dart' as parser;
|
import 'package:http_parser/http_parser.dart' as parser;
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:mime/mime.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
class RequestService {
|
class RequestService {
|
||||||
|
|
@ -119,6 +121,71 @@ class RequestService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> multipartFilesCreateAssismants({
|
||||||
|
required List<XFile>? files,
|
||||||
|
required XFile? image,
|
||||||
|
required String method,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final request = http.MultipartRequest(method, Uri.parse(url));
|
||||||
|
_headers.update('Content-Type', (_) => 'multipart/form-data');
|
||||||
|
request.headers.addAll(_headers);
|
||||||
|
if (_requestBody != null) {
|
||||||
|
_requestBody!.forEach((key, value) {
|
||||||
|
request.fields.addAll({key.toString(): value.toString()});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (files != null) {
|
||||||
|
for (var file in files) {
|
||||||
|
final length = await file.length();
|
||||||
|
final mimeType = lookupMimeType(file.path) ??
|
||||||
|
'application/octet-stream'; // Get content type
|
||||||
|
|
||||||
|
request.files.add(
|
||||||
|
http.MultipartFile(
|
||||||
|
'files',
|
||||||
|
file.readAsBytes().asStream(),
|
||||||
|
length,
|
||||||
|
filename: file.name,
|
||||||
|
contentType:
|
||||||
|
parser.MediaType.parse(mimeType), // Use the content type
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image != null) {
|
||||||
|
final length = await image.length();
|
||||||
|
final mimeType = lookupMimeType(image.path) ??
|
||||||
|
'application/octet-stream'; // Get content type
|
||||||
|
|
||||||
|
request.files.add(
|
||||||
|
http.MultipartFile(
|
||||||
|
'image',
|
||||||
|
image.readAsBytes().asStream(),
|
||||||
|
length,
|
||||||
|
filename: image.name,
|
||||||
|
contentType:
|
||||||
|
parser.MediaType.parse(mimeType), // Use the content type
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final streamedResponse = await request
|
||||||
|
.send()
|
||||||
|
.timeout(
|
||||||
|
const Duration(seconds: 30),
|
||||||
|
)
|
||||||
|
.catchError(
|
||||||
|
(e) => throw e,
|
||||||
|
);
|
||||||
|
final response = await http.Response.fromStream(streamedResponse);
|
||||||
|
_handleResponse(response);
|
||||||
|
} catch (e) {
|
||||||
|
_handleError(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> multipart({
|
Future<void> multipart({
|
||||||
required dynamic file,
|
required dynamic file,
|
||||||
required String method,
|
required String method,
|
||||||
|
|
@ -233,7 +300,11 @@ class RequestService {
|
||||||
|
|
||||||
void _handleResponse(http.Response? response) {
|
void _handleResponse(http.Response? response) {
|
||||||
statusCode = response?.statusCode;
|
statusCode = response?.statusCode;
|
||||||
|
if (response != null) {
|
||||||
|
if (kDebugMode) {
|
||||||
|
print('Response from [$url]: ${response.body}');
|
||||||
|
}
|
||||||
|
}
|
||||||
if (_handleError(response)) {
|
if (_handleError(response)) {
|
||||||
if (response!.body.isNotEmpty) {
|
if (response!.body.isNotEmpty) {
|
||||||
_body = json.decode(response.body);
|
_body = json.decode(response.body);
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,8 @@ class RequestHelper {
|
||||||
])}';
|
])}';
|
||||||
static String createAssistants() => '$baseUrl/ai/bot';
|
static String createAssistants() => '$baseUrl/ai/bot';
|
||||||
static String updateAssistants(int id) => '$baseUrl/ai/bot/$id';
|
static String updateAssistants(int id) => '$baseUrl/ai/bot/$id';
|
||||||
|
static String getAssistant(int id) => '$baseUrl/ai/bot/user/$id';
|
||||||
|
static String deleteAssistant(int id) => '$baseUrl/ai/bot/user/$id';
|
||||||
|
|
||||||
static String _urlConcatGenerator(List<MapEntry<String, dynamic>> additions) {
|
static String _urlConcatGenerator(List<MapEntry<String, dynamic>> additions) {
|
||||||
String result = '';
|
String result = '';
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import 'dart:io';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:bot_toast/bot_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/assets.dart';
|
import 'package:didvan/constants/assets.dart';
|
||||||
|
|
@ -377,12 +376,12 @@ class ActionSheetUtils {
|
||||||
width: 1))),
|
width: 1))),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
SkeletonImage(
|
||||||
child: CachedNetworkImage(
|
|
||||||
imageUrl: bot.image.toString(),
|
imageUrl: bot.image.toString(),
|
||||||
width: 42,
|
width: 42,
|
||||||
height: 42,
|
height: 42,
|
||||||
),
|
borderRadius:
|
||||||
|
BorderRadius.circular(360),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
|
|
@ -17,6 +16,7 @@ import 'package:didvan/views/ai/tools_screen.dart';
|
||||||
import 'package:didvan/views/ai/widgets/message_bar_btn.dart';
|
import 'package:didvan/views/ai/widgets/message_bar_btn.dart';
|
||||||
import 'package:didvan/views/home/home.dart';
|
import 'package:didvan/views/home/home.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||||
|
import 'package:didvan/views/widgets/skeleton_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
|
@ -154,12 +154,12 @@ class _AiState extends State<Ai> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 12,
|
width: 12,
|
||||||
),
|
),
|
||||||
ClipOval(
|
SkeletonImage(
|
||||||
child: CachedNetworkImage(
|
|
||||||
width: 46,
|
width: 46,
|
||||||
height: 46,
|
height: 46,
|
||||||
imageUrl: bot.image.toString(),
|
imageUrl: bot.image.toString(),
|
||||||
),
|
borderRadius:
|
||||||
|
BorderRadius.circular(360),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
|
|
@ -133,12 +132,11 @@ class _AiChatPageState extends State<AiChatPage> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
ClipOval(
|
SkeletonImage(
|
||||||
child: CachedNetworkImage(
|
|
||||||
width: 75,
|
width: 75,
|
||||||
height: 75,
|
height: 75,
|
||||||
imageUrl: widget.args.bot.image.toString(),
|
imageUrl: widget.args.bot.image.toString(),
|
||||||
),
|
borderRadius: BorderRadius.circular(360),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
|
|
@ -467,15 +465,15 @@ class _AiChatPageState extends State<AiChatPage> {
|
||||||
maxWidth: 200),
|
maxWidth: 200),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
SkeletonImage(
|
||||||
child:
|
|
||||||
CachedNetworkImage(
|
|
||||||
imageUrl: bots[index]
|
imageUrl: bots[index]
|
||||||
.image
|
.image
|
||||||
.toString(),
|
.toString(),
|
||||||
width: 42,
|
width: 42,
|
||||||
height: 42,
|
height: 42,
|
||||||
),
|
borderRadius:
|
||||||
|
BorderRadius
|
||||||
|
.circular(360),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,20 @@ import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
import 'package:didvan/models/ai/ai_chat_args.dart';
|
import 'package:didvan/models/ai/ai_chat_args.dart';
|
||||||
import 'package:didvan/models/ai/bot_assistants_model.dart';
|
import 'package:didvan/models/ai/bot_assistants_model.dart';
|
||||||
|
import 'package:didvan/models/enums.dart';
|
||||||
import 'package:didvan/routes/routes.dart';
|
import 'package:didvan/routes/routes.dart';
|
||||||
import 'package:didvan/views/ai/bot_assistants_state.dart';
|
import 'package:didvan/views/ai/bot_assistants_state.dart';
|
||||||
|
import 'package:didvan/views/ai/create_bot_assistants_state.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/button.dart';
|
import 'package:didvan/views/widgets/didvan/button.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||||
import 'package:didvan/views/widgets/hoshan_app_bar.dart';
|
import 'package:didvan/views/widgets/hoshan_app_bar.dart';
|
||||||
import 'package:didvan/views/widgets/shimmer_placeholder.dart';
|
import 'package:didvan/views/widgets/shimmer_placeholder.dart';
|
||||||
import 'package:didvan/views/widgets/skeleton_image.dart';
|
import 'package:didvan/views/widgets/skeleton_image.dart';
|
||||||
import 'package:didvan/views/widgets/state_handlers/empty_list.dart';
|
import 'package:didvan/views/widgets/state_handlers/empty_list.dart';
|
||||||
|
import 'package:didvan/views/widgets/state_handlers/sliver_state_handler.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:persian_number_utility/persian_number_utility.dart';
|
import 'package:persian_number_utility/persian_number_utility.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class BotAssistantsPage extends StatefulWidget {
|
class BotAssistantsPage extends StatefulWidget {
|
||||||
const BotAssistantsPage({Key? key}) : super(key: key);
|
const BotAssistantsPage({Key? key}) : super(key: key);
|
||||||
|
|
@ -22,8 +26,6 @@ class BotAssistantsPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
bool isMyAssistants = true;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|
@ -31,29 +33,27 @@ class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
onBack: () => Navigator.pop(context),
|
onBack: () => Navigator.pop(context),
|
||||||
withActions: false,
|
withActions: false,
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
|
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||||
floatingActionButton: isMyAssistants
|
floatingActionButton: context.watch<BotAssistantsState>().isMyAssistants
|
||||||
? FloatingActionButton.extended(
|
? FloatingActionButton.small(
|
||||||
label: const DidvanText(
|
shape: const CircleBorder(),
|
||||||
'ایجاد دستیار جدید',
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.add,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushNamed(context, Routes.createBotAssistants);
|
Navigator.pushNamed(context, Routes.createBotAssistants);
|
||||||
},
|
},
|
||||||
|
child: const Icon(
|
||||||
|
Icons.add,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
body: SingleChildScrollView(
|
body: Consumer<BotAssistantsState>(
|
||||||
physics: const BouncingScrollPhysics(),
|
builder:
|
||||||
child: Column(
|
(BuildContext context, BotAssistantsState state, Widget? child) =>
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
CustomScrollView(
|
||||||
children: [
|
slivers: [
|
||||||
const Center(
|
const SliverToBoxAdapter(
|
||||||
|
child: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(top: 32, bottom: 24),
|
padding: EdgeInsets.only(top: 32, bottom: 24),
|
||||||
child: DidvanText(
|
child: DidvanText(
|
||||||
|
|
@ -64,182 +64,40 @@ class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
switchAssistants(context),
|
|
||||||
FutureBuilder<List<BotAssistants>?>(
|
|
||||||
future: isMyAssistants
|
|
||||||
? BotAssistantsState.getMyAssissmant()
|
|
||||||
: BotAssistantsState.getGlobalAssissmant(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.hasError) {
|
|
||||||
return const EmptyList();
|
|
||||||
}
|
|
||||||
if (!snapshot.hasData) {
|
|
||||||
return listOfAssistantsPlaceHolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
return listOfAssistants(list: snapshot.data!);
|
|
||||||
}),
|
|
||||||
if (isMyAssistants) const SizedBox(height: 72)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
if (state.appState != AppState.failed)
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: switchAssistants(context, state),
|
||||||
),
|
),
|
||||||
);
|
SliverStateHandler(
|
||||||
}
|
childCount: state.isMyAssistants
|
||||||
|
? state.myAssistants.length
|
||||||
ListView listOfAssistants({required final List<BotAssistants> list}) {
|
: state.globalAssistants.length,
|
||||||
return ListView.builder(
|
state: state,
|
||||||
itemCount: list.length,
|
emptyState: const EmptyList(),
|
||||||
shrinkWrap: true,
|
builder: (context, state, index) {
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
final assistants = state.isMyAssistants
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
? state.myAssistants[index]
|
||||||
itemBuilder: (context, index) {
|
: state.globalAssistants[index];
|
||||||
final assistants = list[index];
|
return assistantsContainer(state, context, assistants);
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.all(12),
|
|
||||||
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 32),
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
color: Colors.white, borderRadius: DesignConfig.lowBorderRadius),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
if (isMyAssistants)
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.disabledBackground,
|
|
||||||
borderRadius: DesignConfig.lowBorderRadius),
|
|
||||||
child: const DidvanText('عمومی'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
SkeletonImage(
|
|
||||||
imageUrl: assistants.image ?? assistants.bot!.image ?? '',
|
|
||||||
width: 80,
|
|
||||||
height: 80,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 8,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
DidvanText(
|
|
||||||
assistants.name ?? '',
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
DidvanText(
|
|
||||||
assistants.description ?? '',
|
|
||||||
fontSize: 12,
|
|
||||||
color: Theme.of(context).colorScheme.disabledText,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 18,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
const Icon(
|
|
||||||
DidvanIcons.calendar_day_light,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 4,
|
|
||||||
),
|
|
||||||
DidvanText(
|
|
||||||
DateTime.parse(assistants.createdAt!)
|
|
||||||
.toPersianDateStr(),
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: isMyAssistants
|
|
||||||
? const Row(
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
DidvanIcons.user_edit_light,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 4,
|
|
||||||
),
|
|
||||||
DidvanText(
|
|
||||||
'ویرایش',
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Row(
|
|
||||||
children: [
|
|
||||||
SkeletonImage(
|
|
||||||
imageUrl:
|
|
||||||
assistants.user!.photo ?? '',
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(360),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 4,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: DidvanText(
|
|
||||||
assistants.user!.fullName ?? '',
|
|
||||||
fontSize: 12,
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
DidvanButton(
|
|
||||||
title: 'استفاده از دستیار',
|
|
||||||
onPressed: () => Navigator.pushNamed(context, Routes.aiChat,
|
|
||||||
arguments: AiChatArgs(
|
|
||||||
bot: assistants.bot!.copyWith(
|
|
||||||
id: assistants.id, image: assistants.image),
|
|
||||||
assistantsName: assistants.name)),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
placeholderCount: 10,
|
||||||
|
placeholder: assistantsContainerPlaceholder(state, context),
|
||||||
|
onRetry: state.isMyAssistants
|
||||||
|
? state.getMyAssissmant
|
||||||
|
: state.getGlobalAssissmant),
|
||||||
|
SliverPadding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(bottom: state.isMyAssistants ? 100 : 0))
|
||||||
|
],
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView listOfAssistantsPlaceHolder() {
|
Container assistantsContainerPlaceholder(
|
||||||
return ListView.builder(
|
BotAssistantsState state, BuildContext context) {
|
||||||
itemCount: 10,
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 32),
|
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 32),
|
||||||
|
|
@ -247,7 +105,7 @@ class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
color: Colors.white, borderRadius: DesignConfig.lowBorderRadius),
|
color: Colors.white, borderRadius: DesignConfig.lowBorderRadius),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (isMyAssistants)
|
if (state.isMyAssistants)
|
||||||
const Row(
|
const Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -322,11 +180,159 @@ class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Container assistantsContainer(BotAssistantsState state, BuildContext context,
|
||||||
|
BotAssistants assistants) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 32),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white, borderRadius: DesignConfig.lowBorderRadius),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
if (state.isMyAssistants)
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.disabledBackground,
|
||||||
|
borderRadius: DesignConfig.lowBorderRadius),
|
||||||
|
child: DidvanText(assistants.private! ? 'خصوصی' : 'عمومی'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SkeletonImage(
|
||||||
|
imageUrl: assistants.image ?? assistants.bot!.image ?? '',
|
||||||
|
width: 80,
|
||||||
|
height: 80,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
DidvanText(
|
||||||
|
assistants.name ?? '',
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
DidvanText(
|
||||||
|
assistants.description ??
|
||||||
|
'dsadsadsadadsadaddadadadsdadsad dsadsadsadadsadaddadadadsdadsad dsadsadsadadsadaddadadadsdadsaddsadsadsadadsadaddadadadsdadsad vdsadsadsadadsadaddadadadsdadsaddsadsadsadadsadaddadadadsdadsaddsadsadsadadsadaddadadadsdadsaddsadsadsadadsadaddadadadsdadsaddsadsadsadadsadaddadadadsdadsaddsadsadsadadsadaddadadadsdadsaddsadsadsadadsadaddadadadsdadsad',
|
||||||
|
fontSize: 12,
|
||||||
|
color: Theme.of(context).colorScheme.disabledText,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 18,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
DidvanIcons.calendar_day_light,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 4,
|
||||||
|
),
|
||||||
|
DidvanText(
|
||||||
|
DateTime.parse(assistants.createdAt!)
|
||||||
|
.toPersianDateStr(),
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: state.isMyAssistants
|
||||||
|
? InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
context
|
||||||
|
.read<CreateBotAssistantsState>()
|
||||||
|
.getAnAssistant(id: assistants.id!);
|
||||||
|
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routes.createBotAssistants,
|
||||||
|
arguments: assistants.id);
|
||||||
},
|
},
|
||||||
|
child: const Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
DidvanIcons.user_edit_light,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 4,
|
||||||
|
),
|
||||||
|
DidvanText(
|
||||||
|
'ویرایش',
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Row(
|
||||||
|
children: [
|
||||||
|
SkeletonImage(
|
||||||
|
imageUrl: assistants.user!.photo ?? '',
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
borderRadius: BorderRadius.circular(360),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 4,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: DidvanText(
|
||||||
|
assistants.user!.fullName ?? '',
|
||||||
|
fontSize: 12,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
DidvanButton(
|
||||||
|
title: 'استفاده از دستیار',
|
||||||
|
onPressed: () => Navigator.pushNamed(context, Routes.aiChat,
|
||||||
|
arguments: AiChatArgs(
|
||||||
|
bot: assistants.bot!
|
||||||
|
.copyWith(id: assistants.id, image: assistants.image),
|
||||||
|
assistantsName: assistants.name)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Container switchAssistants(BuildContext context) {
|
Container switchAssistants(BuildContext context, BotAssistantsState state) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 32),
|
margin: const EdgeInsets.symmetric(horizontal: 32),
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
|
|
@ -337,12 +343,16 @@ class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => setState(() => isMyAssistants = true),
|
onTap: () {
|
||||||
|
state.isMyAssistants = true;
|
||||||
|
state.getMyAssissmant();
|
||||||
|
state.update();
|
||||||
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
DidvanIcons.profile_solid,
|
DidvanIcons.profile_solid,
|
||||||
color: isMyAssistants
|
color: state.isMyAssistants
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.disabledText,
|
: Theme.of(context).colorScheme.disabledText,
|
||||||
),
|
),
|
||||||
|
|
@ -351,14 +361,14 @@ class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
height: 1,
|
height: 1,
|
||||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isMyAssistants
|
color: state.isMyAssistants
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.disabledText,
|
: Theme.of(context).colorScheme.disabledText,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DidvanText(
|
DidvanText(
|
||||||
'دستیارهای من',
|
'دستیارهای من',
|
||||||
color: isMyAssistants
|
color: state.isMyAssistants
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.disabledText,
|
: Theme.of(context).colorScheme.disabledText,
|
||||||
)
|
)
|
||||||
|
|
@ -375,12 +385,16 @@ class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => setState(() => isMyAssistants = false),
|
onTap: () {
|
||||||
|
state.isMyAssistants = false;
|
||||||
|
state.getGlobalAssissmant();
|
||||||
|
state.update();
|
||||||
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
DidvanIcons.profile_solid,
|
DidvanIcons.profile_solid,
|
||||||
color: !isMyAssistants
|
color: !state.isMyAssistants
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.disabledText,
|
: Theme.of(context).colorScheme.disabledText,
|
||||||
),
|
),
|
||||||
|
|
@ -389,14 +403,14 @@ class _BotAssistantsPageState extends State<BotAssistantsPage> {
|
||||||
height: 1,
|
height: 1,
|
||||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: !isMyAssistants
|
color: !state.isMyAssistants
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.disabledText,
|
: Theme.of(context).colorScheme.disabledText,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DidvanText(
|
DidvanText(
|
||||||
'دستیارهای دیگران',
|
'دستیارهای دیگران',
|
||||||
color: !isMyAssistants
|
color: !state.isMyAssistants
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.disabledText,
|
: Theme.of(context).colorScheme.disabledText,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,42 @@
|
||||||
import 'package:didvan/models/ai/bot_assistants_model.dart';
|
import 'package:didvan/models/ai/bot_assistants_model.dart';
|
||||||
|
import 'package:didvan/models/enums.dart';
|
||||||
|
import 'package:didvan/providers/core.dart';
|
||||||
|
|
||||||
import 'package:didvan/services/network/request.dart';
|
import 'package:didvan/services/network/request.dart';
|
||||||
import 'package:didvan/services/network/request_helper.dart';
|
import 'package:didvan/services/network/request_helper.dart';
|
||||||
|
|
||||||
class BotAssistantsState {
|
class BotAssistantsState extends CoreProvier {
|
||||||
static Future<List<BotAssistants>?> getGlobalAssissmant() async {
|
List<BotAssistants> myAssistants = [];
|
||||||
List<BotAssistants>? globalAssissmant;
|
List<BotAssistants> globalAssistants = [];
|
||||||
|
bool isMyAssistants = true;
|
||||||
|
|
||||||
|
void getGlobalAssissmant() async {
|
||||||
|
globalAssistants.clear();
|
||||||
|
|
||||||
|
appState = AppState.busy;
|
||||||
|
update();
|
||||||
final service = RequestService(
|
final service = RequestService(
|
||||||
RequestHelper.usersAssistants(),
|
RequestHelper.usersAssistants(personal: false),
|
||||||
);
|
);
|
||||||
await service.httpGet();
|
await service.httpGet();
|
||||||
if (service.isSuccess) {
|
if (service.isSuccess) {
|
||||||
final BotAssistantsModel toolsModel =
|
final BotAssistantsModel toolsModel =
|
||||||
BotAssistantsModel.fromJson(service.result);
|
BotAssistantsModel.fromJson(service.result);
|
||||||
globalAssissmant = toolsModel.botAssistants!;
|
|
||||||
return globalAssissmant;
|
globalAssistants.addAll(toolsModel.botAssistants ?? []);
|
||||||
|
|
||||||
|
appState = AppState.idle;
|
||||||
|
update();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
throw 'err';
|
appState = AppState.failed;
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<BotAssistants>?> getMyAssissmant() async {
|
void getMyAssissmant() async {
|
||||||
List<BotAssistants>? globalAssissmant;
|
myAssistants.clear();
|
||||||
|
appState = AppState.busy;
|
||||||
|
update();
|
||||||
final service = RequestService(
|
final service = RequestService(
|
||||||
RequestHelper.usersAssistants(personal: true),
|
RequestHelper.usersAssistants(personal: true),
|
||||||
);
|
);
|
||||||
|
|
@ -30,9 +44,14 @@ class BotAssistantsState {
|
||||||
if (service.isSuccess) {
|
if (service.isSuccess) {
|
||||||
final BotAssistantsModel toolsModel =
|
final BotAssistantsModel toolsModel =
|
||||||
BotAssistantsModel.fromJson(service.result);
|
BotAssistantsModel.fromJson(service.result);
|
||||||
globalAssissmant = toolsModel.botAssistants!;
|
|
||||||
return globalAssissmant;
|
myAssistants.addAll(toolsModel.botAssistants ?? []);
|
||||||
|
|
||||||
|
appState = AppState.idle;
|
||||||
|
update();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
throw 'err';
|
appState = AppState.failed;
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
|
// ignore_for_file: deprecated_member_use
|
||||||
|
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:animated_custom_dropdown/custom_dropdown.dart';
|
import 'package:animated_custom_dropdown/custom_dropdown.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
|
import 'package:didvan/models/ai/bot_assistants_model.dart';
|
||||||
|
import 'package:didvan/models/ai/bot_assistants_req_model.dart';
|
||||||
import 'package:didvan/models/ai/bots_model.dart';
|
import 'package:didvan/models/ai/bots_model.dart';
|
||||||
import 'package:didvan/models/enums.dart';
|
import 'package:didvan/models/enums.dart';
|
||||||
import 'package:didvan/models/view/action_sheet_data.dart';
|
import 'package:didvan/models/view/action_sheet_data.dart';
|
||||||
|
import 'package:didvan/services/media/media.dart';
|
||||||
import 'package:didvan/utils/action_sheet.dart';
|
import 'package:didvan/utils/action_sheet.dart';
|
||||||
|
import 'package:didvan/views/ai/bot_assistants_state.dart';
|
||||||
import 'package:didvan/views/ai/create_bot_assistants_state.dart';
|
import 'package:didvan/views/ai/create_bot_assistants_state.dart';
|
||||||
import 'package:didvan/views/ai/history_ai_chat_state.dart';
|
import 'package:didvan/views/ai/history_ai_chat_state.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/button.dart';
|
import 'package:didvan/views/widgets/didvan/button.dart';
|
||||||
|
|
@ -19,10 +26,13 @@ import 'package:didvan/views/widgets/shimmer_placeholder.dart';
|
||||||
import 'package:didvan/views/widgets/skeleton_image.dart';
|
import 'package:didvan/views/widgets/skeleton_image.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class CreateBotAssistantsPage extends StatefulWidget {
|
class CreateBotAssistantsPage extends StatefulWidget {
|
||||||
const CreateBotAssistantsPage({Key? key}) : super(key: key);
|
final int? id;
|
||||||
|
const CreateBotAssistantsPage({Key? key, this.id}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CreateBotAssistantsPage> createState() =>
|
State<CreateBotAssistantsPage> createState() =>
|
||||||
|
|
@ -30,20 +40,31 @@ class CreateBotAssistantsPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
final List<String> botModels = ['مدل زبانی', 'مدل تصویری'];
|
|
||||||
late List<BotsModel> allBots = context.read<HistoryAiChatState>().bots;
|
|
||||||
final _formYouTubeKey = GlobalKey<FormState>();
|
|
||||||
final _formNameKey = GlobalKey<FormState>();
|
|
||||||
final _formDescKey = GlobalKey<FormState>();
|
|
||||||
|
|
||||||
List<String> countOfLink = [''];
|
|
||||||
int selectedItem = 0;
|
|
||||||
bool inEdite = true;
|
|
||||||
|
|
||||||
late InputBorder defaultBorder = OutlineInputBorder(
|
late InputBorder defaultBorder = OutlineInputBorder(
|
||||||
borderRadius: DesignConfig.mediumBorderRadius,
|
borderRadius: DesignConfig.mediumBorderRadius,
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
width: 1, color: Theme.of(context).colorScheme.disabledText));
|
width: 1, color: Theme.of(context).colorScheme.disabledText));
|
||||||
|
late List<BotsModel> allBots = context.read<HistoryAiChatState>().bots;
|
||||||
|
|
||||||
|
final List<String> botModels = ['مدل زبانی', 'مدل تصویری'];
|
||||||
|
|
||||||
|
// final _formYouTubeKey = GlobalKey<FormState>();
|
||||||
|
final _formNameKey = GlobalKey<FormState>();
|
||||||
|
final _formPromptKey = GlobalKey<FormState>();
|
||||||
|
final _formDescKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
String name = '';
|
||||||
|
String prompt = '';
|
||||||
|
String desc = '';
|
||||||
|
// String? youtubeLink;
|
||||||
|
|
||||||
|
List<String> countOfLink = [''];
|
||||||
|
List<XFile> files = [];
|
||||||
|
ValueNotifier<XFile?> image = ValueNotifier(null);
|
||||||
|
String selectedBotType = 'text';
|
||||||
|
bool isPrivate = true;
|
||||||
|
BotAssistants? assistant;
|
||||||
|
BotsModel? initialBot;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -52,20 +73,98 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
context.read<CreateBotAssistantsState>().getImageToolsBots();
|
context.read<CreateBotAssistantsState>().getImageToolsBots();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onConfirm(CreateBotAssistantsState state, int selectedBotId) async {
|
||||||
|
bool isValid = true;
|
||||||
|
// if (!_formYouTubeKey.currentState!.validate()) {
|
||||||
|
// isValid = false;
|
||||||
|
// }
|
||||||
|
if (!_formNameKey.currentState!.validate()) {
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_formDescKey.currentState!.validate()) {
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_formPromptKey.currentState!.validate()) {
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
if (!isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await state.createAssistants(
|
||||||
|
id: widget.id,
|
||||||
|
data: BotAssistantsReqModel(
|
||||||
|
type: selectedBotType,
|
||||||
|
name: name,
|
||||||
|
botId: selectedBotId,
|
||||||
|
prompt: prompt,
|
||||||
|
webLinks: countOfLink.first.isEmpty ? null : countOfLink,
|
||||||
|
// youtubeLink: youtubeLink,
|
||||||
|
isPrivate: isPrivate,
|
||||||
|
files: files,
|
||||||
|
image: image.value));
|
||||||
|
|
||||||
|
context.read<BotAssistantsState>().getMyAssissmant();
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
int selectedBotId = selectedBotType == 'text'
|
||||||
|
? allBots.first.id!
|
||||||
|
: context.read<CreateBotAssistantsState>().imageBots.first.id!;
|
||||||
|
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
context.read<CreateBotAssistantsState>().assistant = null;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
appBar: HoshanAppBar(
|
appBar: HoshanAppBar(
|
||||||
onBack: () => Navigator.pop(context),
|
onBack: () => Navigator.pop(context),
|
||||||
withActions: false,
|
withActions: false,
|
||||||
),
|
),
|
||||||
body: Consumer<CreateBotAssistantsState>(
|
body: Consumer<CreateBotAssistantsState>(builder: (BuildContext context,
|
||||||
builder: (BuildContext context, CreateBotAssistantsState state,
|
CreateBotAssistantsState state, Widget? child) {
|
||||||
Widget? child) =>
|
assistant = state.assistant;
|
||||||
SingleChildScrollView(
|
if (assistant != null) {
|
||||||
|
name = assistant!.name ?? '';
|
||||||
|
prompt = assistant!.prompt ?? '';
|
||||||
|
desc = assistant!.description ?? '';
|
||||||
|
// youtubeLink = assistant!.;
|
||||||
|
isPrivate = assistant!.private ?? true;
|
||||||
|
if (assistant!.files != null && assistant!.files!.isNotEmpty) {
|
||||||
|
for (var file in assistant!.files!) {
|
||||||
|
final data = File.fromUri(Uri.parse(file)).readAsBytesSync();
|
||||||
|
files.add(XFile.fromData(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
countOfLink = assistant!.websites ?? [''];
|
||||||
|
selectedBotType = assistant!.type ?? 'text';
|
||||||
|
|
||||||
|
final list = selectedBotType == 'text' ? allBots : state.imageBots;
|
||||||
|
for (var bot in list) {
|
||||||
|
if (bot.id == assistant!.botId) {
|
||||||
|
initialBot = bot;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return state.loading
|
||||||
|
? Center(
|
||||||
|
child: SpinKitThreeBounce(
|
||||||
|
size: 46,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: SingleChildScrollView(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 32),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 20.0, vertical: 32),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
title(text: 'نوع دستیار'),
|
title(text: 'نوع دستیار'),
|
||||||
|
|
@ -74,7 +173,7 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
child: CustomDropdown<String>(
|
child: CustomDropdown<String>(
|
||||||
closedHeaderPadding: const EdgeInsets.all(12),
|
closedHeaderPadding: const EdgeInsets.all(12),
|
||||||
items: botModels,
|
items: botModels,
|
||||||
initialItem: botModels[selectedItem],
|
initialItem: botModels[0],
|
||||||
hideSelectedFieldWhenExpanded: false,
|
hideSelectedFieldWhenExpanded: false,
|
||||||
decoration: CustomDropdownDecoration(
|
decoration: CustomDropdownDecoration(
|
||||||
listItemDecoration: ListItemDecoration(
|
listItemDecoration: ListItemDecoration(
|
||||||
|
|
@ -84,13 +183,15 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
.withOpacity(0.5),
|
.withOpacity(0.5),
|
||||||
),
|
),
|
||||||
closedBorder: Border.all(color: Colors.grey),
|
closedBorder: Border.all(color: Colors.grey),
|
||||||
closedFillColor: Colors.grey.shade100.withOpacity(0.1),
|
closedFillColor:
|
||||||
|
Colors.grey.shade100.withOpacity(0.1),
|
||||||
expandedFillColor:
|
expandedFillColor:
|
||||||
Theme.of(context).colorScheme.surface),
|
Theme.of(context).colorScheme.surface),
|
||||||
// hintText: "انتخاب کنید",
|
// hintText: "انتخاب کنید",
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedItem = botModels.indexOf(value!);
|
final index = botModels.indexOf(value!);
|
||||||
|
selectedBotType = index == 0 ? 'text' : 'image';
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
@ -98,21 +199,59 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
const Row(
|
ValueListenableBuilder(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
valueListenable: image,
|
||||||
|
builder: (context, img, _) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
DidvanButton(
|
DidvanButton(
|
||||||
width: 120,
|
width: 120,
|
||||||
style: ButtonStyleMode.flat,
|
style: ButtonStyleMode.flat,
|
||||||
title: 'انتخاب عکس',
|
color: image.value != null ||
|
||||||
|
assistant?.image != null
|
||||||
|
? Theme.of(context).colorScheme.error
|
||||||
|
: null,
|
||||||
|
title: image.value != null ||
|
||||||
|
assistant?.image != null
|
||||||
|
? 'حذف عکس'
|
||||||
|
: 'انتخاب عکس',
|
||||||
|
onPressed: () async {
|
||||||
|
if (image.value != null ||
|
||||||
|
assistant?.image != null) {
|
||||||
|
if (assistant != null) {
|
||||||
|
assistant!.image = null;
|
||||||
|
}
|
||||||
|
image.value = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
image.value =
|
||||||
|
await MediaService.pickImage(
|
||||||
|
source: ImageSource.gallery);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
SkeletonImage(
|
img != null
|
||||||
imageUrl: 'https://via.placeholder.com/70x70',
|
? ClipRRect(
|
||||||
|
borderRadius:
|
||||||
|
DesignConfig.lowBorderRadius,
|
||||||
|
child: SizedBox(
|
||||||
width: 80,
|
width: 80,
|
||||||
height: 80,
|
height: 80,
|
||||||
),
|
child:
|
||||||
|
Image.file(File(img.path))),
|
||||||
|
)
|
||||||
|
: SkeletonImage(
|
||||||
|
imageUrl: assistant != null &&
|
||||||
|
assistant!.image != null
|
||||||
|
? assistant!.image!
|
||||||
|
: 'https://via.placeholder.com/70x70',
|
||||||
|
width: 80,
|
||||||
|
height: 80,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
|
|
@ -120,7 +259,10 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
Form(
|
Form(
|
||||||
key: _formNameKey,
|
key: _formNameKey,
|
||||||
child: DidvanTextField(
|
child: DidvanTextField(
|
||||||
onChanged: (value) {},
|
initialValue: name,
|
||||||
|
onChanged: (value) {
|
||||||
|
name = value;
|
||||||
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
String? result;
|
String? result;
|
||||||
if (value.isEmpty) {
|
if (value.isEmpty) {
|
||||||
|
|
@ -158,6 +300,36 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
|
title(text: 'توضیحات بات'),
|
||||||
|
Form(
|
||||||
|
key: _formDescKey,
|
||||||
|
child: DidvanTextField(
|
||||||
|
initialValue: desc,
|
||||||
|
// hintText:
|
||||||
|
// 'به ربات خود بگویید که چگونه رفتار کند و چگونه به پیامهای کاربر پاسخ دهد. سعی کنید تا حد امکان واضح و مشخص باشید.',
|
||||||
|
textInputType: TextInputType.multiline,
|
||||||
|
minLine: 4,
|
||||||
|
maxLine: 4,
|
||||||
|
maxLength: 200,
|
||||||
|
hasHeight: false,
|
||||||
|
showLen: true,
|
||||||
|
onChanged: (value) {
|
||||||
|
desc = value;
|
||||||
|
},
|
||||||
|
validator: (value) {
|
||||||
|
String? result;
|
||||||
|
if (value.isEmpty) {
|
||||||
|
result = 'توضیحات نباید خالی باشد';
|
||||||
|
} else if (value.length < 10) {
|
||||||
|
result = 'توضیحات نباید کمتر از 10 حرف باشد';
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
title(text: 'نوع دستیار'),
|
title(text: 'نوع دستیار'),
|
||||||
state.loadingImageBots
|
state.loadingImageBots
|
||||||
? ShimmerPlaceholder(
|
? ShimmerPlaceholder(
|
||||||
|
|
@ -169,14 +341,19 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
child: CustomDropdown<BotsModel>(
|
child: CustomDropdown<BotsModel>(
|
||||||
closedHeaderPadding: const EdgeInsets.all(12),
|
closedHeaderPadding: const EdgeInsets.all(12),
|
||||||
items: selectedItem == 0 ? allBots : state.imageBots,
|
items: selectedBotType == 'text'
|
||||||
|
? allBots
|
||||||
|
: state.imageBots,
|
||||||
headerBuilder: (context, bot, enabled) =>
|
headerBuilder: (context, bot, enabled) =>
|
||||||
botRow(bot, context),
|
botRow(bot, context),
|
||||||
listItemBuilder:
|
listItemBuilder: (context, bot, isSelected,
|
||||||
(context, bot, isSelected, onItemSelect) =>
|
onItemSelect) =>
|
||||||
botRow(bot, context),
|
botRow(bot, context),
|
||||||
initialItem:
|
initialItem: assistant != null
|
||||||
(selectedItem == 0 ? allBots : state.imageBots)
|
? initialBot
|
||||||
|
: (selectedBotType == 'text'
|
||||||
|
? allBots
|
||||||
|
: state.imageBots)
|
||||||
.first,
|
.first,
|
||||||
hideSelectedFieldWhenExpanded: false,
|
hideSelectedFieldWhenExpanded: false,
|
||||||
decoration: CustomDropdownDecoration(
|
decoration: CustomDropdownDecoration(
|
||||||
|
|
@ -186,26 +363,30 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
.surface
|
.surface
|
||||||
.withOpacity(0.5),
|
.withOpacity(0.5),
|
||||||
),
|
),
|
||||||
closedBorder: Border.all(color: Colors.grey),
|
closedBorder:
|
||||||
|
Border.all(color: Colors.grey),
|
||||||
closedFillColor:
|
closedFillColor:
|
||||||
Colors.grey.shade100.withOpacity(0.1),
|
Colors.grey.shade100.withOpacity(0.1),
|
||||||
expandedFillColor:
|
expandedFillColor: Theme.of(context)
|
||||||
Theme.of(context).colorScheme.surface),
|
.colorScheme
|
||||||
|
.surface),
|
||||||
// hintText: "انتخاب کنید",
|
// hintText: "انتخاب کنید",
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
// setState(() {
|
setState(() {
|
||||||
// selectedItem = value;
|
selectedBotId = value!.id!;
|
||||||
// });
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
title(text: 'دستورالعمل'),
|
title(text: 'دستورالعمل'),
|
||||||
Form(
|
Form(
|
||||||
key: _formDescKey,
|
key: _formPromptKey,
|
||||||
child: DidvanTextField(
|
child: DidvanTextField(
|
||||||
|
initialValue: prompt,
|
||||||
hintText:
|
hintText:
|
||||||
'به ربات خود بگویید که چگونه رفتار کند و چگونه به پیامهای کاربر پاسخ دهد. سعی کنید تا حد امکان واضح و مشخص باشید.',
|
'به ربات خود بگویید که چگونه رفتار کند و چگونه به پیامهای کاربر پاسخ دهد. سعی کنید تا حد امکان واضح و مشخص باشید.',
|
||||||
textInputType: TextInputType.multiline,
|
textInputType: TextInputType.multiline,
|
||||||
|
|
@ -214,6 +395,9 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
maxLength: 400,
|
maxLength: 400,
|
||||||
hasHeight: false,
|
hasHeight: false,
|
||||||
showLen: true,
|
showLen: true,
|
||||||
|
onChanged: (value) {
|
||||||
|
prompt = value;
|
||||||
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
String? result;
|
String? result;
|
||||||
if (value.isEmpty) {
|
if (value.isEmpty) {
|
||||||
|
|
@ -228,7 +412,7 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
if (selectedItem == 0)
|
if (selectedBotType == 'text')
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
title(text: 'پایگاه دانش', isRequired: false),
|
title(text: 'پایگاه دانش', isRequired: false),
|
||||||
|
|
@ -242,20 +426,31 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius:
|
borderRadius:
|
||||||
DesignConfig.lowBorderRadius)),
|
DesignConfig.lowBorderRadius)),
|
||||||
onPressed: () {},
|
onPressed: () async {
|
||||||
|
final picks =
|
||||||
|
await MediaService.pickMultiFile();
|
||||||
|
if (picks != null) {
|
||||||
|
files.addAll(picks.xFiles);
|
||||||
|
}
|
||||||
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
CupertinoIcons.add,
|
CupertinoIcons.add,
|
||||||
color: Theme.of(context).colorScheme.caption,
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.caption,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 4,
|
width: 4,
|
||||||
),
|
),
|
||||||
DidvanText(
|
DidvanText(
|
||||||
'آپلود فایل (فایل صوتی، پی دی اف)',
|
'آپلود فایل (فایل صوتی، پی دی اف)',
|
||||||
color: Theme.of(context).colorScheme.caption,
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.caption,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
@ -266,21 +461,24 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
title(text: 'لینک یوتیوب', isRequired: false),
|
// title(text: 'لینک یوتیوب', isRequired: false),
|
||||||
Form(
|
// Form(
|
||||||
key: _formYouTubeKey,
|
// key: _formYouTubeKey,
|
||||||
child: DidvanTextField(
|
// child: DidvanTextField(
|
||||||
onChanged: (value) {},
|
// onChanged: (value) {
|
||||||
validator: (value) =>
|
// youtubeLink = value;
|
||||||
value.startsWith('https://www.youtube.com')
|
// },
|
||||||
? null
|
// validator: (value) =>
|
||||||
: 'باید لینک یوتیوب باشد',
|
// value.startsWith('https://www.youtube.com') ||
|
||||||
hintText: 'https://www.youtube.com/watch?v',
|
// value.isEmpty
|
||||||
),
|
// ? null
|
||||||
),
|
// : 'باید لینک یوتیوب باشد',
|
||||||
const SizedBox(
|
// hintText: 'https://www.youtube.com/watch?v',
|
||||||
height: 24,
|
// ),
|
||||||
),
|
// ),
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 24,
|
||||||
|
// ),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -296,11 +494,14 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
if (countOfLink.length != 3)
|
||||||
DidvanIconButton(
|
DidvanIconButton(
|
||||||
icon: CupertinoIcons.plus_circle_fill,
|
icon: CupertinoIcons.plus_circle_fill,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
if (countOfLink.last.isNotEmpty) {
|
||||||
countOfLink.add('');
|
countOfLink.add('');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
@ -319,7 +520,8 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
countOfLink.insert(index, value);
|
countOfLink.insert(index, value);
|
||||||
},
|
},
|
||||||
// validator: (value) {},
|
// validator: (value) {},
|
||||||
hintText: 'https://www.weforum.org/agenda/2024/08',
|
hintText:
|
||||||
|
'https://www.weforum.org/agenda/2024/08',
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
|
|
@ -364,7 +566,9 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
child: DidvanText(
|
child: DidvanText(
|
||||||
'در صورت فعال بودن، دستیار شما توسط سایرین قابل مشاهده بوده و مورد استفاده قرار میگیرد.',
|
'در صورت فعال بودن، دستیار شما توسط سایرین قابل مشاهده بوده و مورد استفاده قرار میگیرد.',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: Theme.of(context).colorScheme.caption,
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.caption,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -376,9 +580,11 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
width: 64,
|
width: 64,
|
||||||
height: 48,
|
height: 48,
|
||||||
child: DidvanSwitch(
|
child: DidvanSwitch(
|
||||||
value: false,
|
value: !isPrivate,
|
||||||
title: '',
|
title: '',
|
||||||
onChanged: (value) {},
|
onChanged: (value) {
|
||||||
|
isPrivate = value;
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -386,26 +592,31 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
inEdite
|
widget.id != null
|
||||||
? Flex(
|
? Flex(
|
||||||
direction: Axis.horizontal,
|
direction: Axis.horizontal,
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: DidvanButton(
|
child: Stack(
|
||||||
title: 'ذخیره تغییرات',
|
children: [
|
||||||
onPressed: () {
|
DidvanButton(
|
||||||
final List<bool> valid = [];
|
title: state.loadingCreate
|
||||||
valid.add(
|
? ''
|
||||||
!_formYouTubeKey.currentState!.validate());
|
: 'ذخیره تغییرات',
|
||||||
valid.add(
|
onPressed: () async =>
|
||||||
!_formNameKey.currentState!.validate());
|
onConfirm(state, selectedBotId),
|
||||||
valid.add(
|
),
|
||||||
!_formDescKey.currentState!.validate());
|
if (state.loadingCreate)
|
||||||
if (valid.firstWhere(
|
const Positioned.fill(
|
||||||
(element) => !element,
|
child: Center(
|
||||||
)) return;
|
child: SpinKitThreeBounce(
|
||||||
},
|
size: 32,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
|
@ -416,14 +627,16 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
child: DidvanButton(
|
child: DidvanButton(
|
||||||
title: 'حذف دستیار',
|
title: 'حذف دستیار',
|
||||||
style: ButtonStyleMode.flat,
|
style: ButtonStyleMode.flat,
|
||||||
color: Theme.of(context).colorScheme.error,
|
color:
|
||||||
|
Theme.of(context).colorScheme.error,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
ActionSheetUtils(context).openDialog(
|
ActionSheetUtils(context).openDialog(
|
||||||
data: ActionSheetData(
|
data: ActionSheetData(
|
||||||
title: 'حذف دستیار',
|
title: 'حذف دستیار',
|
||||||
titleIcon: DidvanIcons.trash_solid,
|
titleIcon: DidvanIcons.trash_solid,
|
||||||
titleColor:
|
titleColor: Theme.of(context)
|
||||||
Theme.of(context).colorScheme.error,
|
.colorScheme
|
||||||
|
.error,
|
||||||
content: const Column(
|
content: const Column(
|
||||||
children: [
|
children: [
|
||||||
DidvanText(
|
DidvanText(
|
||||||
|
|
@ -431,14 +644,34 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)));
|
),
|
||||||
|
onConfirmed: () async {
|
||||||
|
await state.deleteAssistants(
|
||||||
|
id: widget.id!);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: const DidvanButton(
|
: Column(
|
||||||
title: 'ذخیره',
|
children: [
|
||||||
|
DidvanButton(
|
||||||
|
title: state.loadingCreate ? '' : 'ذخیره',
|
||||||
|
onPressed: () async =>
|
||||||
|
onConfirm(state, selectedBotId)),
|
||||||
|
if (state.loadingCreate)
|
||||||
|
const Positioned.fill(
|
||||||
|
child: Center(
|
||||||
|
child: SpinKitThreeBounce(
|
||||||
|
size: 32,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
|
|
@ -446,7 +679,8 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -456,12 +690,11 @@ class _CreateBotAssistantsPageState extends State<CreateBotAssistantsPage> {
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
SkeletonImage(
|
||||||
child: CachedNetworkImage(
|
|
||||||
imageUrl: bot.image.toString(),
|
imageUrl: bot.image.toString(),
|
||||||
width: 42,
|
width: 42,
|
||||||
height: 42,
|
height: 42,
|
||||||
),
|
borderRadius: BorderRadius.circular(360),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'package:didvan/models/ai/bot_assistants_model.dart';
|
||||||
|
import 'package:didvan/models/ai/bot_assistants_req_model.dart';
|
||||||
import 'package:didvan/models/ai/bots_model.dart';
|
import 'package:didvan/models/ai/bots_model.dart';
|
||||||
import 'package:didvan/models/ai/tools_model.dart';
|
import 'package:didvan/models/ai/tools_model.dart';
|
||||||
import 'package:didvan/models/enums.dart';
|
import 'package:didvan/models/enums.dart';
|
||||||
|
|
@ -8,8 +10,13 @@ import 'package:didvan/services/network/request_helper.dart';
|
||||||
class CreateBotAssistantsState extends CoreProvier {
|
class CreateBotAssistantsState extends CoreProvier {
|
||||||
List<BotsModel> imageBots = [];
|
List<BotsModel> imageBots = [];
|
||||||
bool loadingImageBots = false;
|
bool loadingImageBots = false;
|
||||||
|
bool loadingCreate = false;
|
||||||
|
bool loading = false;
|
||||||
|
BotAssistants? assistant;
|
||||||
|
|
||||||
void getImageToolsBots() async {
|
void getImageToolsBots() async {
|
||||||
|
loadingImageBots = true;
|
||||||
|
|
||||||
final service = RequestService(
|
final service = RequestService(
|
||||||
RequestHelper.tools(),
|
RequestHelper.tools(),
|
||||||
);
|
);
|
||||||
|
|
@ -32,5 +39,65 @@ class CreateBotAssistantsState extends CoreProvier {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void createAssistants() {}
|
Future createAssistants(
|
||||||
|
{required final BotAssistantsReqModel data, final int? id}) async {
|
||||||
|
loadingCreate = true;
|
||||||
|
update();
|
||||||
|
|
||||||
|
final service = RequestService(
|
||||||
|
(id != null
|
||||||
|
? RequestHelper.updateAssistants(id)
|
||||||
|
: RequestHelper.createAssistants()),
|
||||||
|
body: data.toJson());
|
||||||
|
await service.multipartFilesCreateAssismants(
|
||||||
|
files: data.files,
|
||||||
|
image: data.image,
|
||||||
|
method: id != null ? 'PUT' : 'POST');
|
||||||
|
if (service.isSuccess) {
|
||||||
|
appState = AppState.idle;
|
||||||
|
loadingCreate = false;
|
||||||
|
update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
appState = AppState.failed;
|
||||||
|
loadingCreate = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future getAnAssistant({required final int id}) async {
|
||||||
|
loading = true;
|
||||||
|
update();
|
||||||
|
|
||||||
|
final service = RequestService(
|
||||||
|
RequestHelper.getAssistant(id),
|
||||||
|
);
|
||||||
|
await service.httpGet();
|
||||||
|
if (service.isSuccess) {
|
||||||
|
assistant = BotAssistants.fromJson(service.result['bot']);
|
||||||
|
appState = AppState.idle;
|
||||||
|
loading = false;
|
||||||
|
update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
appState = AppState.failed;
|
||||||
|
loading = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future deleteAssistants({required final int id}) async {
|
||||||
|
loadingCreate = true;
|
||||||
|
update();
|
||||||
|
|
||||||
|
final service = RequestService(RequestHelper.getAssistant(id));
|
||||||
|
await service.delete();
|
||||||
|
if (service.isSuccess) {
|
||||||
|
appState = AppState.idle;
|
||||||
|
loadingCreate = false;
|
||||||
|
update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
appState = AppState.failed;
|
||||||
|
loadingCreate = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:didvan/config/design_config.dart';
|
import 'package:didvan/config/design_config.dart';
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
|
|
@ -19,6 +18,7 @@ import 'package:didvan/views/widgets/didvan/scaffold.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||||
import 'package:didvan/views/widgets/search_field.dart';
|
import 'package:didvan/views/widgets/search_field.dart';
|
||||||
import 'package:didvan/views/widgets/shimmer_placeholder.dart';
|
import 'package:didvan/views/widgets/shimmer_placeholder.dart';
|
||||||
|
import 'package:didvan/views/widgets/skeleton_image.dart';
|
||||||
import 'package:didvan/views/widgets/state_handlers/empty_state.dart';
|
import 'package:didvan/views/widgets/state_handlers/empty_state.dart';
|
||||||
import 'package:didvan/views/widgets/state_handlers/sliver_state_handler.dart';
|
import 'package:didvan/views/widgets/state_handlers/sliver_state_handler.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -65,6 +65,7 @@ class _HistoryAiChatPageState extends State<HistoryAiChatPage> {
|
||||||
// floatingActionButton: openAiListBtn(context),
|
// floatingActionButton: openAiListBtn(context),
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
scrollController: scrollController,
|
scrollController: scrollController,
|
||||||
|
|
||||||
showSliversFirst: false,
|
showSliversFirst: false,
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
|
|
@ -258,14 +259,11 @@ class _HistoryAiChatPageState extends State<HistoryAiChatPage> {
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SkeletonImage(
|
||||||
|
imageUrl: chat.bot!.image.toString(),
|
||||||
width: 46,
|
width: 46,
|
||||||
height: 46,
|
height: 46,
|
||||||
child: ClipOval(
|
borderRadius: BorderRadius.circular(360),
|
||||||
child: CachedNetworkImage(
|
|
||||||
imageUrl: chat.bot!.image.toString(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 18,
|
width: 18,
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ class HistoryAiChatState extends CoreProvier {
|
||||||
|
|
||||||
Future<void> getSearchChats(
|
Future<void> getSearchChats(
|
||||||
{required final String q, final bool archived = false}) async {
|
{required final String q, final bool archived = false}) async {
|
||||||
|
appState = AppState.busy;
|
||||||
|
update();
|
||||||
final service = RequestService(
|
final service = RequestService(
|
||||||
archived
|
archived
|
||||||
? RequestHelper.aiSearchArchived(q)
|
? RequestHelper.aiSearchArchived(q)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:didvan/config/theme_data.dart';
|
import 'package:didvan/config/theme_data.dart';
|
||||||
import 'package:didvan/constants/app_icons.dart';
|
import 'package:didvan/constants/app_icons.dart';
|
||||||
import 'package:didvan/constants/assets.dart';
|
import 'package:didvan/constants/assets.dart';
|
||||||
|
|
@ -15,6 +14,7 @@ import 'package:didvan/views/home/home.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/divider.dart';
|
import 'package:didvan/views/widgets/didvan/divider.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||||
import 'package:didvan/views/widgets/shimmer_placeholder.dart';
|
import 'package:didvan/views/widgets/shimmer_placeholder.dart';
|
||||||
|
import 'package:didvan/views/widgets/skeleton_image.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
|
@ -358,12 +358,12 @@ class _HoshanDrawerState extends State<HoshanDrawer> {
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
SkeletonImage(
|
||||||
child: CachedNetworkImage(
|
|
||||||
imageUrl: chat.bot!.image.toString(),
|
imageUrl: chat.bot!.image.toString(),
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
)),
|
borderRadius: BorderRadius.circular(360),
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 12,
|
width: 12,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import 'package:didvan/constants/app_icons.dart';
|
||||||
import 'package:didvan/constants/assets.dart';
|
import 'package:didvan/constants/assets.dart';
|
||||||
import 'package:didvan/routes/routes.dart';
|
import 'package:didvan/routes/routes.dart';
|
||||||
import 'package:didvan/views/ai/ai_state.dart';
|
import 'package:didvan/views/ai/ai_state.dart';
|
||||||
|
import 'package:didvan/views/ai/bot_assistants_state.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/icon_button.dart';
|
import 'package:didvan/views/widgets/didvan/icon_button.dart';
|
||||||
import 'package:didvan/views/widgets/didvan/text.dart';
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -63,6 +64,8 @@ class HoshanAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
icon: DidvanIcons.antenna_light,
|
icon: DidvanIcons.antenna_light,
|
||||||
size: 32,
|
size: 32,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
context.read<BotAssistantsState>().getMyAssissmant();
|
||||||
|
|
||||||
Navigator.pushNamed(context, Routes.botAssistants);
|
Navigator.pushNamed(context, Routes.botAssistants);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue