Skip to content

Commit

Permalink
fix: prompt text file
Browse files Browse the repository at this point in the history
  • Loading branch information
OnFireByte committed Aug 17, 2023
1 parent cda87ff commit f30ef40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/chatgpt/chatgpt.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Injectable, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import axios from 'axios';
import { readFileSync } from 'fs';
import { JSDOM } from 'jsdom';
import { ParsingService } from 'src/parsing/parsing.service';
import { ChatGPTData } from './dto/chatgpt-message.dto';
import { ChatGPTResponse } from './dto/chatgpt-response.dto';
import CHAT_GPT_PROMPT from './prompt';

@Injectable()
export class ChatgptService {
Expand Down Expand Up @@ -34,8 +34,7 @@ export class ChatgptService {
htmlString = dom.window.document.getElementById('readme').textContent;
}

let message =
readFileSync('./src/static/prompt.txt', 'utf8') + '\n\n' + url;
let message = CHAT_GPT_PROMPT + '\n\n' + url;
'\n\n' + this.parsingService.getAllPlainText(htmlString);

try {
Expand Down
6 changes: 4 additions & 2 deletions src/static/prompt.txt → src/chatgpt/prompt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
I have texts from a website.
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
Expand All @@ -8,5 +8,7 @@ sometime it's come from github repo (I have url in first line), if so, the name
"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
make sure that your answer don't have anything except json, not even the \`\`\` or \`\`\`json part
`;
export default CHAT_GPT_PROMPT;

0 comments on commit f30ef40

Please sign in to comment.