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

Put response error json response in markdown code block? #572

Closed
PeterDaveHello opened this issue Nov 27, 2023 · 9 comments
Closed

Put response error json response in markdown code block? #572

PeterDaveHello opened this issue Nov 27, 2023 · 9 comments

Comments

@PeterDaveHello
Copy link
Contributor

Initially, I thought it's a hyperlink issue, that the string https://platform.openai.com/account/api-keys.","type":"invalid_request_error","param":null,"code":"invalid_api_key"}} been recognized as a link to https://platform.openai.com/account/api-keys.%22,%22type%22:%22invalid_request_error%22,%22param%22:null,%22code%22:%22invalid_api_key%22%7D%7D, but my second thought is maybe we should be the error json response in a markdown code block?

image

@josStorer
Copy link
Owner

Wrapping it in a code block will completely disable the link highlighting. I prefer to keep it as it is, so that in some cases the links are available and in other cases, users need to manually select them.
If wrapped in a code block, it means that users will always have to select manually

@PeterDaveHello
Copy link
Contributor Author

In the example, you can see that the users still need to manually select them as the hyperlink isn't correct. In that scenario, the code block can help read and select 😅

@josStorer
Copy link
Owner

The following screenshot demonstrates the comparison of two situations.

The one above shows the case where text wrapped in code block, and the one below shows the current situation (but should be with red text).

I believe that if the link highlighted is invalid, causing users to have to select manually, the manual selection cost for users is the same regardless of how it is displayed.

However, the current display method (below) allows users to immediately notice that there is a clickable link. If it is invalid, users can manually select it, and if it is valid, users can directly click to enter. I think this form is more user-friendly.

image

@PeterDaveHello
Copy link
Contributor Author

It looks like it's because of different markdown render implementations. GitHub's code block can still have the link as the example below so that we can make both of us.

{"error":{"message":"Incorrect API key provided: sk-********************************. You can find your API key at https://platform.openai.com/account/api-keys.","type":"invalid_request_error","param":null,"code":"invalid_api_key"}}
{
  "error": {
    "message": "Incorrect API key provided: sk-********************************. You can find your API key at https://platform.openai.com/account/api-keys.",
    "type": "invalid_request_error",
    "param": null,
    "code": "invalid_api_key"
  }
}

Or, as our points are both user-friendly, could making the json output prettier without a code block make sense of it?

@PeterDaveHello
Copy link
Contributor Author

Though the hyperlink on GitHub is also not correct, but not that strange 😆

@josStorer
Copy link
Owner

I can't see GitHub's code block providing link highlighting here. If you are referring to the strange markdown rendering in my previous screenshot, it's because that is not actually a valid JSON. I entered it randomly, so it's normal that it didn't render correctly.

But that's not important, you are right. I can try to format the error json text to make it prettier. This usually can also fix the link, as shown in the following:
image

@PeterDaveHello
Copy link
Contributor Author

I can't see GitHub's code block providing link highlighting here.

Sorry, looks like it's done by my extensions, not GitHub.

If you are referring to the strange markdown rendering in my previous screenshot, it's because that is not actually a valid JSON. I entered it randomly, so it's normal that it didn't render correctly.

I'm actually referring to the case that was originally reported. That link was really weird 🤣

josStorer added a commit that referenced this issue Jan 26, 2024
@josStorer
Copy link
Owner

v2.4.9

@PeterDaveHello
Copy link
Contributor Author

Now it looks better 👍

{
"error": {
"message": "Incorrect API key provided: asdasda. You can find your API key at https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}

image

mrichtarsky added a commit to mrichtarsky/chatGPTBox that referenced this issue Feb 13, 2024
* origin/master:
  Update OpenAI ChatGPT Turbo models (API) (josStorer#620)
  release v2.4.9
  when opening IndependentPanel, if the latest session has been used, automatically create a new session (josStorer#601)
  presearch support (josStorer#592)
  formattedError (josStorer#572)
  safe markdown renderer (josStorer#609, josStorer#403)
  improve the stability of response language (josStorer#611)
  improve bilibili summary
  fix mounting failure caused by DuckDuckGo's initial rendering delay. josStorer#610
  gpt-4 web DALL·E support
  chore
  improve josStorer#603
  improve markdown styles (josStorer#585)
  fix gpt-4 web unusual activity (josStorer#615)
  fix: bilibili reload (josStorer#603)
  refactor(selection-tools): remove redundant `getPreferredLanguage` calls (josStorer#593)
  Fix GPT-4 model name and confusion in names (josStorer#584)
  chore(deps): bump actions/upload-artifact from 3 to 4 (josStorer#594)
  chore(deps): bump actions/setup-python from 4 to 5 (josStorer#586)
  update readme news
  release v2.4.8
  update core content adapters
  fix eventsource meta (josStorer#579, josStorer#567)
  josStorer#573's patch
  release v2.4.7
  fix josStorer#569 and reduce menu items
  add gpt-3.5-turbo-instruct
  fix global side_panel
  patch to josStorer#564
  Update Claude.ai web to Claude v2.1, fix josStorer#570 (josStorer#573)
  Add ChatGLM API (josStorer#567)
  Optimize Logic in `selection-tools` Module (josStorer#564)
  release v2.4.6
  support for chromium side panel (josStorer#111)
  allow filling in the API Key of CustomModel mode (josStorer#561, previously designed for local offline model or custom server, now you can also use it for regular openai API calls and freely fill in the model name(josStorer#563))
  update for chatgpt3.5 web (josStorer#562, josStorer#551#issuecomment-1803668105, josStorer#543#issuecomment-1803666487)
  Added box for gh pr's and issues (josStorer#558)
  Replace legacy gpt-3.5-turbo-0613 with the latest gpt-3.5-turbo-1106
  Add OpenAI API GPT-4 Turbo Preview
  Turkish readme Translation (josStorer#553)
  chore
  firefox patch
  release v2.4.5
  update build scripts
  force scroll to bottom after submission
  docs: phrase translation according language README_IN
  improve render performance (josStorer#265)
  docs: add Japanese README
  Create .gitattributes
  improve chatgpt web user guide
  release v2.4.4
  improve chatgpt web mode compatibility
  improve chatgpt web user guide
  Add site adapters for Golem, EETimes
  release v2.4.3
  fix safari background (josStorer#512 (comment))
  improve fetchSSE (josStorer#532)
  re-order parse process
  fix: parse sse
  Make summarization work for text/plain content
  chore(deps-dev): bump @babel/traverse from 7.21.4 to 7.23.2
  fix josStorer#539 bing web
  blob file read for gitlab (josStorer#544)
  fix chatgpt web mode arkose_token (josStorer#469, josStorer#543, josStorer#545)
  remove BingImageCreator
  disable poe temporarily
  upgrade caniuse-lite
  remove commands permission
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

2 participants