Files
open-gsio/workers/site/models/O1Message.ts
geoffsee 33679583af init
2025-05-22 23:14:01 -04:00

21 lines
578 B
TypeScript

import { types } from "mobx-state-tree";
export default types
.model("O1Message", {
role: types.enumeration(["user", "assistant", "system"]),
content: types.array(
types.model({
type: types.string,
text: types.string,
}),
),
})
.actions((self) => ({
setContent(newContent: string, contentType: string = "text") {
self.content = [{ type: contentType, text: newContent }];
},
append(newContent: string, contentType: string = "text") {
self.content.push({ type: contentType, text: newContent });
},
}));