Skip to content

Extend AI Application to Support NestBot AI Assistant Contexts #1873

@arkid15r

Description

@arkid15r

Is your feature request related to a problem? Please describe.

We want to extend the OWASP Nest AI application to introduce NestBot AI Assistant functionality. This will require a new model for storing contexts, which are generated text entries that can optionally be linked to specific OWASP entities (e.g., Projects, Chapters, Committees).

Describe the solution you'd like

Currently, this relationship is handled directly in the Chunk model using a generic foreign key:

content_object = GenericForeignKey("content_type", "object_id")
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, blank=True, null=True)

Proposed Changes

Create a new Context model to store:

  • Generated text
  • Optional relation to OWASP entities via GenericForeignKey
  • Metadata (timestamps, source, etc.)
  • Update the Chunk model to link to the new Context model instead of handling entity relations directly.
  • Migrate existing data from Chunk to Context to ensure backward compatibility.

Goals

  • Centralize the management of AI-generated contexts.
  • Provide a scalable foundation for NestBot AI Assistant to handle context-aware responses.
  • Decouple content chunks from OWASP entities to improve maintainability and future extension.

Tasks

  1. Define Context model with required fields and generic relation to OWASP entities.
  2. Update Chunk model to reference Context.
  3. Write migration to move existing content_type and object_id from Chunk to Context.
  4. Update any code paths that rely on Chunk.content_object to use Chunk.context.
  5. Add tests to ensure data integrity and backward compatibility.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions