Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webapi/Controllers/ChatArchiveController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private async Task<ChatArchive> CreateChatArchiveAsync(Guid chatId, Cancellation
chatArchive.ChatTitle = chat.Title;

// get the system description
chatArchive.SystemDescription = chat.SystemDescription;
chatArchive.SystemDescription = chat.SafeSystemDescription;

// get the chat history
chatArchive.ChatHistory = await this.GetAllChatMessagesAsync(chatIdString);
Expand Down
2 changes: 1 addition & 1 deletion webapi/Controllers/ChatHistoryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public async Task<IActionResult> EditChatSessionAsync(
if (await this._sessionRepository.TryFindByIdAsync(chatId.ToString(), callback: v => chat = v))
{
chat!.Title = chatParameters.Title ?? chat!.Title;
chat!.SystemDescription = chatParameters.SystemDescription ?? chat!.SystemDescription;
chat!.SystemDescription = chatParameters.SystemDescription ?? chat!.SafeSystemDescription;
chat!.MemoryBalance = chatParameters.MemoryBalance ?? chat!.MemoryBalance;
await this._sessionRepository.UpsertAsync(chat);
await messageRelayHubContext.Clients.Group(chatId.ToString()).SendAsync(ChatEditedClientCall, chat);
Expand Down
5 changes: 5 additions & 0 deletions webapi/Models/Storage/ChatSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public class ChatSession : IStorageEntity
/// </summary>
public string SystemDescription { get; set; }

/// <summary>
/// Fixed system description with "TimeSkill" replaced by "TimePlugin"
/// </summary>
public string SafeSystemDescription => this.SystemDescription.Replace("TimeSkill", "TimePlugin", StringComparison.OrdinalIgnoreCase);

/// <summary>
/// The balance between long term memory and working term memory.
/// The higher this value, the more the system will rely on long term memory by lowering
Expand Down
2 changes: 1 addition & 1 deletion webapi/Plugins/Chat/ChatPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,6 @@ private async Task SetSystemDescriptionAsync(string chatId, CancellationToken ca
throw new ArgumentException("Chat session does not exist.");
}

this._promptOptions.SystemDescription = chatSession!.SystemDescription;
this._promptOptions.SystemDescription = chatSession!.SafeSystemDescription;
}
}