Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发送消息提示Invalid Date #76

Open
tczj199076 opened this issue Apr 26, 2023 · 11 comments
Open

发送消息提示Invalid Date #76

tczj199076 opened this issue Apr 26, 2023 · 11 comments

Comments

@tczj199076
Copy link

发送消息提示Invalid Date,然后获取历史消息的时间也不对。

@Kerwin1202
Copy link
Member

截图看下,这个我改了肯定是自己看过的。。。

@tczj199076
Copy link
Author

image

@tczj199076
Copy link
Author

这样的,拉的是最新的代码

@Kerwin1202
Copy link
Member

f12 看下请求响应结果 以及浏览器是什么浏览器

@1030283726
Copy link

我也有這樣的問題,顯示 Invalid Date, 然後我重新登一次就變好了

@tczj199076
Copy link
Author

f12 看下请求响应结果 以及浏览器是什么浏览器

image
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"ä½ ","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好�","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好��","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好���","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好����","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好�����","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好������以","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好������以帮","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好������以帮�","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好������以帮�你","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好������以帮�你�","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好������以帮�你��","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好������以帮�你���","detail":{"choices":[{"finish_reason":null}]}}
{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","text":"你好������以帮�你���","detail":{"choices":[{"finish_reason":"stop"}]}}
{"role":"assistant","id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","parentMessageId":"88be5e00-7aa0-4ed3-921b-bdfaee92e01b","text":"你好������以帮�你���","detail":{"id":"chatcmpl-7CHyMcllaVsj9IiK8XL7AOs4vpZsQ","object":"chat.completion.chunk","created":1683163378,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{},"index":0,"finish_reason":"stop"}],"usage":{"prompt_tokens":193,"completion_tokens":18,"total_tokens":211,"estimated":true}}}
这是请求响应结果,浏览器是chrome,我把机器人的默认头像给改了,这个不影响把?

@tczj199076
Copy link
Author

我发现问题了,我的数据库的时间戳是对的,但是实际转成时间格式,比我的时间要慢8个小时。譬如我是中午12点发的,显示invalid date,然后刷新页面,加载历史记录,时间就变成凌晨4点了。这是为什么啊?怎么改?

@Kerwin1202
Copy link
Member

我发现问题了,我的数据库的时间戳是对的,但是实际转成时间格式,比我的时间要慢8个小时。譬如我是中午12点发的,显示invalid date,然后刷新页面,加载历史记录,时间就变成凌晨4点了。这是为什么啊?怎么改?

加这个时区就对了
image

至于上面的错误日期,你发的看不出,你试试 chrome f12 控制台这个对不对
new Date('4/16/2023, 11:41:39 AM').toLocaleString()

@tczj199076
Copy link
Author

你好,我加了时区,现在拉取历史记录已经修复了,但是发消息的时候,依然提示Invalid Date,然后执行new Date('4/16/2023, 11:41:39 AM').toLocaleString(),得到的输出结果如下
image

@Kerwin1202
Copy link
Member

那你看看 f12 network 里的请求 下来的时间格式是否是刚测测试的这种,如果不是截图看看

@tczj199076
Copy link
Author

那你看看 f12 network 里的请求 下来的时间格式是否是刚测测试的这种,如果不是截图看看

你好,这是我的请求返回结果
image
这里我只看到created,是时间戳,但不是毫秒。
另外,我再console.log里打印了console.log(new Date().toLocaleString()),
得到的结果是
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants