Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(be): update markdown prompt #61

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@nestjs/swagger": "^8.0.4",
"@nestjs/websockets": "^10.4.8",
"@prisma/client": "^5.22.0",
"bcrypt": "^5.1.1",
"bcryptjs": "^2.4.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"cookie-parser": "^1.4.7",
Expand All @@ -55,6 +55,7 @@
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@types/bcrypt": "^5.0.2",
"@types/bcryptjs": "^2.4.6",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.2",
"@types/multer": "^1.4.12",
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/ai/ai.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class AiService {
const requestData = {
messages: [
{
role: 'system',
role: 'user',
content: prompt,
},
{
Expand Down
18 changes: 11 additions & 7 deletions apps/server/src/ai/promt.constant.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
export const prompt = {
improveQuestion: `당신은 질문 개선 전문가입니다. 아래 사용자가 입력한 질문을 다음 기준에 따라 재작성해 주세요.
improveQuestion: `당신은 마크다운 질문 개선 전문가입니다. 아래 사용자가 입력한 마크다운 질문을 다음 지침에 따라 **재작성**해 주세요.

[지침]
1. **명확성과 이해 용이성**: 원래 질문의 의도와 핵심을 파악한 후, 누구나 쉽게 이해할 수 있도록 문장을 명확하게 다듬으세요.
2. **내용의 풍부함**: 필요할 경우 추가적인 배경 정보, 예시, 세부 사항 등을 포함하여 질문의 내용을 풍부하게 확장하세요.
3. **완전한 정보 제공**: 원래 질문에 누락되었을 수 있는 중요한 내용이나 맥락을 보완하여, 어떠한 정보도 생략되지 않도록 하세요.
4. **출력 형식**: 반드시 **최종적으로 재작성된 질문 텍스트만** 출력하세요. 추가 설명, 의견, 분석 등은 절대로 포함하지 마세요.
아래에 사용자가 입력한 질문이 주어집니다:
0. **마크다운 유지**: 원본 질문에 포함된 모든 링크, 이미지, 코드 블록 등 모든 마크다운 요소를 그대로 보존하세요. 수정 과정에서 형식이나 URL, 이미지 주소 등이 변경되거나 누락되지 않도록 주의하세요.
1. **명확성과 이해 용이성**: 원문의 의도와 핵심을 정확히 파악한 후, 누구나 쉽게 이해할 수 있도록 문장을 명료하게 다듬으세요.
2. **내용의 풍부함**: 필요한 경우 추가적인 배경 정보, 예시, 세부 사항 등을 포함하여 질문의 내용을 충분히 보완하고 확장하세요.
3. **완전한 정보 제공**: 원문에 누락되었을 수 있는 중요한 내용이나 맥락이 있다면 이를 추가하여 정보의 완전성을 확보하세요.
4. **출력 형식 준수**: 최종적으로 **재작성된 질문 텍스트만** 출력하세요. 추가 설명, 의견, 분석 등은 포함하지 말고, 반드시 모든 마크다운 요소(링크, 이미지 등)를 그대로 유지하세요. 링크는 []()형식, 이미지는 ![]()형식입니다.

아래에 사용자가 입력한 질문이 있습니다:
[사용자 질문 입력]
최종적으로 재작성된 질문만 출력해 주세요.`,

최종적으로 재작성된 질문 텍스트만 출력해 주세요.`,
} as const;
2 changes: 1 addition & 1 deletion apps/server/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Inject, Injectable, OnModuleInit } from '@nestjs/common';

Check warning on line 1 in apps/server/src/auth/auth.service.ts

View workflow job for this annotation

GitHub Actions / lint

'OnModuleInit' is defined but never used
import { JwtService } from '@nestjs/jwt';
import * as bcrypt from 'bcrypt';
import * as bcrypt from 'bcryptjs';
import Redis from 'ioredis';
import { v4 as uuid4 } from 'uuid';

Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/users/users.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import { PrismaClientKnownRequestError } from '@prisma/client/runtime/library';
import * as bcrypt from 'bcrypt';
import * as bcrypt from 'bcryptjs';

import { CreateUserDto } from './dto/create-user.dto';

Expand Down
37 changes: 26 additions & 11 deletions pnpm-lock.yaml

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

Loading