팀뷰어로 원격 pc를 제어하려면
host PC에 teamViewer host를 설치해야한다. (라이선스 있다고 눌러야 뜨네요)
참고링크: https://m.blog.naver.com/terry_daddy/223284278249
팀뷰어로 원격 pc를 제어하려면
host PC에 teamViewer host를 설치해야한다. (라이선스 있다고 눌러야 뜨네요)
참고링크: https://m.blog.naver.com/terry_daddy/223284278249
customGPT모델은 openAPI로 호출이 안되는 현상이 있네요.
그래서 자체훈련을 시키려면 fine-tuning모델이 맞고,
아래와 같이 생성하면 됩니다.
OpenAI에서 Fine-Tuning 모델을 생성하는 과정을 처음부터 끝까지 단계별로 설명하겠습니다. 🚀
Fine-Tuning을 통해 GPT-3.5 Turbo 또는 GPT-4를 특정한 스타일, 문체, 데이터에 맞게 최적화할 수 있습니다.
Fine-Tuning이란 기존 OpenAI 모델(GPT-3.5-Turbo, GPT-4)을 사용자의 특정 데이터에 맞춰 재훈련하는 과정입니다.
✅ 사용 사례:
Fine-Tuning을 하려면 OpenAI API 키가 필요합니다.
Fine-Tuning을 하려면 **훈련 데이터(training data)**를 만들어야 합니다.
OpenAI는 JSONL(JSON Lines) 형식의 데이터를 요구합니다.
Fine-Tuning 데이터는 "messages" 형식으로 작성됩니다.
(json형식 예제)
{"messages": [
{"role": "system", "content": "너는 친절한 금융 상담사야."},
{"role": "user", "content": "대출 금리가 어떻게 되나요?"},
{"role": "assistant", "content": "현재 대출 금리는 연 3.5%입니다."}
]}
jsonl형식.필요
{"messages": [{"role": "system", "content": "너는 친절한 채권 전문가야."}, {"role": "user", "content": "채권 회수 절차가 어떻게 되나요?"}, {"role": "assistant", "content": "채권 회수 절차는 1) 채무자 연락 2) 독촉장 발송 3) 법적 조치 순으로 진행됩니다."}]}
{"messages": [{"role": "system", "content": "너는 친절한 채권 전문가야."}, {"role": "user", "content": "부실채권을 매각할 수 있나요?"}, {"role": "assistant", "content": "네, 부실채권은 채권 매입 기관을 통해 매각할 수 있습니다."}]}
📌 JSONL 파일을 만들고, .jsonl 확장자로 저장해야 합니다.
OpenAI API를 사용하여 준비한 JSONL 파일을 업로드합니다.
curl -X POST "https://api.openai.com/v1/files" \
-H "Authorization: Bearer YOUR_OPENAI_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F "file=@training_data.jsonl" \
-F "purpose=fine-tune"
응답예시:
{
"id": "file-abc123",
"object": "file",
"bytes": 12345,
"created_at": 1700000000,
"filename": "training_data.jsonl",
"purpose": "fine-tune"
}
✅ "id" 값을 저장 (file-abc123) → Fine-Tuning을 수행할 때 사용됩니다.
이제 Fine-Tuning을 실행하여 맞춤형 모델을 학습시킵니다.
curl -X POST "https://api.openai.com/v1/fine_tuning/jobs" \
-H "Authorization: Bearer YOUR_OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-3.5-turbo",
"training_file": "file-abc123",
"hyperparameters": {
"n_epochs": 3
}
}'
응답 예시:
{
"id": "ftjob-xyz789",
"object": "fine_tuning.job",
"model": "gpt-3.5-turbo",
"training_file": "file-abc123",
"status": "running",
"created_at": 1700000000
}
✅ "id" (ftjob-xyz789)가 Fine-Tuning 작업의 ID입니다.
✅ 훈련이 완료되면 새로운 모델 ID가 생성됩니다.
Fine-Tuning이 얼마나 진행되었는지 확인하려면 아래 명령어를 실행합니다.
curl -X GET "https://api.openai.com/v1/fine_tuning/jobs/ftjob-xyz789" \
-H "Authorization: Bearer YOUR_OPENAI_API_KEY"
응답 예시:
{
"id": "ftjob-xyz789",
"status": "succeeded",
"fine_tuned_model": "ft:gpt-3.5-turbo:your-org:custom-model"
}
✅ Fine-Tuning이 완료되면 "fine_tuned_model" 값이 생성됩니다.
✅ "ft:gpt-3.5-turbo:your-org:custom-model"이 새로운 모델 ID입니다.
Fine-Tuning이 완료되면 새로운 모델 ID를 사용하여 API 호출이 가능합니다.
curl https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ft:gpt-3.5-turbo:your-org:custom-model",
"messages": [{"role": "user", "content": "채권 회수 절차가 어떻게 되나요?"}],
"temperature": 0.7
}'
📌 Fine-Tuned 모델이 기존 GPT-3.5보다 더 정확하게 원하는 답변을 생성합니다.
Fine-Tuning 모델을 더 이상 사용하지 않으려면 삭제할 수 있습니다.
📌 이 작업은 영구적이므로 주의해야 합니다.
✅ 1) JSONL 형식으로 Fine-Tuning 데이터 준비
✅ 2) API를 사용하여 JSONL 파일 업로드 (/v1/files)
✅ 3) Fine-Tuning 실행 (/v1/fine_tuning/jobs)
✅ 4) 모델 학습이 완료되면 Fine-Tuning 모델 ID 확인
✅ 5) Fine-Tuned 모델을 API에서 호출하여 사용
✅ 6) 필요할 경우 Fine-Tuned 모델 삭제 가능
Custom GPT를 설정하려면 OpenAI 플랫폼에서 새로운 Custom GPT를 생성해야 합니다.
Custom GPT는 OpenAI의 Guided Setup을 통해 설정할 수 있습니다.
이 과정에서는 GPT의 성격, 역할, 학습 데이터, API 기능 설정을 조정할 수 있습니다.
Custom GPT의 동작 방식을 정의하는 가장 중요한 과정입니다.
✅ 사용자가 Custom GPT에 대한 추가 정보를 제공할 수도 있습니다.
예시:
Custom GPT는 API 호출 및 외부 도구(Functions)와 연동할 수도 있습니다.
예제:
{
"name": "채권 회수 API",
"description": "고객의 채권 정보를 조회하고 법률 절차를 안내합니다.",
"parameters": {
"채권자명": {
"type": "string",
"description": "채권자의 이름"
},
"채무자명": {
"type": "string",
"description": "채무자의 이름"
}
}
}
이 기능을 활용하면 API를 직접 호출하여 최신 정보를 제공하는 Custom GPT를 만들 수 있습니다.
Custom GPT를 OpenAI API에서 사용하려면, API에서 model 값을 Custom GPT ID로 변경하면 됩니다.
import okhttp3.*;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
@Service
public class OpenAICustomService {
private static final String API_URL = "https://api.openai.com/v1/chat/completions";
private final OkHttpClient client = new OkHttpClient();
@Value("${openai.api.key}")
private String apiKey;
@Value("${openai.custom.gpt.id}") // Custom GPT ID (예: gpt-4-custom-XXXXX)
private String customGptId;
public String getCustomGptResponse(String userInput) throws IOException {
String json = "{"
+ "\"model\":\"" + customGptId + "\","
+ "\"messages\":[{\"role\":\"user\",\"content\":\"" + userInput + "\"}],"
+ "\"temperature\":0.7"
+ "}";
RequestBody body = RequestBody.create(json, MediaType.get("application/json"));
Request request = new Request.Builder()
.url(API_URL)
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("Unexpected code " + response);
}
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(response.body().string());
return rootNode.get("choices").get(0).get("message").get("content").asText();
}
}
}
✅ 설정 완료 후 API에서 Custom GPT를 호출하면, 사전에 설정한 역할, 동작 방식, 지식 등을 반영한 응답을 반환합니다.
✅ OpenAI API에서 Custom GPT를 사용하려면 먼저 OpenAI 플랫폼에서 설정이 필요합니다.
✅ 사전 설정을 통해 특정한 업무(법률, 금융, IT 등)에 최적화된 GPT를 만들 수 있습니다.
✅ API에서 model 값을 Custom GPT ID로 변경하면 사전 설정이 반영된 맞춤형 응답을 받을 수 있습니다.
curl https://api.openai.com/v1/models \
-H "Authorization: Bearer YOUR_OPENAI_API_KEY"
6. custom GPT 구성(Config)
- 우측 큰화면의 상단에 GPT제목을 누르고, 편집을 누른 후, "구성"탭에서 설정.
인증형식은 API key로 하고, https://platform.openai.com/ 에서 카드설정+발급받은 키를 이용하게 되며,
인증방식은 기본이 아닌-> "Bearer" 로 설정하는게 편함.
심플 get용 스키마:
{
"openapi": "3.1.0",
"info": {
"title": "간단한 GET API",
"description": "GET 요청을 받아 텍스트를 반환하는 API",
"version": "v1.0.0"
},
"servers": [
{
"url": "https://api.example.com"
}
],
"paths": {
"/hello": {
"get": {
"summary": "텍스트 반환",
"operationId": "getHello",
"responses": {
"200": {
"description": "성공적인 응답",
"content": {
"text/plain": {
"schema": {
"type": "string",
"example": "Hello, GPT!"
}
}
}
}
}
}
}
}
}
post용 스키마:
{
"openapi": "3.1.0",
"info": {
"title": "채권 조회 API",
"description": "채권자 및 채무자 정보를 입력하면 채권 상태를 반환합니다.",
"version": "v1.0.0"
},
"servers": [
{
"url": "https://api.example.com"
}
],
"paths": {
"/getDebtStatus": {
"post": {
"summary": "채권 상태 조회",
"operationId": "getDebtStatus",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DebtRequest"
}
}
}
},
"responses": {
"200": {
"description": "채권 상태 응답",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DebtResponse"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"DebtRequest": {
"type": "object",
"properties": {
"채권자명": {
"type": "string",
"description": "채권자의 이름"
},
"채무자명": {
"type": "string",
"description": "채무자의 이름"
}
},
"required": ["채권자명", "채무자명"]
},
"DebtResponse": {
"type": "object",
"properties": {
"결과": {
"type": "string",
"description": "응답 상태 (성공 또는 실패)"
},
"채권 상태": {
"type": "string",
"description": "채권의 현재 상태 (예: 연체, 회수 완료 등)"
},
"회수 가능 금액": {
"type": "number",
"description": "현재 회수 가능한 금액 (원화 기준)"
}
}
}
}
}
}
spreadJs의 디자이너를 통해 .sjs파일을 만들어 포매팅에 이용할 수 있다.
import React, { useEffect, useRef, useState } from 'react';
import Head from 'next/head';
import GC from '@mescius/spread-sheets'; // 또는 '@grapecity/spread-sheets'
import '@mescius/spread-sheets-resources-ko';
import '@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css';
const HomePage = () => {
const containerRef = useRef(null);
const [spread, setSpread] = useState(null);
useEffect(() => {
if (containerRef.current && !spread) {
const newSpread = new GC.Spread.Sheets.Workbook(containerRef.current, { sheetCount: 1 });
setSpread(newSpread);
console.log('Spread initialized:', newSpread);
// .sjs 파일 로드
fetch('/data/spreadsheet.sjs')
.then(response => response.json())
.then(json => {
newSpread.fromJSON(json);
console.log('Spread loaded from .sjs file:', json);
})
.catch(error => console.error('Error loading .sjs file:', error));
}
}, [containerRef, spread]);
useEffect(() => {
return () => {
if (spread) {
spread.destroy();
}
};
}, [spread]);
return (
<div>
<Head>
<link rel="stylesheet" href="/scripts/gc.spread.sheets.17.0.7.css" />
</Head>
<h1>SpreadJS Example</h1>
<div ref={containerRef} className="spreadContainer" style={{ top: '240px', bottom: '10px', position: 'relative', height: '500px' }}>
{/* SpreadJS 워크북이 여기에 표시됩니다 */}
</div>
</div>
);
};
export default HomePage;
엑셀에서 매크로 사용전에 체크사항:
개발도구 리본 보이기:
파일->옵션->리본설정
엑셀매크로에서 이미지 전송 예제: 이미지뷰어 필수
Sub SendImageToKakaoTalk()
Dim imgPath As String
Dim wsShell As Object
' 이미지 파일 경로 설정
imgPath = "C:\Path\To\Your\Image.jpg"
' Shell 객체 생성
Set wsShell = CreateObject("WScript.Shell")
' 이미지 파일 열기
wsShell.Run Chr(34) & imgPath & Chr(34)
Application.Wait (Now + TimeValue("0:00:02")) ' 이미지 파일이 열리기를 기다립니다.
' 이미지 파일을 복사합니다.
wsShell.SendKeys "^a", True ' 전체 선택 (Ctrl + A)
Application.Wait (Now + TimeValue("0:00:01"))
wsShell.SendKeys "^c", True ' 복사 (Ctrl + C)
Application.Wait (Now + TimeValue("0:00:01"))
' 카카오톡 창 활성화
AppActivate "카카오톡"
Application.Wait (Now + TimeValue("0:00:01"))
' 카카오톡 대화창으로 이동 (여기서는 예시로 첫 번째 채팅방)
wsShell.SendKeys "^l", True ' 채팅방 리스트로 이동 (Ctrl + L)
Application.Wait (Now + TimeValue("0:00:01"))
wsShell.SendKeys "{TAB}", True ' 첫 번째 채팅방으로 이동
Application.Wait (Now + TimeValue("0:00:01"))
wsShell.SendKeys "~", True ' 채팅방 열기 (Enter)
Application.Wait (Now + TimeValue("0:00:01"))
' 이미지 붙여넣기 및 전송
wsShell.SendKeys "^v", True ' 붙여넣기 (Ctrl + V)
Application.Wait (Now + TimeValue("0:00:01"))
wsShell.SendKeys "~", True ' 전송 (Enter)
' 다시 엑셀로 포커스 이동
AppActivate Application.Caption
End Sub
엑셀매크로에서 Rest API
Sub GetRequestExample()
Dim xmlhttp As Object
Dim url As String
Dim response As String
' MSXML2.XMLHTTP 객체 생성
Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
' API URL 설정
url = "https://api.example.com/data"
' GET 요청 초기화
xmlhttp.Open "GET", url, False
' 요청 헤더 설정 (필요한 경우)
xmlhttp.setRequestHeader "Content-Type", "application/json"
' 요청 보내기
xmlhttp.send
' 응답 받기
response = xmlhttp.responseText
' 응답 출력
MsgBox response
' 객체 해제
Set xmlhttp = Nothing
End Sub
Sub PostRequestExample()
Dim xmlhttp As Object
Dim url As String
Dim postData As String
Dim response As String
' MSXML2.XMLHTTP 객체 생성
Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
' API URL 설정
url = "https://api.example.com/data"
' POST 데이터 설정 (JSON 형식 예시)
postData = "{""name"":""John"",""age"":30}"
' POST 요청 초기화
xmlhttp.Open "POST", url, False
' 요청 헤더 설정
xmlhttp.setRequestHeader "Content-Type", "application/json"
' 요청 보내기
xmlhttp.send postData
' 응답 받기
response = xmlhttp.responseText
' 응답 출력
MsgBox response
' 객체 해제
Set xmlhttp = Nothing
End Sub
다운로드 이미지 예제
Sub DownloadFile()
Dim http As Object
Dim url As String
Dim localFilePath As String
Dim binaryStream As Object
' 다운로드할 파일의 URL
url = "http://localhost:8080/download/file"
' 저장할 파일 경로
localFilePath = "C:\path\to\save\downloadedfile.ext"
' Create XMLHTTP object
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", url, False
http.send
If http.Status = 200 Then
If Not IsNull(http.responseBody) And LenB(http.responseBody) > 0 Then
' Create binary stream object
Set binaryStream = CreateObject("ADODB.Stream")
binaryStream.Type = 1 ' Binary
binaryStream.Open
binaryStream.Write http.responseBody
binaryStream.SaveToFile localFilePath, 2 ' Save binary data to file
binaryStream.Close
MsgBox "File downloaded successfully!"
Else
MsgBox "The server returned null or empty response."
End If
Else
MsgBox "Failed to download file. Status: " & http.Status
End If
' Clean up
Set http = Nothing
Set binaryStream = Nothing
End Sub
Git 저장소의 히스토리를 포함하여 복사해서 다른 저장소로 옮기는 방법
1. 기존 저장소를 --mirror로 받는다.
$git clone --mirror <기존_저장소_URL>
2. 새 저장소를 만들고 그 URL을 얻은 다음..
3. $cd 기존_저장소_URL
$git push --mirror <새_저장소_URL>
1 서브모듈 추가하고 싶은 폴더로 가서
$git submodule add https://github.com/example/submodule.git path/to/submodule
2 변경 사항 커밋: 서브모듈을 추가한 후, .gitmodules 파일과 서브모듈 디렉토리에 대한 변경 사항을 커밋합니다.
git add .
git commit -m "Add submodule"
3. git push
=========
전체 pull 하고 싶을때
최초한번
git submodule update --init --recursive
그 후
git submodule update --remote --recursive
GitHub에서 특정 리포지토리를 clone하고 SSH 키를 설정하여 반복적으로 로그인하지 않도록 하는 방법은 다음과 같습니다:
만약 A PC에서 생성한 SSH 키를 B PC에서도 사용하려면, A PC에서 생성한 키를 B PC로 복사해야 합니다.
Start-Service ssh-agent
ssh-add C:\Users\<YourUsername>\.ssh\id_ed25519
혹시 git 이 잘 안된다면 $which ssh 를 해보면 /usr/bin/ssh 가 나오는 경우가 있는데,
이걸 "/c/Windows/System32/OpenSSH/ssh" 를 사용하도록 바꿔야 한다.
간단하게 mv /usr/bin/ssh /usr/bin/ssh-backup 으로 없애버리면 된다.