Skip to content

Commit

Permalink
Feedback migration (#9396)
Browse files Browse the repository at this point in the history
* Added changes to models from the feedback loop PR

* Added conversationShared column to feedbacks table

* Enforcing non null values for feedback

* Removed unused Non-attributes of AgentMessageFeedback

* Undoing manual changes, preparing migration

* Adding sqlize instructions

* Added migration via npm run create-db-migration

* Conversation explicitly not shared by default

* Anticipating migration file conflict, renamed variable

* Using agentMessage to stick to User convention just above

* removed non-migration code

* updated name in migration

---------

Co-authored-by: Lucas <[email protected]>
  • Loading branch information
overmode and overmode authored Dec 17, 2024
1 parent ec60d8a commit 625a9c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions front/lib/api/assistant/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export async function createOrUpdateMessageFeedback(
userId: user.id,
thumbDirection,
content,
isConversationShared: false,
});
return newFeedback !== null;
}
Expand Down
6 changes: 6 additions & 0 deletions front/lib/models/assistant/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export class AgentMessageFeedback extends BaseModel<AgentMessageFeedback> {
declare agentConfigurationVersion: number;
declare agentMessageId: ForeignKey<AgentMessage["id"]>;
declare userId: ForeignKey<UserModel["id"]>;
declare isConversationShared: boolean;

declare thumbDirection: AgentMessageFeedbackDirection;
declare content: string | null;
Expand Down Expand Up @@ -333,6 +334,11 @@ AgentMessageFeedback.init(
type: DataTypes.TEXT,
allowNull: true,
},
isConversationShared: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
},
{
modelName: "agent_message_feedback",
Expand Down
2 changes: 2 additions & 0 deletions front/migrations/db/migration_132.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Migration created on Dec 16, 2024
ALTER TABLE "public"."agent_message_feedbacks" ADD COLUMN "isConversationShared" BOOLEAN NOT NULL DEFAULT false;

0 comments on commit 625a9c4

Please sign in to comment.