msl 1 year ago
parent 48fca54eb8
commit 1be23e43c9

@ -3,12 +3,12 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WeChat-like Chat Interface</title>
<title>Artemis GPT</title>
<!-- Bootstrap CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<textarea id="hidep" style="display: none;"></textarea>
<textarea id="hidep" style="display: none; "></textarea>
<div class="container mt-5">
<div class="chat-box border rounded">
<div class="d-flex justify-content-between align-items-center p-3 bg-light">
@ -39,11 +39,11 @@
var message = $$("#messageInput").val().trim();
if (message) {
$$(".chat-content").append(`<div class="text-right mb-2"><span class="badge badge-primary">$${message}</span></div>`);
$$("#messageInput").val('');
$$("#hidep").append("{'role': 'user', 'content':'"+message+"'},")
allMessages=$$("#hidep").text()
$$(".chat-content").append(`<div class="text-right mb-2"><span class="badge badge-primary" ><p style="white-space: pre-wrap; width:220px; word-wrap: break-word; word-break:break-all;">$${message}<p></span></div>`);
$$("#sendButton").prop("disabled", true);
// Show loading spinner
@ -52,7 +52,7 @@
if(response) {
$$("#hidep").append("{'role': 'assistant', 'content':'"+response+"'},");
response=response.replace("\n","<br>")
$$(".chat-content").append(`<div class="text-left mb-2"><span class="badge badge-secondary">$${response}</span></div>`);
$$(".chat-content").append(`<div class="text-left mb-2"><span class="badge badge-secondary"><p style="white-space: pre-wrap; width:220px; word-wrap: break-word; word-break:break-all;">$${response}</p></span></div>`);
$$("#sendButton").prop("disabled", false);
$$('#loadingSpinner').remove();

@ -3,7 +3,7 @@ import openai
def chatgpt(mess):
openai.api_key ="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"
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
model="gpt-4",
messages=mess
)
re=response['choices'][0]['message']['content']

Loading…
Cancel
Save