Skip to content

Handle empty Gemini responses, extend firstN tests, update docs and session test comment#747

Merged
swuecho merged 1 commit intomasterfrom
codex/fix-spelling-error-and-improve-tests
Mar 8, 2026
Merged

Handle empty Gemini responses, extend firstN tests, update docs and session test comment#747
swuecho merged 1 commit intomasterfrom
codex/fix-spelling-error-and-improve-tests

Conversation

@swuecho
Copy link
Owner

@swuecho swuecho commented Mar 8, 2026

Motivation

  • Prevent unexpected nil responses from the Gemini model path and improve error messaging when the LLM returns nothing.
  • Increase coverage for firstN by adding edge and Unicode cases.
  • Clarify API usage for artifact retrieval and client-side execution in the docs.
  • Avoid brittle timestamp equality checks in the chat session test by asserting updated fields instead.

Description

  • Change Gemini regular response handling in model_gemini_service.go to return an explicit error when llmAnswer is nil and to set AnswerId only after confirming a non-nil response, and fix a typo in the error message to response.
  • Add additional unit test cases to Test_firstN in util_test.go to cover Unicode characters, empty strings, zero length, and emoji inputs.
  • Update chat_session_service_test.go to stop asserting strict UpdatedAt equality and instead verify the updated fields (topic), with a clarifying comment.
  • Update documentation in docs/artifact_gallery_en.md and docs/artifact_gallery_zh.md to use the messages endpoint (/api/uuid/chat_messages/chat_sessions/${sessionId}) and to state that code execution is handled client-side rather than via a backend /api/artifacts/:id/execute endpoint.

Testing

  • Ran unit tests with go test ./... which included Test_firstN and the chat session tests, and they all passed.
  • Verified that the updated firstN test cases execute and validate Unicode, empty, zero-length, and emoji behaviors successfully.

Codex Task

@swuecho swuecho merged commit 46a80d4 into master Mar 8, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant