4
4
from flask import Flask , jsonify , request
5
5
from models import Experience , Education , Skill
6
6
from gpt_connection import get_improvement
7
- from spell_check import spell_check_json
7
+ from spell_check import spell_check
8
8
app = Flask (__name__ )
9
9
10
10
data = {
@@ -51,8 +51,8 @@ def experience():
51
51
52
52
if request .method == 'POST' :
53
53
json_data = request .json
54
- if json_data [ 'spell_check' ] :
55
- json_data = spell_check_json (json_data )
54
+ if json_data . get ( 'spell_check' ) and isinstance ( json_data . get ( 'description' ), str ) :
55
+ json_data [ 'description' ] = spell_check (json_data [ 'description' ] )
56
56
57
57
return jsonify (json_data )
58
58
@@ -68,9 +68,8 @@ def education():
68
68
69
69
if request .method == 'POST' :
70
70
json_data = request .json
71
- if json_data ['spell_check' ]:
72
- json_data = spell_check_json (json_data )
73
-
71
+ if json_data .get ('spell_check' ) and isinstance (json_data .get ('description' ), str ):
72
+ json_data ['description' ] = spell_check (json_data ['description' ])
74
73
return jsonify (json_data )
75
74
76
75
return jsonify ({})
@@ -103,8 +102,8 @@ def skill():
103
102
104
103
if request .method == 'POST' :
105
104
json_data = request .json
106
- if json_data [ 'spell_check' ] :
107
- json_data = spell_check_json (json_data )
105
+ if json_data . get ( 'spell_check' ) and isinstance ( json_data . get ( 'description' ), str ) :
106
+ json_data [ 'description' ] = spell_check (json_data [ 'description' ] )
108
107
109
108
return jsonify (json_data )
110
109
0 commit comments