Skip to content

Commit 2e72052

Browse files
Merge pull request #2141 from solliancenet/cp-show-file-upload-agent-setting
Adds global and agent level settings for allowing file uploads in Chat
2 parents 7c7176a + 88adfca commit 2e72052

File tree

12 files changed

+65
-6
lines changed

12 files changed

+65
-6
lines changed

docs/release-notes/breaking-changes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To support the event grid infrastructure, the following new App Configuration se
2828
{
2929
"key": "FoundationaLLM:Events:Profiles:GatewayAPI",
3030
"label": null,
31-
"value": "{\"EventProcessingCycleSeconds\":60,\"Topics\":[]}",
31+
"value": "{\"EventProcessingCycleSeconds\": 5,\"Topics\": [{\"Name\": \"resource-providers\",\"SubscriptionPrefix\": \"rp-gateway\"}]}",
3232
"content_type": "application/json",
3333
"tags": {}
3434
},
@@ -73,7 +73,8 @@ Added the following App Configuration value:
7373

7474
|Name | Default value | Description |
7575
|--- | --- | --- |
76-
`FoundationaLLM:UserPortal:Authentication:Entra:TimeoutInMinutes` | `60` | The timeout in minutes for a user's auth token in the User Portal. |
76+
| `FoundationaLLM:UserPortal:Authentication:Entra:TimeoutInMinutes` | `60` | The timeout in minutes for a user's auth token in the User Portal. |
77+
| `FoundationaLLM:UserPortal:Configuration:ShowFileUpload` | `true` | Global setting to determine if file upload is allowed on chat messages. |
7778

7879
## Starting with 0.9.1-rc117
7980

src/dotnet/Common/Constants/Data/AppConfiguration.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,14 @@
16261626
"value": "true",
16271627
"content_type": "",
16281628
"first_version": "0.9.0"
1629+
},
1630+
{
1631+
"name": "ShowFileUpload",
1632+
"description": "Global setting to determine if file upload is allowed on chat messages.",
1633+
"secret": "",
1634+
"value": "true",
1635+
"content_type": "",
1636+
"first_version": "0.9.0"
16291637
}
16301638
]
16311639
},

src/dotnet/Common/Models/ResourceProviders/Agent/AgentBase.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ public class AgentBase : ResourceBase
115115
[JsonPropertyName("show_view_prompt")]
116116
public bool? ShowViewPrompt { get; set; } = true;
117117

118+
/// <summary>
119+
/// Indicates whether to show the file upload option on agent message input.
120+
/// </summary>
121+
[JsonPropertyName("show_file_upload")]
122+
public bool? ShowFileUpload { get; set; } = true;
123+
118124
/// <summary>
119125
/// The object type of the agent.
120126
/// </summary>

src/dotnet/Common/Templates/AppConfigurationKeys.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,13 @@ public static class AppConfigurationKeys
12121212
/// </summary>
12131213
public const string FoundationaLLM_UserPortal_Configuration_ShowViewPrompt =
12141214
"FoundationaLLM:UserPortal:Configuration:ShowViewPrompt";
1215+
1216+
/// <summary>
1217+
/// The app configuration key for the FoundationaLLM:UserPortal:Configuration:ShowFileUpload setting.
1218+
/// <para>Value description:<br/>Global setting to determine if file upload is allowed on chat messages.</para>
1219+
/// </summary>
1220+
public const string FoundationaLLM_UserPortal_Configuration_ShowFileUpload =
1221+
"FoundationaLLM:UserPortal:Configuration:ShowFileUpload";
12151222

12161223
#endregion
12171224

src/dotnet/Common/Templates/appconfig.template.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,13 @@
966966
"content_type": "",
967967
"tags": {}
968968
},
969+
{
970+
"key": "FoundationaLLM:UserPortal:Configuration:ShowFileUpload",
971+
"value": "true",
972+
"label": null,
973+
"content_type": "",
974+
"tags": {}
975+
},
969976
{
970977
"key": "FoundationaLLM:ManagementPortal:Authentication:Entra:Instance",
971978
"value": "https://login.microsoftonline.com/",

src/ui/ManagementPortal/js/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export type Agent = ResourceBase & {
6868
show_message_tokens?: boolean;
6969
show_message_rating?: boolean;
7070
show_view_prompt?: boolean;
71+
show_file_upload?: boolean;
7172

7273
ai_model_object_id: string;
7374

@@ -336,6 +337,7 @@ export type CreateAgentRequest = ResourceBase & {
336337
show_message_tokens?: boolean;
337338
show_message_rating?: boolean;
338339
show_view_prompt?: boolean;
340+
show_file_upload?: boolean;
339341

340342
ai_model_object_id: string;
341343

src/ui/ManagementPortal/pages/agents/create.vue

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,11 @@
727727
aria-labelledby="aria-show-message-rating"
728728
/>
729729
</div>
730-
730+
731+
<div id="aria-show-view-prompt" class="step-header">Would you like to allow the user to see the message prompts?</div>
732+
<div id="aria-show-file-upload" class="step-header">Would you like to allow the user to upload files?</div>
731733
<!-- Show view prompt -->
732-
<div id="aria-show-view-prompt" class="step-header span-2">Would you like to allow the user to see the message prompts?</div>
733-
<div class="span-2">
734+
<div>
734735
<ToggleButton
735736
v-model="showViewPrompt"
736737
on-label="Yes"
@@ -740,6 +741,19 @@
740741
aria-labelledby="aria-show-view-prompt"
741742
/>
742743
</div>
744+
745+
<!-- Show file upload -->
746+
747+
<div>
748+
<ToggleButton
749+
v-model="showFileUpload"
750+
on-label="Yes"
751+
on-icon="pi pi-check-circle"
752+
off-label="No"
753+
off-icon="pi pi-times-circle"
754+
aria-labelledby="aria-show-file-upload"
755+
/>
756+
</div>
743757
</section>
744758

745759
<!-- System prompt -->
@@ -897,6 +911,7 @@ const getDefaultFormValues = () => {
897911
showMessageTokens: false as boolean,
898912
showMessageRating: false as boolean,
899913
showViewPrompt: false as boolean,
914+
showFileUpload: false as boolean
900915
};
901916
};
902917
@@ -1187,6 +1202,7 @@ export default {
11871202
this.showMessageTokens = agent.show_message_tokens ?? false;
11881203
this.showMessageRating = agent.show_message_rating ?? false;
11891204
this.showViewPrompt = agent.show_view_prompt ?? false;
1205+
this.showFileUpload = agent.show_file_upload ?? false;
11901206
},
11911207
11921208
updateAgentWelcomeMessage(newContent: string) {
@@ -1324,7 +1340,7 @@ export default {
13241340
}
13251341
13261342
this.loading = true;
1327-
this.loadingStatusText = 'Creating agent...';
1343+
this.loadingStatusText = 'Saving agent...';
13281344
13291345
const promptRequest = {
13301346
type: 'multipart',
@@ -1401,6 +1417,7 @@ export default {
14011417
show_message_tokens: this.showMessageTokens,
14021418
show_message_rating: this.showMessageRating,
14031419
show_view_prompt: this.showViewPrompt,
1420+
show_file_upload: this.showFileUpload,
14041421
14051422
vectorization: {
14061423
dedicated_pipeline: this.dedicated_pipeline,

src/ui/UserPortal/components/ChatInput.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
style="height: 100%"
2929
@click="toggle"
3030
@keydown.esc="hideAllPoppers"
31+
v-if="$appConfigStore.showFileUpload && $appStore.agentShowFileUpload"
3132
/>
3233
<OverlayPanel ref="menu" :dismissable="isMobile" style="max-width: 98%">
3334
<div class="file-upload-header">

src/ui/UserPortal/js/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export interface Agent {
125125
show_message_tokens?: boolean;
126126
show_message_rating?: boolean;
127127
show_view_prompt?: boolean;
128+
show_file_upload?: boolean;
128129
}
129130

130131
export interface CompletionRequest {

src/ui/UserPortal/server/api/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const allowedKeys = [
4040
'FoundationaLLM:UserPortal:Configuration:ShowMessageRating',
4141
'FoundationaLLM:UserPortal:Configuration:ShowViewPrompt',
4242
'FoundationaLLM:UserPortal:Configuration:ShowMessageTokens',
43+
'FoundationaLLM:UserPortal:Configuration:ShowFileUpload',
4344
'FoundationaLLM:APIEndpoints:CoreAPI:Configuration:AllowedUploadFileExtensions',
4445
];
4546

src/ui/UserPortal/stores/appConfigStore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const useAppConfigStore = defineStore('appConfig', {
3737
showLastConversionOnStartup: null,
3838
showMessageTokens: null,
3939
showViewPrompt: null,
40+
showFileUpload: null,
4041

4142
// Auth: These settings configure the MSAL authentication.
4243
auth: {
@@ -92,6 +93,7 @@ export const useAppConfigStore = defineStore('appConfig', {
9293
showLastConversionOnStartup,
9394
showMessageTokens,
9495
showViewPrompt,
96+
showFileUpload,
9597
authClientId,
9698
authInstance,
9799
authTenantId,
@@ -135,6 +137,7 @@ export const useAppConfigStore = defineStore('appConfig', {
135137
getConfigValueSafe('FoundationaLLM:UserPortal:Configuration:ShowLastConversationOnStartup', 'true'),
136138
getConfigValueSafe('FoundationaLLM:UserPortal:Configuration:ShowMessageTokens', 'true'),
137139
getConfigValueSafe('FoundationaLLM:UserPortal:Configuration:ShowViewPrompt', 'true'),
140+
getConfigValueSafe('FoundationaLLM:UserPortal:Configuration:ShowFileUpload', 'true'),
138141
api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:ClientId'),
139142
api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:Instance'),
140143
api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:TenantId'),
@@ -174,6 +177,7 @@ export const useAppConfigStore = defineStore('appConfig', {
174177
this.showLastConversionOnStartup = JSON.parse(showLastConversionOnStartup.toLowerCase());
175178
this.showMessageTokens = JSON.parse(showMessageTokens.toLowerCase());
176179
this.showViewPrompt = JSON.parse(showViewPrompt.toLowerCase());
180+
this.showFileUpload = JSON.parse(showFileUpload.toLowerCase());
177181

178182
this.auth.clientId = authClientId;
179183
this.auth.instance = authInstance;

src/ui/UserPortal/stores/appStore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ export const useAppStore = defineStore('app', {
5555
agentShowViewPrompt(): boolean {
5656
return this.lastSelectedAgent?.resource.show_view_prompt ?? true;
5757
},
58+
59+
agentShowFileUpload(): boolean {
60+
return this.lastSelectedAgent?.resource.show_file_upload ?? true;
61+
}
5862
},
5963

6064
actions: {

0 commit comments

Comments
 (0)