-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/route
- Loading branch information
Showing
8 changed files
with
226 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/org/example/kukathonbackend/domain/commuting/domain/Commuting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.example.kukathonbackend.domain.commuting.domain; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.example.kukathonbackend.domain.user.domain.User; | ||
import org.example.kukathonbackend.domain.week.domain.Week; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
@Data | ||
@Table(name = "commuting") | ||
public class Commuting { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "commuting_id") | ||
private Long id; | ||
|
||
@Column(name = "date") | ||
private LocalDate date ; | ||
|
||
|
||
@Column(name = "commuting_time") | ||
private Integer commutingTime; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "week_id") | ||
private Week week; | ||
|
||
} |
70 changes: 70 additions & 0 deletions
70
src/main/java/org/example/kukathonbackend/domain/recommend/application/Recommend.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package org.example.kukathonbackend.domain.recommend.application; | ||
|
||
import org.apache.http.HttpEntity; | ||
import org.apache.http.HttpResponse; | ||
import org.apache.http.client.methods.HttpPost; | ||
import org.apache.http.entity.ContentType; | ||
import org.apache.http.entity.StringEntity; | ||
import org.apache.http.impl.client.CloseableHttpClient; | ||
import org.apache.http.impl.client.HttpClients; | ||
import org.apache.http.util.EntityUtils; | ||
import org.json.JSONObject; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
public class Recommend { | ||
|
||
public void SelfDevelopmentRecommend(String tagValue, Long time) { | ||
CloseableHttpClient httpClient = HttpClients.createDefault(); | ||
|
||
try { | ||
HttpPost request = new HttpPost("https://clovastudio.stream.ntruss.com/testapp/v1/chat-completions/HCX-003"); | ||
|
||
StringEntity params = new StringEntity("{\n" + | ||
" \"messages\" : [ {\n" + | ||
" \"role\" : \"system\",\n" + | ||
" \"content\" : \"- 당신은 자기계발추천 전문가입니다.\\r\\n- 시간에 알맞은 자기계발활동을 추천합니다\\r\\n- 자기계발활동은 총 3개를 추천해야합니다.\\r\\n- 운동, 스트레칭같은 움직이는 활동은 추천하지 않습니다.\\r\\n- 지하철 및 버스같은 공공장소에서 할 수 있는 자기계발활동만을 추천합니다.\\n- 최대한 다양한 자기계발활동을 추천합니다.\\r\\n\\r\\ninput : 버스 및 지하철에서 30분 동안 할 수 있는 자기계발활동을 추천해줘\\r\\noutput : 자기계발서 독서하기 | 주식 공부하기 | 유튜브로 악기 공부하기\"\n" + | ||
" }, {\n" + | ||
" \"role\" : \"user\",\n" + | ||
" \"content\" : \"input : 나는 " + tagValue + "을 가장 좋아해. 버스 및 지하철에서 " + time + "분 동안 할 수 있는 자기계발활동을 추천해줘\\r\\noutput : \"\n" + | ||
" } ],\n" + | ||
" \"topP\" : 0.8,\n" + | ||
" \"topK\" : 0,\n" + | ||
" \"maxTokens\" : 256,\n" + | ||
" \"temperature\" : 0.8,\n" + | ||
" \"repeatPenalty\" : 5.02,\n" + | ||
" \"stopBefore\" : [ ],\n" + | ||
" \"includeAiFilters\" : true,\n" + | ||
" \"seed\" : 0\n" + | ||
"}", ContentType.create("application/json", StandardCharsets.UTF_16)); | ||
|
||
request.setEntity(params); | ||
|
||
request.addHeader("X-NCP-CLOVASTUDIO-API-KEY", "NTA0MjU2MWZlZTcxNDJiY63jYug0FDdswQfuPc3APjJSqVN89avhAcRqL1FVh6SB"); | ||
request.addHeader("X-NCP-APIGW-API-KEY", "eqXwFOLTnhQPnrdo8Iub3Y3ZCAUXFzbeolSBxPR1"); | ||
request.addHeader("X-NCP-CLOVASTUDIO-REQUEST-ID", "f7fb56ea-5a39-4f4a-b91f-c72972b68274"); | ||
|
||
HttpResponse response = httpClient.execute(request); | ||
HttpEntity entity = response.getEntity(); | ||
|
||
if (entity != null) { | ||
String result = EntityUtils.toString(entity); | ||
JSONObject jsonResult = new JSONObject(result); | ||
JSONObject resultObject = jsonResult.getJSONObject("result"); | ||
JSONObject messageObject = resultObject.getJSONObject("message"); | ||
String content = messageObject.getString("content"); | ||
System.out.println(content); | ||
} | ||
|
||
} catch (Exception ex) { | ||
ex.printStackTrace(); | ||
} finally { | ||
try { | ||
httpClient.close(); | ||
} catch (Exception ex) { | ||
ex.printStackTrace(); | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/org/example/kukathonbackend/domain/tasklist/domain/TagEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.example.kukathonbackend.domain.tasklist.domain; | ||
|
||
public enum TagEnum { | ||
READING, // 독서 | ||
VIDEO_CONTENT, // 영상_컨텐츠 | ||
WEBTOON, // 웹툰 | ||
RELAXATION, // 휴식 | ||
STUDYING, // 공부 | ||
SNS, // SNS | ||
OTHER // 기타 | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/org/example/kukathonbackend/domain/tasklist/domain/TaskList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.example.kukathonbackend.domain.tasklist.domain; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.example.kukathonbackend.domain.commuting.domain.Commuting; | ||
import org.example.kukathonbackend.domain.week.domain.Week; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
@Data | ||
@Table(name = "task_list") | ||
public class TaskList { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "task_id") | ||
private Long id; | ||
|
||
@Column(name = "task") | ||
private String task; | ||
|
||
|
||
@Column(name = "tag") | ||
private TagEnum tag; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "commuting_id") | ||
private Commuting commuting; | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/org/example/kukathonbackend/domain/week/domain/Week.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.example.kukathonbackend.domain.week.domain; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.example.kukathonbackend.domain.user.domain.User; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
@Data | ||
@Table(name = "week") | ||
public class Week { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "week_id") | ||
private Long id; | ||
|
||
@Column(name = "start_day") | ||
private String startDay; | ||
|
||
@Column(name = "end_day") | ||
private String endDay; | ||
|
||
@Column(name = "goal") | ||
private String goal; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/org/example/kukathonbackend/domain/weeklygoal/domain/WeeklyGoal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.example.kukathonbackend.domain.weeklygoal.domain; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.example.kukathonbackend.domain.week.domain.Week; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
@Builder | ||
@Data | ||
@Table(name = "weekly_goal") | ||
public class WeeklyGoal { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "weekly_goal_id") | ||
private Long id; | ||
|
||
@Column(name = "goal", columnDefinition = "TEXT") | ||
private String goal; | ||
|
||
@Column(name = "goal_success") | ||
private Boolean goalSuccess; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "week_id") | ||
private Week week; | ||
} |