Chanzhaoyu / chatgpt-web

用 Express 和 Vue3 搭建的 ChatGPT 演示网页
MIT License
30.94k stars 11.2k forks source link

token length for gpt-4o is wrong #2084

Closed AIMutant closed 1 month ago

AIMutant commented 1 month ago

The code in service/src/chatgpt/index.ts tests wrongly for gpt-4-o. Instead it should test for gpt-4o

row57: else if (/-preview|-turbo|-o/.test(model.toLowerCase())) {

Change to else if (/-preview|-turbo|o/.test(model.toLowerCase())) { (remove leading dash before -o)

Otherwise we would get following error:

ChatGPT error 404: {
"error": {
"message": "The model gpt-4-o does not exist or you do not have access to it.",
"type": "invalid_request_error",
"param": null,
"code": "model_not_found"
}
}
Chanzhaoyu commented 1 month ago

fix it