Skip to content

Commit efd35f6

Browse files
added copy button for AI response
1 parent 321d1c2 commit efd35f6

19 files changed

+215
-38
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

assets/akLogo.svg

Lines changed: 10 additions & 0 deletions
Loading

assets/babg.png

205 KB
Loading

assets/github1.png

6.24 KB
Loading

assets/linkedin.png

8.18 KB
Loading

lib/data/form_json.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ List<dynamic> formJSON = [
193193
"title": "MCQ Type Quiz",
194194
"disc": "Generate MCQs with Answer",
195195
"prompt":
196-
"Create a {number} multiple-choice quiz from text {topic}. The output should be in markdown format and include the question, options, and correct answer for each question. Each question should be based on a distinct concept within the text, and four options (including the correct answer) should be provided for each question. The correct answer should be indicated with an asterisk (*) immediately following the option. Ensure that each question and option is grammatically correct, semantically meaningful, and accurately reflects the content of the original text. To achieve this, we will leverage the expertise of an Instructional Designer, a Natural Language Processing Expert, a Quiz Creator, a Markdown Specialist, a Content Editor, a Domain Expert, a UX Designer, and a Data Analyst. The Domain Expert will work with us to identify key concepts in the text, the Data Analyst will use data analytics tools to analyze the results of the quiz and make improvements for future iterations.",
196+
"Create a {number} multiple-choice quiz for topic {topic}. The output include the question, options, and correct answer for each question. Each question should be based on a distinct concept within the topic. Ensure that each question and option is semantically meaningful, and accurately reflects the content of the original topic. To achieve this, we will leverage the expertise of a Quiz Creator, a Domain Expert, and a Data Analyst. The Domain Expert will work with us to identify key concepts in the topic, the Data Analyst will use data analytics tools to analyze the results of the quiz and make improvements for future iterations. Format: Each question must starts with 'Question' keyword ,all option must starts with (A, B, C, D) enclosed with parentheses and correct answer must starts with 'Answer' keyword.",
197197
"schema": {
198198
"properties": {
199199
"{topic}": {

lib/data/message_model.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class MessageModel {
2+
String text;
3+
String sender;
4+
5+
MessageModel({required this.text, required this.sender});
6+
}

lib/screen/chat_screen.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import 'package:flutter/foundation.dart';
22
import 'package:flutter/material.dart';
33
import 'package:student_ai/data/constants.dart';
44
import 'package:student_ai/data/globals.dart';
5+
import 'package:student_ai/data/message_model.dart';
56
import 'package:student_ai/services/api_service.dart';
67
import 'package:student_ai/widgets/message.dart';
7-
import 'package:student_ai/widgets/search_bar.dart';
8+
import 'package:student_ai/widgets/my_search_bar.dart';
89
import 'package:student_ai/widgets/typing_animation.dart';
910

1011
class ChatScreen extends StatefulWidget {
@@ -20,7 +21,7 @@ class ChatScreen extends StatefulWidget {
2021
}
2122

2223
class _ChatScreenState extends State<ChatScreen> {
23-
List<Message> msgList = [];
24+
List<MessageModel> msgList = [];
2425

2526
final TextEditingController newQueryController = TextEditingController();
2627
bool _isTyping = false;
@@ -33,7 +34,7 @@ class _ChatScreenState extends State<ChatScreen> {
3334
void sendMessage(String query) {
3435
if (widget.isFormRoute == false) {
3536
setState(() {
36-
msgList.insert(0, Message(text: query, sender: 'user'));
37+
msgList.insert(0, MessageModel(text: query, sender: 'user'));
3738
});
3839
}
3940
setState(() {
@@ -49,7 +50,7 @@ class _ChatScreenState extends State<ChatScreen> {
4950

5051
setState(() {
5152
_isTyping = false;
52-
msgList.insert(0, Message(text: fetchRes, sender: 'AI'));
53+
msgList.insert(0, MessageModel(text: fetchRes, sender: 'AI'));
5354
});
5455
} catch (e) {
5556
if (kDebugMode) {
@@ -120,7 +121,7 @@ class _ChatScreenState extends State<ChatScreen> {
120121
const SizedBox(
121122
height: 16,
122123
),
123-
SearchBar(
124+
MySearchBar(
124125
buttonColor: _isTyping ? kDarkWhite : kBlack,
125126
chatController: newQueryController,
126127
onTap: () {

lib/screen/home.dart

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
import 'dart:ui';
23

34
import 'package:flutter/material.dart';
45
import 'package:flutter_svg/flutter_svg.dart';
@@ -7,7 +8,8 @@ import 'package:student_ai/screen/my_form.dart';
78
import 'package:student_ai/services/api_service.dart';
89
import 'package:student_ai/widgets/api_input.dart';
910
import 'package:student_ai/widgets/card_widget.dart';
10-
import 'package:student_ai/widgets/search_bar.dart';
11+
import 'package:student_ai/widgets/info_card.dart';
12+
import 'package:student_ai/widgets/my_search_bar.dart';
1113
import 'package:student_ai/widgets/server_indicator.dart';
1214

1315
import '../data/constants.dart';
@@ -56,10 +58,12 @@ class _HomeState extends State<Home> {
5658
Widget build(BuildContext context) {
5759
return Container(
5860
decoration: const BoxDecoration(
59-
gradient: LinearGradient(
60-
begin: Alignment.topCenter,
61-
end: Alignment.bottomCenter,
62-
colors: [Colors.blue, kBackGroundColor, kOrange])),
61+
gradient: LinearGradient(
62+
begin: Alignment.topCenter,
63+
end: Alignment.bottomCenter,
64+
colors: [Colors.blue, kBackGroundColor, kOrange],
65+
),
66+
),
6367
child: Scaffold(
6468
extendBodyBehindAppBar: true,
6569
backgroundColor: Colors.transparent,
@@ -70,9 +74,21 @@ class _HomeState extends State<Home> {
7074
centerTitle: true,
7175
title: Row(
7276
children: [
73-
SvgPicture.asset(
74-
'assets/logo.svg',
75-
width: 35,
77+
GestureDetector(
78+
onTap: () => showDialog(
79+
context: context,
80+
builder: (BuildContext context) {
81+
return BackdropFilter(
82+
filter: ImageFilter.blur(
83+
sigmaY: 5,
84+
sigmaX: 5,
85+
),
86+
child: const InfoCard());
87+
}),
88+
child: SvgPicture.asset(
89+
'assets/logo.svg',
90+
width: 35,
91+
),
7692
),
7793
const SizedBox(
7894
width: 10,
@@ -97,7 +113,9 @@ class _HomeState extends State<Home> {
97113
content: Text(
98114
"Server is Down 🔻. Try again later!",
99115
style: TextStyle(
100-
color: kBlack, fontWeight: FontWeight.bold),
116+
color: kBlack,
117+
fontWeight: FontWeight.bold,
118+
),
101119
),
102120
),
103121
);
@@ -130,7 +148,7 @@ class _HomeState extends State<Home> {
130148
),
131149
),
132150
),
133-
SearchBar(
151+
MySearchBar(
134152
buttonColor: kBlack,
135153
chatController: chatController,
136154
onTap: () {

lib/services/api_service.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class ApiService {
4848
String content = choice['message']['content'];
4949
output += content;
5050
});
51+
print(resData);
5152

5253
return output;
5354
} catch (e) {

0 commit comments

Comments
 (0)