Skip to content

Commit

Permalink
chore: tuning chatGPT prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
OnFireByte committed Aug 17, 2023
1 parent f30ef40 commit 44b72da
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/chatgpt/chatgpt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ChatgptService {
}

let message = CHAT_GPT_PROMPT + '\n\n' + url;
'\n\n' + this.parsingService.getAllPlainText(htmlString);
'\n\n' + this.parsingService.getAllPlainText(htmlString).slice(2000);

try {
const resp = await axios.post<ChatGPTResponse>(
Expand Down
6 changes: 3 additions & 3 deletions src/chatgpt/prompt.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const CHAT_GPT_PROMPT = `I have texts from a website.
Please tell me what the project is, and short description with its highlight in json format
desc should be short, between 15-20 word, must capture the main purpose
sometime it's come from github repo (I have url in first line), if so, the name should be "repoOwner/repoName", if not github
desc should be short, between 15-20 word, must capture the main purpose of the project, also tell what language/stack that work with this project,
some times it's come from github repo (url in first line), if so, the name should be "repoOwner/repoName"
{
"name": "foo",
"desc": "foo is bar",
"tags" : "backend" | "frontend" | "terminal" | "framework" | "devops" | "deployment" | "auth" | "git" | "ide" | "service" // array of related tag, 3 max (less is better), only the core concept of the project, no space (use slash instead), 15 character max, abbrev only if it's commonly known
"tags" : "backend" | "frontend" | "terminal" | "framework" | "devops" | "deployment" | "auth" | "git" | "ide" | "service" // array of related tag, 3 max, less is better, only the core concept of the project, no space (use slash instead), 15 character max, abbrev only if it's commonly known
}
make sure that your answer don't have anything except json, not even the \`\`\` or \`\`\`json part
Expand Down
2 changes: 1 addition & 1 deletion src/parsing/parsing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ParsingService {
return text.trim();
}

public getAllPlainText(htmlString: string): unknown {
public getAllPlainText(htmlString: string): string {
const dom = new JSDOM(htmlString);
const tempDiv = dom.window.document.createElement('div');
tempDiv.innerHTML = htmlString;
Expand Down

0 comments on commit 44b72da

Please sign in to comment.