Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunji committed Nov 12, 2023
1 parent f236776 commit fd91e8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
12 changes: 5 additions & 7 deletions api/onecall_script/chat.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# -*- coding: utf-8 -*-

"""
pip install requests
"""

import os
import requests
import openai
Expand All @@ -15,6 +11,8 @@ def create_script(departure, arrival, date, time):

CONTENT = departure + "에서 " + arrival + "으로 " + date + " " + time + "에 가는 기차 승차권을 예매하는 말을 1줄로 해줘"

openai.api_key = "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"

response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
Expand All @@ -28,12 +26,12 @@ def create_script(departure, arrival, date, time):
result = "안녕하세요, 원콜 서비스를 이용하려 합니다. "
result += response['choices'][0]['message']['content']

# print(result)
#print(result)

result_json = json.dumps({"result": result})

# print(result_json)
return result_json
print(result_json)
#return result_json

if __name__ == "__main__":
sys.stdout.reconfigure(encoding='utf-8')
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ requests==2.31.0
six==1.16.0
soupsieve==2.5
tzdata==2023.3
urllib3==2.0.7
urllib3==2.0.7
openai==0.27.4
2 changes: 1 addition & 1 deletion src/html/initial.html
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ <h1>출발지와 목적지를 입력해주세요.</h1><br>
<button onclick="convertAddresses()">Convert Addresses</button>
<p>출발지 좌표: <b id="resultStart">...</b></p>
<p>도착지 좌표: <b id="resultEnd">...</b></p>
<p>Script: <b id="script">...</b></p>
<p>출발역: <b id="findroad1">...</b></p>
<p>도착역: <b id="findroad2">...</b></p>
<br><br>
Expand All @@ -406,6 +405,7 @@ <h1>탑승 가능한 열차 목록</h1>
<tbody id="info-table">
</tbody>
</table>
<p>시나리오: <b id="script">...</b></p>

<br>
<br>
Expand Down

0 comments on commit fd91e8c

Please sign in to comment.