Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/video' into feature/video
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHyeonSu committed Feb 17, 2024
2 parents 66b88a3 + 491146b commit 968fa91
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .platform/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ http {
proxy_send_timeout 300s;
proxy_read_timeout 300s;
send_timeout 300s;
proxy_buffers 8 16k;
proxy_buffer_size 32k;
}

access_log /var/log/nginx/access.log main;
Expand Down
11 changes: 9 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"express-session": "^1.17.3",
"ffmpeg": "^0.0.4",
"fluent-ffmpeg": "^2.1.2",
"get-youtube-title": "^1.0.1",
"get-youtube-title-await": "^1.1.5",
"http-status-codes": "^2.3.0",
"install": "^0.13.0",
"jsonwebtoken": "^9.0.2",
Expand All @@ -50,6 +50,7 @@
"@babel/preset-env": "^7.23.7",
"babel-cli": "^6.26.0",
"babel-loader": "^9.1.3",
"get-youtube-title": "^1.0.1",
"nodemon": "^3.0.2",
"swagger": "^0.7.5",
"webpack": "^5.89.0",
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/summary.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getSummary, getTitle } from '../services/chatGPT.service.js';
import { readFileFromObjectStorage } from '../services/storage.service.js';
import { getScriptFileName } from '../services/storage.service.js';
import { chatGPTCall } from '../services/chatGPT.service.js';

import getYoutubeTitle from 'get-youtube-title';

export const summary = async (req, res) => {
Expand Down Expand Up @@ -37,7 +38,6 @@ export const summary = async (req, res) => {

const summaryResult = await getSummary(scriptText);
console.log("요약데이터",summaryResult);

// const startSummaryIndex = summaryResult.indexOf('{'); // 첫 번째 '{'의 인덱스 찾기
// console.log("찾은 인덱스",startSummaryIndex);
// const trimmedSummaryResponse = summaryResult.substring(startSummaryIndex);
Expand Down
29 changes: 17 additions & 12 deletions src/dtos/video.dto.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,25 @@ export const updateVideoResponseDTO=(video) =>{
return {"status": video}
}
export const getSimpleVideoResponseDTO=(video,tag)=>{
const videoData=[]
console.log("비디오 데이터",video);
console.log("태그 데이터",tag);
for(let i=0;i<tag.length;i++){
const tagData=[]
for(let j=0;j<tag[i].length;j++){
tagData.push({"name":tag[i][j].name});
}
videoData.push({"video_id":video[i].id,"category":video[i].category_id,"title":video[i].title,"description":video[i].description,"image":video[i].image,"link":video[i].link,"created_at":video[i].updated_at,"youtube_created_at":video[i].youtube_created_at,"open_at":video[i].open_at,"tag":tagData});
try {
const videoData=[]
console.log("비디오 데이터",video);
console.log("태그 데이터",tag);
for(let i=0;i<tag.length;i++){
const tagData=[]
for(let j=0;j<tag[i].length;j++){
tagData.push({"name":tag[i][j].name});
}
videoData.push({"video_id":video[i].id,"category":video[i].category_id,"title":video[i].title,"description":video[i].description,"image":video[i].image,"link":video[i].link,"created_at":video[i].updated_at,"youtube_created_at":video[i].youtube_created_at,"open_at":video[i].open_at,"tag":tagData});



}
console.log("최종데이터",videoData);
return {"videos":videoData};
} catch (error) {
return {"videos":[]}
}
console.log("최종데이터",videoData);
return {"videos":videoData};

}
export const insertDummyVideoReadResponseDTO=(data)=>{
return{"id":data};
Expand Down
1 change: 1 addition & 0 deletions src/routes/video.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const videoRoute = express.Router();

videoRoute.get('/dummyVideos/unRead',async(req,res)=>{
const result =await getUnReadDummyVideo(req,res);

})

videoRoute.get('/',async(req,res)=>{
Expand Down
6 changes: 4 additions & 2 deletions src/services/chatGPT.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ export const chatGPTCall = async (scriptText) => {


export const getTitle=async(title)=>{
console.log("유튜브제목",title);
try {
const system_prompt='Step 1. Please summarize the title in one sentence when you receive the title. It should be given in Korean. Please give it in this json format'+
const system_prompt='Step 1. Please summarize the title in one sentence when you receive the title. It should be given in Korean. Please give it in this json format '+
'{'+
'"Title": The original title summarized in one sentence'+
'}'

const prompt=`Run this script from step 1 , Make sure to fulfill the condition given to the system promport, response to korean. original title: ${title}\n `
const prompt=` Please summarize the title in one sentence when you receive the title. It should be given in Korean. Please give it in this json format
{ "title":"original title summary"} original title: ${title}\n `


const response = await axios.post(
Expand Down
33 changes: 19 additions & 14 deletions src/services/video.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,29 @@ export const viewSimpleVideo=async(data)=>{

} catch (error) {
console.error(error);
throw new BaseError(status.VIDEO_NOT_FOUND);
return {"videos":[]}
}

}
export const viewRecentVideo=async(data)=>{
console.log("서비스에서 전달되는 요청정보",data);
console.log("123");
const TagData=[];
const getVideoData=await getRecentVideo(data);
console.log(getVideoData[0].id);
for(let i =0; i<getVideoData.length;i++){
TagData.push(await getTag({
"videoID":getVideoData[i].id,
"version":"revision"
}));
try {
console.log("서비스에서 전달되는 요청정보",data);
console.log("123");
const TagData=[];
const getVideoData=await getRecentVideo(data);
console.log(getVideoData[0].id);
for(let i =0; i<getVideoData.length;i++){
TagData.push(await getTag({
"videoID":getVideoData[i].id,
"version":"revision"
}));
}
console.log("비디오 정보: ",getVideoData);
return getSimpleVideoResponseDTO(getVideoData,TagData);
} catch (error) {
return {"video":[]}
}
console.log("비디오 정보: ",getVideoData);
return getSimpleVideoResponseDTO(getVideoData,TagData);

}
export const viewCategoryVideo=async(data)=>{
try {
Expand Down Expand Up @@ -116,7 +121,7 @@ export const viewCategoryVideo=async(data)=>{
return getCategoryVideoResponseDTO(getVideoData,tagData);
} catch (error) {
console.error(error);
throw new BaseError(status.CATEGORY_IS_EMPTY);
return {"videos":[]}
}
}
async function findCategory(categoryData, category, user) {
Expand Down

0 comments on commit 968fa91

Please sign in to comment.