Skip to content

Commit

Permalink
Beta99 (#99)
Browse files Browse the repository at this point in the history
* beta1

* beta2

* beta3

* beta4

* beta5

* beta6

* beta7

* beta8

* beta9

* beta10

* beta11

* beta12

* beta13

* beta14

* beta15

* beta16

* beta16

* beta19

* beta20

* beta21

* beta22

* beta23

* beta24

* beta25

* beta27

* beta28

* beta29

* beta30

* beta31

* beta33

* beta34

* beta35

* beta36

* beta37

* beta38

* beta39

* beta40

* beta41

* beta42

* beta43

* beta44

* beta45

* beta45

* beta46

* beat48

* beta49

* beta50

* beta51

* beta52

* beta53

* beta54

* beta55

* beta57

* beta58

* beta59

* beta61

* beta62

* beta63

* beta63

* beta64

* beta65

* beta66

* beta67

* beta70

* beta71

* beta72

* beta72

* beta74

* beta75

* beta76

* beta77

* beta78

* beta79

* beta80

* beta81

* beta82

* beta83

* beta85

* beta86

* beta87

* beta88

* beta89

* beta90

* beta91

* beta92

* beta93

* beta94

* beta94

* beta96

* beta97

* beta98

* beta99
  • Loading branch information
Hoshinonyaruko authored Apr 30, 2024
1 parent 0a811f9 commit b583fdd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
6 changes: 3 additions & 3 deletions applogic/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (app *App) ApplyPromptChoiceQ(promptstr string, requestmsg *string, message

// 计算当前对话轮次
currentRound := PromptMarksLength - CustomRecord.PromptStrStat + 1
fmt.Printf("故事模式:当前对话轮次Q %v", currentRound)
fmt.Printf("故事模式:当前对话轮次Q %v\n", currentRound)

enhancedChoices := config.GetEnhancedPromptChoices(promptstr)
if enhancedChoices {
Expand Down Expand Up @@ -148,10 +148,10 @@ func (app *App) ApplySwitchOnQ(promptstr *string, requestmsg *string, message *s

// 计算当前对话轮次
currentRound := PromptMarksLength - CustomRecord.PromptStrStat + 1
fmt.Printf("关键词切换分支状态:当前对话轮次Q %v,当前promptstr:%v", currentRound, promptstr)
fmt.Printf("关键词切换分支状态:当前对话轮次Q %v,当前promptstr:%v\n", currentRound, promptstr)

enhancedChoices := config.GetEnhancedPromptChoices(*promptstr)
fmt.Printf("关键词切换分支状态:%v", enhancedChoices)
fmt.Printf("关键词切换分支状态:%v\n", enhancedChoices)
if enhancedChoices {
// 遍历所有的promptChoices配置项
for _, choice := range promptstrChoices {
Expand Down
23 changes: 8 additions & 15 deletions prompt/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ func FindFirstSystemMessage(history []structs.Message) (structs.Message, error)
}

// 返回除了 "system" 角色之外的所有消息
// GetMessagesExcludingSystem returns a list of messages that are not of "system" role,
// randomly selecting from options separated by "||" in prompt contents.
func GetMessagesExcludingSystem(basename string) ([]structs.Message, error) {
lock.RLock()
defer lock.RUnlock()
Expand All @@ -184,21 +186,12 @@ func GetMessagesExcludingSystem(basename string) ([]structs.Message, error) {
var history []structs.Message
for _, prompt := range promptFile.Prompts {
if prompt.Role != "system" && prompt.Role != "System" {
// Check if Content contains || and create a separate message for each part
if strings.Contains(prompt.Content, "||") {
contents := strings.Split(prompt.Content, "||")
for _, content := range contents {
history = append(history, structs.Message{
Text: strings.TrimSpace(content), // Trim spaces for clean message text
Role: prompt.Role,
})
}
} else {
history = append(history, structs.Message{
Text: prompt.Content,
Role: prompt.Role,
})
}
// Check if Content contains || and randomly select one part
content := chooseRandomContent(prompt.Content)
history = append(history, structs.Message{
Text: content,
Role: prompt.Role,
})
}
}

Expand Down

0 comments on commit b583fdd

Please sign in to comment.