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

[Bug] 1.37.2 chat-preview [Config Import Error] e.toISOString is not a function #5144

Open
Kshao123 opened this issue Dec 23, 2024 · 8 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@Kshao123
Copy link

📦 部署环境

Official Preview

📌 软件版本

1.37.2

💻 系统环境

macOS

🌐 浏览器

Chrome, Firefox

🐛 问题描述

导入刚导出的配置如:“导出所有助手和消息”、“导出全局设置”,不修改直接导入时会抛出错误。

测试环境:

  • Chrome:使用过 chat-preview('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36')
  • Firefox:全新未使用("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0")

📷 复现步骤

测试了 exportType 为 sessions、all 和 settings,全新客户端(无任何设置和相关操作)。

建立新聊天,发送信息,导出,导入,抛出错误

截屏2024-12-23 下午12 40 20

LobeChat-sessions-v7 (2).json

🚦 期望结果

No response

📝 补充信息

No response

@Kshao123 Kshao123 added the 🐛 Bug Something isn't working | 缺陷 label Dec 23, 2024
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Dec 23, 2024
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Deployment environment

Official Preview

📌 Software version

1.37.2

💻 System environment

macOS

🌐 Browser

Chrome, Firefox

🐛 Problem description

Import the newly exported configuration, such as: "Export all assistants and messages", "Export global settings", an error will be thrown when imported directly without modification.

#Test environment:

  • Chrome: used chat-preview ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36')
  • Firefox: New and unused ("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0")

📷 Steps to reproduce

Tested exportType is sessions, all and settings, new client (without any settings and related operations).

Create new chat, send message, export, import, throw errors

Screenshot 2024-12-23 12 40 20 PM

LobeChat-sessions-v7 (2).json

🚦 Expected results

No response

📝 Supplementary information

No response

@lobehubbot
Copy link
Member

👀 @Kshao123

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

Copy link

dosubot bot commented Dec 23, 2024

@Kshao123 你好!我是Dosu,一个可以帮助您解决错误、回答问题并成为贡献者的机器人。在等待人类维护者的过程中,我会尽力帮助您。

The error you're encountering, "e.toISOString is not a function," suggests that there is an issue with how date objects are being handled during the import process. This typically occurs when a value expected to be a Date object is not correctly formatted or is not a Date object at all.

Here are a few steps you can take to troubleshoot and potentially resolve this issue:

  1. Check the JSON Structure: Ensure that the fields expected to be dates (like createdAt and updatedAt) are correctly formatted as timestamps or ISO strings in the JSON file. If they are numbers, they should be valid timestamps.

  2. Review the Import Functionality: The import functionality is implemented in the importConfigFile function in src/utils/config.ts. This function processes the imported configuration and might need adjustments to handle date conversions properly [1].

  3. Conversion Handling: If the JSON file contains timestamps, ensure that they are being converted to Date objects before calling toISOString. This conversion might need to be explicitly handled in the code.

  4. Error Handling: Check if there are any specific error handling mechanisms for TypeError in the import process. This might help in identifying where the conversion is failing.

  5. Update the Code: If necessary, update the code to include validation checks to ensure that fields expected to be Date objects are correctly formatted before any operations like toISOString are performed.

By addressing these areas, you should be able to resolve the import issue related to date handling. If the problem persists, reviewing recent changes or commits related to the import/export functionality might provide additional insights.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@arvinxx
Copy link
Contributor

arvinxx commented Dec 23, 2024

OK,我看下修复掉

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


OK, I'll take a look and fix it.

@arvinxx
Copy link
Contributor

arvinxx commented Dec 23, 2024

哦 仔细看了下,这个是用了 pglite 的导出方案,因此目前还没兼容常规的导入导出。需要单独再处理下。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Oh, I looked carefully and found that this uses pglite's export solution, so it is not yet compatible with regular import and export. It needs to be dealt with separately.

@arvinxx
Copy link
Contributor

arvinxx commented Dec 23, 2024

@arvinxx arvinxx changed the title [Bug] 1.37.2 chat-preview 导入问题 [Bug] 1.37.2 chat-preview [Config Import Error] e.toISOString is not a function Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

3 participants