Skip to content

fix: auto-reset web session on new client chat & make cookie optional with fallback - #28

Open
zenyxx-xd wants to merge 3 commits into
ForgetMeAI:mainfrom
zenyxx-xd:fix/session-reset-and-optional-cookie
Open

fix: auto-reset web session on new client chat & make cookie optional with fallback#28
zenyxx-xd wants to merge 3 commits into
ForgetMeAI:mainfrom
zenyxx-xd:fix/session-reset-and-optional-cookie

Conversation

@zenyxx-xd

Copy link
Copy Markdown

Summary of Changes

  1. Auto-reset Web Session on New Client Conversation:

    • Problem: When agent clients like OpenCode or Claude Code connect locally without sending x-agent-session, agentId defaults to 'dev-agent'. When a user starts a fresh conversation in OpenCode, FreeDeepseekAPI was reusing the previous chat_session.id on DeepSeek Web, mixing messages from old sessions into the same Web chat.
    • Fix: Added a check in server.js: if an incoming payload contains zero assistant responses (messages.some(m => m.role === 'assistant') === false), FreeDeepseekAPI recognizes that the client started a brand new conversation and calls resetRemoteSession(session) so DeepSeek Web creates a fresh chat_session.id.
  2. Make cookie Optional with Default Fallback:

    • Problem: When users input an auth token without pasting full browser cookies, a.config.cookie is empty (""). server.js was rejecting accounts with No valid DeepSeek auth accounts due to strict a.config.token && a.config.cookie filters.
    • Fix: Added a default fallback header ("Cookie": config.cookie || "ds_cookie_preference=%7B%22level%22%3A%22all%22%7D;") and relaxed the strict a.config.cookie requirement in server.js & scripts/doctor.js, allowing token-only auth to work out-of-the-box.

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

Successfully merging this pull request may close these issues.

1 participant