Skip to content

Commit

Permalink
fix(#36): 최대 입력값 제한 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kimhji committed Feb 6, 2025
1 parent c4e5032 commit 0a4ed13
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion server/src/ai/ai.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export enum AIType {
Summary,
}

const contentMaxLength = 7600;

@Injectable()
export class AIService {
private summaryConfig: AINeed;
Expand Down Expand Up @@ -71,10 +73,17 @@ export class AIService {
};
}

cutContent(feedData: String) {
return feedData.length < contentMaxLength
? feedData
: feedData.substring(0, contentMaxLength);
}

async postAIReq(type: AIType, feedData: String) {
try {
const AIConfig = this.getConfigByType(type);
const body = this.getBody(type, feedData);
const cutData = this.cutContent(feedData);
const body = this.getBody(type, cutData);
let count = 0;
let resLength = -1;
let result = '';
Expand Down

0 comments on commit 0a4ed13

Please sign in to comment.