mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-13 18:41:36 +00:00
Refactored
This commit is contained in:
parent
d78d800ea0
commit
41aff4b9db
@ -122,33 +122,37 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<SettingsDialo
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (this.chatThread is not null)
|
if (this.chatThread is null)
|
||||||
{
|
{
|
||||||
var convertThread = new ChatThread();
|
return new ChatThread
|
||||||
convertThread = convertThread with
|
|
||||||
{
|
{
|
||||||
SystemPrompt = SystemPrompts.DEFAULT,
|
SystemPrompt = SystemPrompts.DEFAULT
|
||||||
Blocks =
|
|
||||||
[
|
|
||||||
new ContentBlock()
|
|
||||||
{
|
|
||||||
Role = ChatRole.USER,
|
|
||||||
HideFromUser = false,
|
|
||||||
ContentType = ContentType.TEXT,
|
|
||||||
Content = new ContentText()
|
|
||||||
{
|
|
||||||
FileAttachments = this.loadedDocumentPaths.ToList(),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
this.chatThread.Blocks.Last(),
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
return convertThread;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ChatThread
|
return new ChatThread
|
||||||
{
|
{
|
||||||
SystemPrompt = SystemPrompts.DEFAULT
|
SystemPrompt = SystemPrompts.DEFAULT,
|
||||||
|
Blocks =
|
||||||
|
[
|
||||||
|
// Replace the first "user block" (here, it was/is the block generated by the assistant) with a new one
|
||||||
|
// that includes the loaded document paths and a standard message about the previous analysis session:
|
||||||
|
new ContentBlock
|
||||||
|
{
|
||||||
|
Role = ChatRole.USER,
|
||||||
|
HideFromUser = false,
|
||||||
|
ContentType = ContentType.TEXT,
|
||||||
|
Content = new ContentText
|
||||||
|
{
|
||||||
Text = this.T("The result of your previous document analysis session."),
|
Text = this.T("The result of your previous document analysis session."),
|
||||||
|
FileAttachments = this.loadedDocumentPaths.ToList(),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Then, append the last block of the current chat thread
|
||||||
|
// (which is expected to be the AI response):
|
||||||
|
this.chatThread.Blocks.Last(),
|
||||||
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user