feat: add base Assistant entity (#14)#67
Open
martinydeAI wants to merge 1 commit into
Open
Conversation
App\Entity\Assistant with the six base fields requested for now: id, title, description, languageModel, framework, and tags (a JSON list<string>). Migration creates the table. Constructor requires all non-tag fields; tags default to an empty list and array_values()-reindex on set so JSON serialises as an array, not an object. Per ADR 005, languageModel and framework are stored on the assistant as a snapshot (not a live reference through Organization) so an organisation changing its default later doesn't silently rewrite older catalogue rows. The Organization linkage itself, plus the richer #14 scope (system prompt, parameters, OpenWebUI mapping, versioning) and the tag display side of #16, are deferred to follow-on PRs. Tests: 35 cases, 86 assertions, 100% coverage. Two round-trip tests through the entity manager prove persistence + hydration of every getter/setter, plus a regression test for the tags array_values() reindex. Refs #14, #16. Depends on PR #59 (Doctrine + PHPUnit foundation). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the base
AssistantDoctrine entity with the six fields youasked for:
id,title,description,languageModel,framework,and
tags(a JSON list of strings). Repository + migration + a smalltest class that round-trips the entity through the entity manager to
keep us at 100 % coverage.
What this covers from existing issues
land here; the richer scope (system prompt / instructions,
parameters, OpenWebUI export field-mapping doc, file reference,
versioning) is deferred to follow-on PRs as planned.
stored as a
JSONlist on the assistant; the display + filter sidecomes later.
languageModelandframeworkarestored as snapshot strings on the assistant, matching the ADR's
snapshot-vs-live-derive decision.
Organizationis notintroduced here (you explicitly asked to skip it for now); when it
lands, the assistant gets an
organizationsM:N relation and thecreation flow can derive defaults from
user.organization.Dependency on PR #59
This branch is cut from
feature/issue-2-user-login(PR #59,currently open) because the Doctrine ORM bundles, the PHPUnit
harness, and the test schema setup all live there. Carries the
do-not-mergelabel until #59 lands; rebase ontodevelopafterthat and the label can come off.
Changes
src/Entity/Assistant.php— entity with the six base fields,constructor that requires everything except tags,
array_values()reindex in
setTags()sotagsserialises as a JSON array (not anobject).
src/Repository/AssistantRepository.php— standardServiceEntityRepository<Assistant>.migrations/Version20260612120840.php— creates theassistanttable with the matching columns.
tests/Entity/AssistantTest.php— three cases:CHANGELOG.md— entry under[Unreleased] / AddedreferencingDefine assistant data model #14 and Tags and categories for assistants #16.
Test plan
task test-coverage→ 35 / 35 tests, 86 assertions, 100 %.task coding-standards-check→ green across PHP, Twig, YAML,JS, CSS, Markdown, Composer.
doctrine:migrations:migrate -napplies cleanly on a freshlocal DB.
Refs #14, #16. Depends on #59.
🤖 Generated with Claude Code