feat(core): restore per-request system prompt (#34335)
This commit is contained in:
parent
94e3a29d2f
commit
04c6bed240
9 changed files with 103 additions and 2 deletions
|
|
@ -23,4 +23,5 @@ export const Prompt = Schema.Struct({
|
|||
text: Schema.String,
|
||||
files: Schema.Array(FileAttachment).pipe(optional),
|
||||
agents: Schema.Array(AgentAttachment).pipe(optional),
|
||||
system: Schema.String.pipe(optional),
|
||||
}).annotate({ identifier: "PromptInput" })
|
||||
|
|
|
|||
|
|
@ -42,16 +42,18 @@ export const Prompt = Schema.Struct({
|
|||
text: Schema.String,
|
||||
files: Schema.Array(FileAttachment).pipe(optional),
|
||||
agents: Schema.Array(AgentAttachment).pipe(optional),
|
||||
system: Schema.String.pipe(optional),
|
||||
})
|
||||
.annotate({ identifier: "Prompt" })
|
||||
.pipe(
|
||||
statics((schema) => ({
|
||||
equivalence: Schema.toEquivalence(schema),
|
||||
fromUserMessage: (input: Pick<Prompt, "text" | "files" | "agents">) =>
|
||||
fromUserMessage: (input: Pick<Prompt, "text" | "files" | "agents" | "system">) =>
|
||||
schema.make({
|
||||
text: input.text,
|
||||
...(input.files === undefined ? {} : { files: input.files }),
|
||||
...(input.agents === undefined ? {} : { agents: input.agents }),
|
||||
...(input.system === undefined ? {} : { system: input.system }),
|
||||
}),
|
||||
})),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ export const User = Schema.Struct({
|
|||
text: Prompt.fields.text,
|
||||
files: Prompt.fields.files,
|
||||
agents: Prompt.fields.agents,
|
||||
system: Prompt.fields.system,
|
||||
type: Schema.Literal("user"),
|
||||
}).annotate({ identifier: "Session.Message.User" })
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue