Skip to content

Commit

Permalink
πŸš‘ Hot Fix - Data Length Error & Sign Up Logic Mistake (#75)
Browse files Browse the repository at this point in the history
* fix: Content Length

* feat: Length Prompt

* fix: Sign Up Logic
  • Loading branch information
HyungJoonSon authored Dec 9, 2024
1 parent 5697154 commit 7c402f1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ class LoginViewModel extends GetxController {
Future<void> _updateDeviceToken() async {
String? token = await FirebaseMessaging.instance.getToken();

print('token: $token');

await _updateDeviceTokenInUserUsecase.execute(
UpdateDeviceTokenInUserCondition(
deviceToken: token!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ import 'package:get/get.dart';
import 'package:wooahan/domain/usecase/auth/sign_up_by_default_use_case.dart';
import 'package:wooahan/domain/usecase/auth/validate_authentication_code_use_case.dart';
import 'package:wooahan/domain/usecase/auth/validate_email_use_case.dart';
import 'package:wooahan/domain/usecase/user/update_device_token_in_user_use_case.dart';
import 'package:wooahan/presentation/view_model/sign_up/sign_up_view_model.dart';

class SignUpBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<SignUpByDefaultUseCase>(
() => SignUpByDefaultUseCase(),
);
Get.lazyPut<ValidateEmailUseCase>(
() => ValidateEmailUseCase(),
);
Get.lazyPut<ValidateAuthenticationCodeUseCase>(
() => ValidateAuthenticationCodeUseCase(),
);
Get.lazyPut<SignUpByDefaultUseCase>(
() => SignUpByDefaultUseCase(),
Get.lazyPut<UpdateDeviceTokenInUserUseCase>(
() => UpdateDeviceTokenInUserUseCase(),
);

Get.lazyPut<SignUpViewModel>(() => SignUpViewModel());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// ignore_for_file: constant_identifier_names

import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wooahan/app/utility/validator_util.dart';
Expand All @@ -8,9 +9,11 @@ import 'package:wooahan/core/wrapper/state_wrapper.dart';
import 'package:wooahan/domain/condition/auth/sign_up_by_default_condition.dart';
import 'package:wooahan/domain/condition/auth/validate_authentication_code_condition.dart';
import 'package:wooahan/domain/condition/auth/validate_email_condition.dart';
import 'package:wooahan/domain/condition/user/update_device_token_in_user_condition.dart';
import 'package:wooahan/domain/usecase/auth/sign_up_by_default_use_case.dart';
import 'package:wooahan/domain/usecase/auth/validate_authentication_code_use_case.dart';
import 'package:wooahan/domain/usecase/auth/validate_email_use_case.dart';
import 'package:wooahan/domain/usecase/user/update_device_token_in_user_use_case.dart';

class SignUpViewModel extends GetxController {
/* ------------------------------------------------------ */
Expand All @@ -30,6 +33,7 @@ class SignUpViewModel extends GetxController {
late final ValidateEmailUseCase _validateEmailUseCase;
late final ValidateAuthenticationCodeUseCase
_validateAuthenticationCodeUseCase;
late final UpdateDeviceTokenInUserUseCase _updateDeviceTokenInUserUseCase;

/* ------------------------------------------------------ */
/* Private Fields --------------------------------------- */
Expand Down Expand Up @@ -68,6 +72,8 @@ class SignUpViewModel extends GetxController {
_validateEmailUseCase = Get.find<ValidateEmailUseCase>();
_validateAuthenticationCodeUseCase =
Get.find<ValidateAuthenticationCodeUseCase>();
_updateDeviceTokenInUserUseCase =
Get.find<UpdateDeviceTokenInUserUseCase>();

_isEnableInEmailInput = false.obs;
_isEnableInPasswordInput = false.obs;
Expand Down Expand Up @@ -220,6 +226,8 @@ class SignUpViewModel extends GetxController {
);

if (state.success) {
await _updateDeviceToken();

_isEnableInCompletedSignUp.value = true;
}

Expand All @@ -228,6 +236,16 @@ class SignUpViewModel extends GetxController {
message: state.message,
);
}

Future<void> _updateDeviceToken() async {
String? token = await FirebaseMessaging.instance.getToken();

await _updateDeviceTokenInUserUseCase.execute(
UpdateDeviceTokenInUserCondition(
deviceToken: token!,
),
);
}
}

class EmailInputState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Answer {
/* -------------------------------------------- */
/* Information Column - Input ----------------- */
/* -------------------------------------------- */
@Column(name = "content", length = 500, nullable = false)
@Column(name = "content", length = 2000, nullable = false)
private String content;

@Column(name = "created_at", nullable = false)
Expand Down
5 changes: 4 additions & 1 deletion server-llm/generation/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def __init__(self):
),
SystemMessagePromptTemplate.from_template(
"""
Third, you must answer in English and must not provide vectorized answers or translate into other languages. You must answer exclusively in English.
Third
- you must answer in English and must not provide vectorized answers or translate into other languages. You must answer exclusively in English.
- maximum length of the answer is 1000 characters.
"""
),
SystemMessagePromptTemplate.from_template(
Expand Down

0 comments on commit 7c402f1

Please sign in to comment.