@@ -16,6 +16,7 @@ import {
1616} from './apiBasedTools.js' ;
1717import type { ApiBasedTool } from './apiBasedTools.js' ;
1818import {
19+ appendCustomSystemPrompt ,
1920 buildAgentSystemPrompt ,
2021 DEFAULT_AGENT_SYSTEM_PROMPT ,
2122} from "./agent/systemPrompt.js" ;
@@ -67,7 +68,7 @@ function assertRequiredApiTool(
6768export default class AdminForthAgentPlugin extends AdminForthPlugin {
6869 options : PluginOptions ;
6970 apiBasedTools : Record < string , ApiBasedTool > = { } ;
70- agentSystemPromptPromise = Promise . resolve ( DEFAULT_AGENT_SYSTEM_PROMPT ) ;
71+ agentSystemPromptPromise : Promise < string > ;
7172
7273 private async createNewTurn ( sessionId : string , prompt : string , response ?: string ) {
7374 const turnId = randomUUID ( ) ;
@@ -109,6 +110,9 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
109110 constructor ( options : PluginOptions ) {
110111 super ( options , import . meta. url ) ;
111112 this . options = options ;
113+ this . agentSystemPromptPromise = Promise . resolve (
114+ appendCustomSystemPrompt ( DEFAULT_AGENT_SYSTEM_PROMPT , this . options . systemPrompt ) ,
115+ ) ;
112116 this . shouldHaveSingleInstancePerWholeApp = ( ) => false ;
113117 }
114118
@@ -139,7 +143,8 @@ export default class AdminForthAgentPlugin extends AdminForthPlugin {
139143 assertRequiredApiTool ( this . apiBasedTools , toolName ) ;
140144 }
141145 assertRequiredApiTool ( this . apiBasedTools , "update_record" ) ;
142- this . agentSystemPromptPromise = buildAgentSystemPrompt ( adminforth ) ;
146+ this . agentSystemPromptPromise = buildAgentSystemPrompt ( adminforth )
147+ . then ( ( systemPrompt ) => appendCustomSystemPrompt ( systemPrompt , this . options . systemPrompt ) ) ;
143148 }
144149
145150 instanceUniqueRepresentation ( pluginOptions : any ) : string {
0 commit comments