Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:[BE] 프런트 연동을 위한 api 추가와 agentPersona 개선 작업 #64

Merged
merged 15 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified agentPersona/__pycache__/config.cpython-311.pyc
Binary file not shown.
Binary file modified agentPersona/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file modified agentPersona/__pycache__/routes.cpython-311.pyc
Binary file not shown.
9 changes: 7 additions & 2 deletions agentPersona/app4.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from routes import main_bp
import os
from dotenv import load_dotenv
from flask_sqlalchemy import SQLAlchemy

# 환경 변수 로드
load_dotenv()
Expand All @@ -24,7 +25,11 @@
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = SQLALCHEMY_TRACK_MODIFICATIONS

# DB 초기화
db.init_app(app)
db.init_app(app) # Flask 앱과 연결

# 기존 테이블 메타데이터 반영
with app.app_context():
db.Model.metadata.reflect(bind=db.engine) # Spring Boot에서 관리하는 테이블 메타데이터 반영

# Blueprint 등록
app.register_blueprint(main_bp)
Expand All @@ -37,4 +42,4 @@
db.create_all() # 테이블 생성

if __name__ == "__main__":
app.run(port=5000, debug=True)
app.run(host="0.0.0.0", port=5000, debug=True)
5 changes: 4 additions & 1 deletion agentPersona/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Flask 설정
import os

SQLALCHEMY_DATABASE_URI = 'sqlite:///../data/testdb.sqlite'
# SQLALCHEMY_DATABASE_URI = 'sqlite:///../data/testdb.sqlite'

BASE_DIR = os.path.abspath(os.path.dirname(__file__)) # 현재 파일의 절대경로
SQLALCHEMY_DATABASE_URI = f'sqlite:///{os.path.join(BASE_DIR, "../data/testdb.sqlite")}'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.getenv("SECRET_KEY", "default_secret_key")
SESSION_COOKIE_SECURE = False
Expand Down
26 changes: 21 additions & 5 deletions agentPersona/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
from db import db

class TravelPlan(db.Model):
__tablename__ = 'travel_plans'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
# travel_date = db.Column(db.String(20))
# travel_days = db.Column(db.Integer)
# travel_mate = db.Column(db.String(50))
# travel_theme = db.Column(db.String(100))
plan_response = db.Column(db.Text)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
travel_info = db.Column(db.Text, nullable=True)
plan_response = db.Column(db.Text, nullable=True)
location_info = db.Column(db.Text, nullable=True)
# hash_tag = db.Column(db.Text, nullable=True)

# user = db.relationship("", backref=db.backref('travel_plans', lazy=True))

class SavedPlan(db.Model):
__tablename__ = 'saved_plans'
travel_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
travel_name = db.Column(db.Text, nullable=True)
travel_info = db.Column(db.Text, nullable=True)
plan_response = db.Column(db.Text, nullable=True)
location_info = db.Column(db.Text, nullable=True)
# hash_tag = db.Column(db.Text, nullable=True)

# user = db.relationship('User', backref=db.backref('saved_plans', lazy=True))
# travel_plan = db.relationship('TravelPlan', backref=db.backref('saved_in', lazy=True))
Binary file modified agentPersona/requirements.txt
Binary file not shown.
Loading