mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
Adding engineered query to chat command (#488)
* added engineered query to chat command * let ai know responses are rendered in markdown
This commit is contained in:
parent
be37916ca6
commit
75a82de5bf
@ -2625,7 +2625,7 @@ func getCmdInfoEngineeredPrompt(userQuery string, curLineStr string, shellType s
|
|||||||
// Enclose the command in triple backticks to format it as a code block.
|
// Enclose the command in triple backticks to format it as a code block.
|
||||||
promptCurrentCommand = " The user is currently working with the command: ```\n" + curLineStr + "\n```\n\n"
|
promptCurrentCommand = " The user is currently working with the command: ```\n" + curLineStr + "\n```\n\n"
|
||||||
}
|
}
|
||||||
promptFormattingInstruction := "Please ensure any command line suggestions or code snippets that are meant to be run by the user are enclosed in triple backquotes for easy copy and paste into the terminal."
|
promptFormattingInstruction := "Please ensure any command line suggestions or code snippets or scripts that are meant to be run by the user are enclosed in triple backquotes for easy copy and paste into the terminal. Also note that any response you give will be rendered in markdown."
|
||||||
promptQuestion := " The user's question is:\n\n" + userQuery + ""
|
promptQuestion := " The user's question is:\n\n" + userQuery + ""
|
||||||
|
|
||||||
return promptBase + promptCurrentCommand + promptFormattingInstruction + promptQuestion
|
return promptBase + promptCurrentCommand + promptFormattingInstruction + promptQuestion
|
||||||
@ -2875,7 +2875,9 @@ func OpenAICommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus
|
|||||||
update := scbus.MakeUpdatePacket()
|
update := scbus.MakeUpdatePacket()
|
||||||
return update, nil
|
return update, nil
|
||||||
}
|
}
|
||||||
prompt := []packet.OpenAIPromptMessageType{{Role: sstore.OpenAIRoleUser, Content: promptStr}}
|
osType := GetOsTypeFromRuntime()
|
||||||
|
engineeredQuery := getCmdInfoEngineeredPrompt(promptStr, "", ids.Remote.ShellType, osType)
|
||||||
|
prompt := []packet.OpenAIPromptMessageType{{Role: sstore.OpenAIRoleUser, Content: engineeredQuery}}
|
||||||
if resolveBool(pk.Kwargs["cmdinfoclear"], false) {
|
if resolveBool(pk.Kwargs["cmdinfoclear"], false) {
|
||||||
update := sstore.UpdateWithClearOpenAICmdInfo(cmd.ScreenId)
|
update := sstore.UpdateWithClearOpenAICmdInfo(cmd.ScreenId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user