|
|
本帖最后由 奔跑吧蜗牛cc 于 2023-3-2 15:12 编辑
在线编程,集思广益。
- var data = JSON.stringify({
- "prompt": document.getElementById("chat-gpt-input").value,
- "max_tokens": 4096,
- "temperature": 0.5,
- "top_p": 1,
- "frequency_penalty": 0,
- "presence_penalty": 0,
- "model": "gpt-3.5-turbo-0301"
- });
复制代码
我把model改成了gpt-3.5-turbo-0301后报错,报错信息如下
- {
- "error": {
- "message": "This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?",
- "type": "invalid_request_error",
- "param": "model",
- "code": null
- }
- }
复制代码
论坛大佬多,帮忙解决一哈。
官网相关说明URL
https://platform.openai.com/docs/guides/chat/introduction
https://platform.openai.com/docs/models/gpt-3-5
已动手解决。
伸手党自己去改吧。
- var url = "https://api.openai.com/v1/chat/completions";
复制代码
- var data = JSON.stringify({
- "messages": [
- { 'role': 'user', 'content': document.getElementById("chat-gpt-input").value },
- ],
- "model": "gpt-3.5-turbo-0301"
- });
复制代码
总结:
1.URL发生了变化
2.请求方式发生了变化
3.接收的对象也发生了变化 |
|