|
|
@@ -3,6 +3,7 @@ import { useRef, useState } from 'react'
|
|
|
import { Button ,Spin,message} from 'antd';
|
|
|
import { AudioOutlined ,RedditOutlined} from '@ant-design/icons';
|
|
|
// import 'antd/dist/reset.css';
|
|
|
+import "./chatGPT.style.css";
|
|
|
import { Configuration, OpenAIApi } from "openai";
|
|
|
|
|
|
interface answerListType{
|
|
|
@@ -27,9 +28,9 @@ export async function davinciCompletion(prompt:String) {
|
|
|
// "top_p": 1,
|
|
|
// "frequency_penalty": 0,
|
|
|
// "presence_penalty": 0
|
|
|
- "messages":
|
|
|
+ "messages":
|
|
|
[
|
|
|
- {"role": "user",
|
|
|
+ {"role": "user",
|
|
|
"content": prompt
|
|
|
}
|
|
|
]
|
|
|
@@ -108,9 +109,9 @@ export function ChatGPT() {
|
|
|
{contextHolder}
|
|
|
<div className='input_box'>
|
|
|
<input type="text" className='input' value={inputValue} onChange={e=>setInputValue(e.target.value)}></input>
|
|
|
- <Button
|
|
|
- type="primary"
|
|
|
- size='large'
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ size='large'
|
|
|
className='btn'
|
|
|
onClick={quize}
|
|
|
>提问</Button>
|
|
|
@@ -140,7 +141,7 @@ export function ChatGPT() {
|
|
|
// 回复答案
|
|
|
return (
|
|
|
<div className='item' key={index}>
|
|
|
- <div><RedditOutlined style={{fontSize:'24px',color:'#42b883aa'}}/> </div>
|
|
|
+ <div><RedditOutlined style={{fontSize:'24px',color:'#42b883aa'}}/> </div>
|
|
|
<span className='span'><pre> {item.content} </pre></span>
|
|
|
</div>
|
|
|
)
|
|
|
@@ -153,4 +154,4 @@ export function ChatGPT() {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-// export default ChatGPT
|
|
|
+// export default ChatGPT
|