Skip to content

Commit

Permalink
Merge pull request #220 from Quickchive/hotfix-#219-test-to-live-prom…
Browse files Browse the repository at this point in the history
…pt-improvement

Hotfix/#219 test method에 반영된 개선안을 실제 서비스 method에도 적용
  • Loading branch information
hou27 authored Nov 17, 2023
2 parents 99a0a9e + 851211f commit 42155fc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/contents/contents.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,17 +844,19 @@ export class CategoryService {
const content = await this.contentUtil.getLinkContent(link);

let questionLines = [
"You are now auto categorizing machine. You can only answer a single category name or None. Here is the article's information:",
"You are a machine tasked with auto-categorizing articles based on information obtained through web scraping. You can only answer a single category name. Here is the article's information:",
];

if (title) {
questionLines.push(`The title is "${title.trim()}"`);
questionLines.push(
`The article in question is titled "${title.trim()}"`,
);
}

if (content) {
const contentLength = content.length / 2;
questionLines.push(
`The opening 150 characters of the article read, "${content
`The 150 characters of the article is, "${content
.replace(/\s/g, '')
.slice(contentLength - 150, contentLength + 150)
.trim()}"`,
Expand All @@ -871,9 +873,9 @@ export class CategoryService {

// Add the category options to the end of the list
questionLines.push(
`Please tell me the most appropriate category among the following. If none are suitable, return None. Here is Category options: [${categories.join(
`Please provide the most suitable category among the following. Here is Category options: [${categories.join(
', ',
)}]`,
)}, None]`,
);

// Join all lines together into a single string
Expand Down

0 comments on commit 42155fc

Please sign in to comment.