refactor: update session title generation and language context handling
- Modified the session title generation template to focus on extracting only the intent of the user's question. - Enhanced the session service to include language context when generating titles. - Updated middleware to inject language into the request context. - Added a new test suite for validating SSRF safety of URLs.
This commit is contained in:
@@ -454,6 +454,7 @@ func (s *sessionService) GenerateTitleAsync(
|
||||
// sessionRepo.Update uses session.TenantID in WHERE, so the session row is updated correctly regardless of ctx.
|
||||
tenantID := ctx.Value(types.TenantIDContextKey)
|
||||
requestID := ctx.Value(types.RequestIDContextKey)
|
||||
language := ctx.Value(types.LanguageContextKey)
|
||||
go func() {
|
||||
bgCtx := context.Background()
|
||||
if tenantID != nil {
|
||||
@@ -462,6 +463,9 @@ func (s *sessionService) GenerateTitleAsync(
|
||||
if requestID != nil {
|
||||
bgCtx = context.WithValue(bgCtx, types.RequestIDContextKey, requestID)
|
||||
}
|
||||
if language != nil {
|
||||
bgCtx = context.WithValue(bgCtx, types.LanguageContextKey, language)
|
||||
}
|
||||
|
||||
// Skip if title already exists
|
||||
if session.Title != "" {
|
||||
|
||||
Reference in New Issue
Block a user