feat: 支持知识库选择模式和标题生成模型配置
- 移除对rerankModel的强制检查,支持无知识库场景 - 优化知识库解析逻辑,优先处理用户明确指定的知识库
This commit is contained in:
@@ -147,8 +147,13 @@ func (h *Handler) setupSSEStream(reqCtx *qaRequestContext) *sseStreamContext {
|
||||
|
||||
// Generate title if needed
|
||||
if reqCtx.session.Title == "" {
|
||||
logger.Infof(reqCtx.ctx, "Session has no title, starting async title generation, session ID: %s", reqCtx.sessionID)
|
||||
h.sessionService.GenerateTitleAsync(asyncCtx, reqCtx.session, reqCtx.query, eventBus)
|
||||
// Use the same model as the conversation for title generation
|
||||
modelID := ""
|
||||
if reqCtx.customAgent != nil && reqCtx.customAgent.Config.ModelID != "" {
|
||||
modelID = reqCtx.customAgent.Config.ModelID
|
||||
}
|
||||
logger.Infof(reqCtx.ctx, "Session has no title, starting async title generation, session ID: %s, model: %s", reqCtx.sessionID, modelID)
|
||||
h.sessionService.GenerateTitleAsync(asyncCtx, reqCtx.session, reqCtx.query, modelID, eventBus)
|
||||
}
|
||||
|
||||
return streamCtx
|
||||
|
||||
@@ -52,7 +52,7 @@ func (h *Handler) GenerateTitle(c *gin.Context) {
|
||||
|
||||
// Call service to generate title
|
||||
logger.Infof(ctx, "Generating session title, session ID: %s, message count: %d", sessionID, len(request.Messages))
|
||||
title, err := h.sessionService.GenerateTitle(ctx, session, request.Messages)
|
||||
title, err := h.sessionService.GenerateTitle(ctx, session, request.Messages, "")
|
||||
if err != nil {
|
||||
logger.ErrorWithFields(ctx, err, nil)
|
||||
c.Error(errors.NewInternalServerError(err.Error()))
|
||||
|
||||
Reference in New Issue
Block a user