-
Notifications
You must be signed in to change notification settings - Fork 839
Integrates You.com chatbot in web-mode using session cookie. Supports conversation history + "create" chatMode (image generation). #834
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
Conversation
Integrates You.com chatbot using session cookie. Supports conversation history + "create" chatMode (image generation).
Integrates You.com chatbot using session cookie. Supports conversation history + "create" chatMode (image generation).
Integrates You.com chatbot using session cookie. Supports conversation history + "create" chatMode (image generation).
...n history + "create" chatMode (image generation). Integrates You.com chatbot using session cookie. Supports conversation history + "create" chatMode (image generation).1
...n history + "create" chatMode (image generation). Integrates You.com chatbot using session cookie. Supports conversation history + "create" chatMode (image generation).
...n history + "create" chatMode (image generation). Integrates You.com chatbot using session cookie. Supports conversation history + "create" chatMode (image generation).
@Copilot
Copilot
AI
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Integrates You.com chatbot in web mode by fetching a session cookie, streaming conversation history via SSE, and supporting "create" mode for image generation.
- Adds
getYouSessionKey
alongside existing session-cookie helpers. - Implements
generateAnswersWithYouWebApi
for streaming chat responses. - Extends config and background logic to include You.com model keys and routing.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/services/wrappers.mjs | Added getYouSessionKey to retrieve You.com session cookie. |
src/services/apis/you-web.mjs | New SSE-based API client for You.com chat and create modes. |
src/config/index.mjs | Registered You.com model keys, groups, and default modes. |
src/background/index.mjs | Routed You.com requests in the main execution flow. |
Comments suppressed due to low confidence (2)
src/services/apis/you-web.mjs:1
- New API wrapper
generateAnswersWithYouWebApi
andgenerateUUID
helper lack associated unit tests. Please add tests to cover streaming logic, error handling, and different chat modes.
// path/to/services/apis/you-web.mjs
src/config/index.mjs:418
- The
activeApiModes
array was completely replaced by You.com keys, removing all existing default modes (e.g., chatgptFree35, bingFree4). Please merge You.com entries into the existing list rather than overwriting it.
'create',
Copilot
AI
May 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate create
key in the Models
object (also defined at line 251). Please remove or consolidate one of the definitions to avoid key collisions.
Copilot uses AI. Check for mistakes.
Copilot
AI
May 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling finishMessage()
here will push the record and post a completed message, but the onEnd
callback also calls finishMessage()
, leading to duplicate pushes and messages. Consider invoking it in only one place.
Copilot uses AI. Check for mistakes.
Copilot
AI
May 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] For SSE GET requests, it's more appropriate to set an Accept: 'text/event-stream'
header instead of Content-Type
to signal the expected response format.
Copilot uses AI. Check for mistakes.
/review
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
Cookie handling:
The implementation relies on session cookies for authentication with You.com. While the code itself doesn't expose the cookies directly, ensure that the session cookie is properly secured and not accessible to malicious scripts or extensions. The cookie is being sent with every request to You.com, which is necessary for authentication but should be monitored for potential security implications.
Error Handling
The error handling in the fetchSSE call could be improved. The current implementation only handles errors from the fetch itself, but doesn't properly handle API-specific errors that might be returned in the response data.
onError(error) { cleanController() port.postMessage({ error: error.message, done: true }) },
UUID Generation
The custom UUID generation function may not guarantee uniqueness in all cases. Consider using a standard UUID library instead of the custom implementation.
function generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (Math.random() * 16) | 0,
v = c == 'x' ? r : (r & 0x3) | 0x8
return v.toString(16)
})
}
Duplicate Model Definition
The 'create' model is defined twice in the Models object, once at line 252 and again at line 270, which could lead to unexpected behavior.
create: { value: "create", desc: "You.com (Web, Create Mode)" }, // Added You.com create model chatglmTurbo: { value: 'GLM-4-Air', desc: 'ChatGLM (GLM-4-Air, 128k)' }, chatglm4: { value: 'GLM-4-0520', desc: 'ChatGLM (GLM-4-0520, 128k)' }, chatglmEmohaa: { value: 'Emohaa', desc: 'ChatGLM (Emohaa)' }, chatglmCharGLM3: { value: 'CharGLM-3', desc: 'ChatGLM (CharGLM-3)' }, chatgptFree35Mobile: { value: 'text-davinci-002-render-sha-mobile', desc: 'ChatGPT (Mobile)' }, chatgptPlus4Mobile: { value: 'gpt-4-mobile', desc: 'ChatGPT (Mobile, GPT-4)' }, chatgptApi35_1106: { value: 'gpt-3.5-turbo-1106', desc: 'ChatGPT (GPT-3.5-turbo 1106)' }, chatgptApi35_0125: { value: 'gpt-3.5-turbo-0125', desc: 'ChatGPT (GPT-3.5-turbo 0125)' }, chatgptApi4_8k_0613: { value: 'gpt-4', desc: 'ChatGPT (GPT-4-8k 0613)' }, chatgptApi4_32k_0613: { value: 'gpt-4-32k', desc: 'ChatGPT (GPT-4-32k 0613)' }, gptApiInstruct: { value: 'gpt-3.5-turbo-instruct', desc: 'GPT-3.5-turbo Instruct' }, gptApiDavinci: { value: 'text-davinci-003', desc: 'GPT-3.5' }, create: { value: 'create', desc: 'YouWeb create' },
/improve
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here. PR Code Suggestions ✨
|
5d81453
to
ffad115
Compare
Integrates You.com chatbot using session cookie. Supports conversation history + "create" chatMode (image generation).