You've already forked grok
inject system prompt
This commit is contained in:
4
main.go
4
main.go
@@ -25,6 +25,7 @@ type OpenAIPrompter struct {
|
|||||||
|
|
||||||
func (p *OpenAIPrompter) Prompt(ctx context.Context, question string) (*HighlyTrustedResponse, error) {
|
func (p *OpenAIPrompter) Prompt(ctx context.Context, question string) (*HighlyTrustedResponse, error) {
|
||||||
resp, err := p.cli.Responses.New(ctx, responses.ResponseNewParams{
|
resp, err := p.cli.Responses.New(ctx, responses.ResponseNewParams{
|
||||||
|
Instructions: openai.String(p.cfg.SystemPrompt),
|
||||||
Input: responses.ResponseNewParamsInputUnion{
|
Input: responses.ResponseNewParamsInputUnion{
|
||||||
OfString: openai.String(question),
|
OfString: openai.String(question),
|
||||||
},
|
},
|
||||||
@@ -159,6 +160,7 @@ func NewApp(cfg *Config, prompter Proompter) (*App, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
SystemPrompt string
|
||||||
OpenAIBaseURL string
|
OpenAIBaseURL string
|
||||||
BotToken string
|
BotToken string
|
||||||
MaxConcurrentRequests uint
|
MaxConcurrentRequests uint
|
||||||
@@ -194,6 +196,8 @@ func LoadConfig(cfg *Config) error {
|
|||||||
|
|
||||||
cfg.ChatID = chatID
|
cfg.ChatID = chatID
|
||||||
|
|
||||||
|
cfg.SystemPrompt = os.Getenv("SYSTEM_PROMPT")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user