generated from staticwebdev/vanilla-basic
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Kimminju0831/quatergirrrit
- Loading branch information
Showing
9 changed files
with
125 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action | ||
# More GitHub Actions for Azure: https://github.com/Azure/actions | ||
|
||
name: Build and deploy Node.js project to Azure Function App - quatergirit-api | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root | ||
NODE_VERSION: '18.x' # set this to the node version to use (supports 8.x, 10.x, 12.x) | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: windows-latest | ||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node ${{ env.NODE_VERSION }} Environment | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: 'Resolve Project Dependencies Using Npm' | ||
shell: pwsh | ||
run: | | ||
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}' | ||
npm install | ||
npm run build --if-present | ||
npm run test --if-present | ||
popd | ||
- name: 'Run Azure Functions Action' | ||
uses: Azure/functions-action@v1 | ||
id: fa | ||
with: | ||
app-name: 'quatergirit-api' | ||
slot-name: 'Production' | ||
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} | ||
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_9970B2D7920C44409B733A2F378F0148 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
const axios = require('axios'); | ||
|
||
module.exports = async function (context, req) { | ||
|
||
const dep = "동대구"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# ChatGPT turbo 3.5 이용하여 챗봇 구현 | ||
|
||
""" | ||
pip install requests | ||
""" | ||
import os | ||
import requests | ||
import openai | ||
|
||
MODEL = "gpt-3.5-turbo" | ||
|
||
# 출발역, 도착역, 출발 날짜, 열차 번호, 이름, 발권 매수 | ||
|
||
departure = "물금역" | ||
arrival = "대전역" | ||
time = "12/11 12:23" | ||
ticket_num = "3" | ||
name = "홍길동" | ||
|
||
CONTENT = departure + "에서 " + arrival + "으로 " + time + " 에 가는 기차 승차권을 " + ticket_num + "매 예매하는 말을 1줄로 해줘" | ||
|
||
response = openai.ChatCompletion.create( | ||
model=MODEL, | ||
messages=[ | ||
{"role": "user", "content": "동대구역에서 서울역으로 11/15 16:24 에 가는 기차 승차권을 2매 예매하는 말을 1줄로 해줘."}, | ||
{"role": "assistant", "content": "동대구역에서 서울역으로 11월 15일 오후 4시 24분에 출발하는 기차 승차권 2매를 예매하고 싶어요."}, | ||
{"role": "user", "content": CONTENT}, | ||
], | ||
temperature=0, | ||
) | ||
|
||
result = "안녕하세요, 원콜 서비스를 이용하려 합니다. " | ||
result += response['choices'][0]['message']['content'] | ||
result += " 제 이름은 " + name + "입니다." | ||
|
||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"authLevel": "anonymous", | ||
"type": "httpTrigger", | ||
"direction": "in", | ||
"name": "req", | ||
"methods": [ | ||
"get", | ||
"post" | ||
] | ||
}, | ||
{ | ||
"type": "http", | ||
"direction": "out", | ||
"name": "res" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = async function (context, req) { | ||
context.log('JavaScript HTTP trigger function processed a request.'); | ||
|
||
const name = (req.query.name || (req.body && req.body.name)); | ||
const responseMessage = name | ||
? "Hello, " + name + ". This HTTP triggered function executed successfully." | ||
: "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."; | ||
|
||
context.res = { | ||
// status: 200, /* Defaults to 200 */ | ||
body: responseMessage | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "Azure" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ | |
"axios": "^1.6.1", | ||
"node-fetch": "^2.7.0", | ||
"swa": "^0.0.1" | ||
} | ||
}, | ||
"type":"module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters