Skip to content

Task 2: Series Bible and Continuity Agent - #209

Open
Maharavan wants to merge 19 commits into
superdocsapp:mainfrom
Maharavan:main
Open

Task 2: Series Bible and Continuity Agent#209
Maharavan wants to merge 19 commits into
superdocsapp:mainfrom
Maharavan:main

Conversation

@Maharavan

Copy link
Copy Markdown

Summary

Implemented the Series Bible and Continuity Agent for Task 2.

What was implemented

  • Added document/chapter ingestion and processing
  • Extracted evidence-backed story facts
  • Added persistent Series Bible storage
  • Added semantic retrieval of established canon
  • Added continuity/contradiction detection
  • Added source citations for extracted facts and findings
  • Added human review workflow for canon-changing decisions
  • Added support for Keep Existing, Accept New, Intentional Change, and Reject
  • Added version/history tracking for Series Bible facts
  • Added grounded chat using Series Bible and document evidence
  • Added Google sign-in/session-based user ownership where applicable
  • Added SuperDocs/MCP integration where required

Demo flow

  1. Upload Chapter 1
  2. Establish Elena's eye color as blue
  3. Upload a conflicting chapter stating green
  4. Retrieve the existing canon
  5. Detect the contradiction
  6. Display both sources/citations
  7. Send the finding to human review
  8. Approve an intentional change
  9. Persist the new version
  10. Ask the Series Bible chat for Elena's current eye color

Example continuity conflict

Existing:
Elena's eye color → Blue
Source → Chapter 1

New:
Elena's eye color → Green
Source → Conflicting chapter

The system does not automatically overwrite canon. The human reviewer makes the final decision.

Verification

  • Tested document ingestion
  • Tested fact extraction
  • Tested contradiction detection
  • Tested human review
  • Tested persistence/versioning
  • Tested grounded chat and citations
  • Tested the end-to-end demo flow

Notes

The implementation is designed to keep canon decisions human-controlled while preserving evidence and historical versions of facts.

- Add main HTML file and CSS for styling
- Set up Nginx configuration for serving the app
- Create package.json with dependencies and scripts for development
- Implement main application structure in React with routing
- Define API types and functions for backend communication
- Configure Vite for building and serving the application
- Add TypeScript configuration for strict type checking
- Updated the request function to include an Authorization header with a Bearer token retrieved from localStorage.
- This change ensures that all API requests are authenticated, improving security and access control.

chore(frontend): update script source in index.html

- Changed the script source in index.html to point to the latest build of the frontend assets.
- Add main HTML structure with linked CSS and JS files.
- Create CSS file for styling the application with custom fonts and variables.
- Implement main application logic in React with routing and state management.
- Set up API interactions for series, findings, and bible facts.
- Configure Vite for development and production builds with React support.
- Add Nginx configuration for serving the application and proxying API requests.
- Include TypeScript configuration for strict type checking and module resolution.
…README for frontend Docker build instructions
- Integrated HashEmbeddingProvider to generate embeddings for document chunks during ingestion.
- Added a new record_story_event function call to log document uploads as story events.
- Updated the database schema to include embedding fields in DocumentChunk and StoryEvent models.
- Improved error handling in OpenAICompatibleProvider for better clarity on API key issues.
- Introduced a new WorkflowRunner method to handle failures gracefully, ensuring uncommitted writes are discarded.
- Added tests for LLM provider error handling to ensure clear error messages for invalid API keys and server errors.
- Updated frontend components to manage run outcomes, including retry functionality for failed runs.
- Enhanced API types to include run error structures and upload results for better type safety.
- Updated styles for run banners to visually differentiate between statuses.
…agement features

- Updated docker-compose.yml to include Google Client ID as a build argument for the frontend.
- Modified frontend Dockerfile to set the Google Client ID as an environment variable.
- Added @react-oauth/google dependency to package.json for Google login functionality.
- Refactored App.tsx to implement Google login and user session management.
- Created SignIn component for handling user authentication and session storage.
- Enhanced SeriesList and Workspace components to display user information and logout functionality.
- Implemented chat feature for user interaction with document data.
- Updated API service to include Google sign-in endpoint and chat functionality.
- Improved styles for better user experience and responsiveness.
- Introduced new retrieval logic to determine when to use document context based on user queries.
- Added conflict detection and resolution handling in chat responses, allowing users to address discrepancies in information.
- Updated the ChatService to manage recent user context and relevant conflicts effectively.
- Enhanced the GroundedAnswer structure to include conflict details and resolution needs.
- Implemented new tests for retrieval logic to ensure correct behavior for conversational and document-related questions.
- Updated frontend components to display conflict information and allow chat session clearing.
- Modified API types to accommodate new conflict structures and citation details.
- Improved styling for conflict messages in the chat interface.
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.

2 participants