Skip to content

Commit d92e3ae

Browse files
authored
fix: fix bug that title generation doesn't work sometimes (casibase#1454)
1 parent eeb1b1c commit d92e3ae

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

carrier/suggestion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Here is the user's question: %s`
4747
4848
1. **Generate an answer**: Provide a clear, accurate, and helpful answer to the user's question.
4949
50-
2. **Predict possible follow-up questions from the user**: Based on the current question and answer, think and predict three questions that the user might ask further.
50+
2. **Predict possible follow-up questions from the user's query**: Based on the current question and answer, think and predict three questions that the user might ask further.
5151
5252
3. **Format the answer and predicted questions**: Use a specific format to connect the answer and the predicted questions. The format is as follows:
5353
- Follow the answer with a separator "%s"
@@ -56,7 +56,7 @@ Here is the user's question: %s`
5656
Your answer should be replied in the following format: %s
5757
5858
The '<>' is to tell you to put something in here, your answer does not need to include '<>'.
59-
The language of suggestions should be the same as the language of answer
59+
The language of suggestions should be the same as the language of answer.
6060
Every Predicted question should end with a question mark '?'.
6161
6262
Please note, the separator for each part is "%s", make sure not to use this separator in the answer or question.

carrier/title.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ func (p *TitleCarrier) GetQuestion(question string) (string, error) {
3232

3333
format := "<title>"
3434
question = question +
35-
"\n\nYour reasoning and response must be in the same language as user's question." +
36-
"\n\n**At the end of your answer, if and only if a clear, concise, and meaningful title can be generated to summarize the content, append it.**\n" +
37-
"The title should appear at the very end of the response, prefixed by: " + p.divider + "\n" +
35+
"\n\n**At the end of your answer, if and only if a clear, concise, and meaningful topic title can be generated — based on both the user's input and your response — then append it.**\n" +
36+
"A meaningful topic title should be able to represent the user's purpose or the overall theme of this conversation.\n" +
37+
"Examples of generated title:\n" +
38+
"\tquery: what is casibase? title: introduction to casibase\n" +
39+
"It should appear at the very end of the response, prefixed by: " + p.divider + "\n" +
3840
"Do not include the divider or title if a meaningful title cannot be generated.\n" +
3941
"Format:\n<Your complete answer>\n" + p.divider + format + "\n"
4042

controllers/message_carrier.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ They must:
107107
if needTitle {
108108
fullPrompt.WriteString(`
109109
**Finally, generate a concise and meaningful title for the original question. No need to answer user question.
110-
111-
- The title must be in the same language.
110+
A meaningful topic title should be able to represent the user's purpose or the overall theme of this conversation.
111+
Examples of generated title:
112+
query: what is casibase? title: introduction to casibase
112113
- The title must start with "=====" (five equals signs, no space).
113114
- Do not include the divider or title if a meaningful title cannot be generated.
114115
- Do NOT include any explanations or extra text—just output the title.`)

0 commit comments

Comments
 (0)