mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-10 23:47:21 +00:00
Fixed and improved the system prompt of chats started from assistants (#1172)
This commit is contained in:
1 parent
bbf4dc2231
commit
31862f5ecd
50 files changed
+1112
-107
No files matched your search
@@ -1,3 +1,3 @@
|
||||
namespace AIStudio.Chat;
|
||||
|
||||
public sealed record ChatStartRequest(ChatThread ChatThread, bool ApplySelectedChatTemplateToComposer = false, bool PreserveDataSourceOptions = false);
|
||||
public sealed record ChatStartRequest(ChatThread ChatThread, bool PreserveDataSourceOptions = false);
|
||||
@@ -0,0 +1,25 @@
|
||||
using AIStudio.Assistants;
|
||||
|
||||
namespace AIStudio.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// Which assistant chose the system prompt of a chat, and how.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Stored with a chat which continues the conversation of an assistant, so that the dialog showing the
|
||||
/// system prompt can name the assistant, and tell the prompt of the assistant apart from a prompt the
|
||||
/// assistant wrote for the chat. A chat without it got its prompt elsewhere: from AI Studio, from a
|
||||
/// chat template, or from a version of AI Studio before v26.11.1.
|
||||
/// </remarks>
|
||||
public sealed record ChatSystemPromptOrigin
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the chat got the prompt of the assistant or a prompt the assistant wrote for the chat.
|
||||
/// </summary>
|
||||
public ChatSystemPromptSource Source { get; set; } = ChatSystemPromptSource.ASSISTANT;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the assistant, as AI Studio showed it when the chat started.
|
||||
/// </summary>
|
||||
public string AssistantName { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -241,6 +241,15 @@ public sealed record ChatThread
|
||||
/// </summary>
|
||||
public string SystemPrompt { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Which assistant chose the system prompt of this chat, and how; null when the chat got its prompt elsewhere.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Set when a chat continues the conversation of an assistant, see AssistantBase.ChatSystemPrompt, so that
|
||||
/// the dialog showing the system prompt names the assistant rather than calling it the prompt of this chat.
|
||||
/// </remarks>
|
||||
public ChatSystemPromptOrigin? SystemPromptOrigin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The content blocks of the chat thread.
|
||||
/// </summary>
|
||||
@@ -414,7 +423,7 @@ public sealed record ChatThread
|
||||
|
||||
parts.Add(usesChatTemplate
|
||||
? new(SystemPromptPartKind.CHAT_TEMPLATE, systemPromptTextWithChatTemplate) { SourceName = chatTemplate.Name }
|
||||
: new(SystemPromptPartKind.BASE_PROMPT, systemPromptTextWithChatTemplate));
|
||||
: new(SystemPromptPartKind.BASE_PROMPT, systemPromptTextWithChatTemplate) { Origin = this.SystemPromptOrigin });
|
||||
|
||||
//
|
||||
// Add augmented data, if available:
|
||||
|
||||
@@ -19,6 +19,12 @@ public sealed record SystemPromptPart(SystemPromptPartKind Kind, string Text)
|
||||
/// </summary>
|
||||
public string SourceName { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Which assistant chose the base prompt, and how, when the chat continues the conversation of an
|
||||
/// assistant; null for every other part.
|
||||
/// </summary>
|
||||
public ChatSystemPromptOrigin? Origin { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The tools whose usage policy the part states; empty for every other part.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user