Skip to content

Commit 19e490a

Browse files
committed
Merge branch 'development' into feature/queuestorage
2 parents 799746e + 35bfe1d commit 19e490a

File tree

612 files changed

+11635
-2304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

612 files changed

+11635
-2304
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ignoredFiles>
3+
<files>
4+
<file relativePath="../../Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md" />
5+
<file relativePath="../Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md" />
6+
<file relativePath="Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md" />
7+
</files>
8+
</ignoredFiles>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<outputFiles>
33
<files>
4-
<file relativePath="Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md" state="once-off-generated" />
4+
<file relativePath="Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md" state="ignored;once-off-generated" />
55
</files>
66
</outputFiles>

Modules/AzureFunctions.Dispatch.Services/AzureFunctions.Dispatch.Services.application.output.log

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,49 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<outputLog>
2+
<outputLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
33
<ApplicationId>dd606e23-930e-465c-bad1-9922641967b0</ApplicationId>
44
<FileLogs>
5+
<FileLog>
6+
<OverwriteBehaviour>always</OverwriteBehaviour>
7+
<ApplicationRelativeFilePath>../../../../Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md</ApplicationRelativeFilePath>
8+
<IsIgnored>true</IsIgnored>
9+
</FileLog>
10+
<FileLog>
11+
<OverwriteBehaviour>always</OverwriteBehaviour>
12+
<ApplicationRelativeFilePath>../../../Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md</ApplicationRelativeFilePath>
13+
<IsIgnored>true</IsIgnored>
14+
</FileLog>
515
<FileLog>
616
<ProjectId>4c832ff3-49a4-47fa-b114-75b7f37e3d32</ProjectId>
717
<CorrelationId>Intent.ModuleBuilder.Templates.FactoryExtension#549d57c1-113f-45c3-85a7-460bc18872f5</CorrelationId>
818
<OverwriteBehaviour>always</OverwriteBehaviour>
9-
<ApplicationRelativeFilePath>../Intent.Modules.AzureFunctions.Dispatch.Services/FactoryExtensions/ContractDispatchExtension.cs</ApplicationRelativeFilePath>
10-
<ProjectRelativeFilePath>ContractDispatchExtension.cs</ProjectRelativeFilePath>
19+
<ApplicationRelativeFilePath>../../Intent.Modules.AzureFunctions.Dispatch.Services/FactoryExtensions/ContractDispatchExtension.cs</ApplicationRelativeFilePath>
1120
<IsIgnored>false</IsIgnored>
1221
</FileLog>
1322
<FileLog>
1423
<ProjectId>a5e2fbde-b680-478d-9dbe-11e798d5fdc3</ProjectId>
1524
<CorrelationId>Intent.ModuleBuilder.IModSpecFile</CorrelationId>
1625
<OverwriteBehaviour>always</OverwriteBehaviour>
17-
<ApplicationRelativeFilePath>../Intent.Modules.AzureFunctions.Dispatch.Services/Intent.AzureFunctions.Dispatch.Services.imodspec</ApplicationRelativeFilePath>
18-
<ProjectRelativeFilePath>Intent.AzureFunctions.Dispatch.Services.imodspec</ProjectRelativeFilePath>
26+
<ApplicationRelativeFilePath>../../Intent.Modules.AzureFunctions.Dispatch.Services/Intent.AzureFunctions.Dispatch.Services.imodspec</ApplicationRelativeFilePath>
1927
<IsIgnored>false</IsIgnored>
2028
</FileLog>
2129
<FileLog>
2230
<ProjectId>a5e2fbde-b680-478d-9dbe-11e798d5fdc3</ProjectId>
2331
<CorrelationId>Intent.VisualStudio.Projects.CSharpProject#a5e2fbde-b680-478d-9dbe-11e798d5fdc3</CorrelationId>
2432
<OverwriteBehaviour>always</OverwriteBehaviour>
25-
<ApplicationRelativeFilePath>../Intent.Modules.AzureFunctions.Dispatch.Services/Intent.Modules.AzureFunctions.Dispatch.Services.csproj</ApplicationRelativeFilePath>
26-
<ProjectRelativeFilePath>Intent.Modules.AzureFunctions.Dispatch.Services.csproj</ProjectRelativeFilePath>
33+
<ApplicationRelativeFilePath>../../Intent.Modules.AzureFunctions.Dispatch.Services/Intent.Modules.AzureFunctions.Dispatch.Services.csproj</ApplicationRelativeFilePath>
2734
<IsIgnored>false</IsIgnored>
2835
</FileLog>
2936
<FileLog>
3037
<ProjectId>a5e2fbde-b680-478d-9dbe-11e798d5fdc3</ProjectId>
3138
<CorrelationId>Intent.ModuleBuilder.Templates.ReleaseNotes</CorrelationId>
3239
<OverwriteBehaviour>once-off</OverwriteBehaviour>
33-
<ApplicationRelativeFilePath>../Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md</ApplicationRelativeFilePath>
34-
<ProjectRelativeFilePath>release-notes.md</ProjectRelativeFilePath>
35-
<IsIgnored>false</IsIgnored>
40+
<ApplicationRelativeFilePath>../../Intent.Modules.AzureFunctions.Dispatch.Services/release-notes.md</ApplicationRelativeFilePath>
41+
<IsIgnored>true</IsIgnored>
3642
</FileLog>
3743
<FileLog>
3844
<CorrelationId>Intent.VisualStudio.Projects.VisualStudioSolution#05345d7b-3b4c-4e2d-8fff-07059a542948</CorrelationId>
3945
<OverwriteBehaviour>always</OverwriteBehaviour>
40-
<ApplicationRelativeFilePath>../Intent.Modules.NET.sln</ApplicationRelativeFilePath>
46+
<ApplicationRelativeFilePath>../../Intent.Modules.NET.sln</ApplicationRelativeFilePath>
4147
<IsIgnored>false</IsIgnored>
4248
</FileLog>
4349
</FileLogs>
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
interface IModelRecord {
2+
providerId: string;
3+
modelName: string;
4+
providerName: string;
5+
thinkingType: ThinkingType;
6+
}
7+
8+
type ThinkingType = "None" | "Unknown" | "ThinkingLevels";
9+
10+
interface IProviderModelsResult {
11+
providerModels: IModelRecord[];
12+
modelLookup: { [key: string]: IModelRecord };
13+
}
14+
15+
interface ICollectedAiSettings {
16+
providerId: string;
17+
modelId: string;
18+
thinkingLevel: string | null;
19+
}
20+
21+
async function getAiProviderModels(): Promise<IProviderModelsResult> {
22+
const moduleTaskResult = await executeModuleTask("Intent.Modules.Common.AI.Tasks.ProviderModelsTask");
23+
24+
const providerModels = JSON.parse(moduleTaskResult) as IModelRecord[];
25+
const modelLookup = providerModels.reduce((acc: any, item) => {
26+
acc[`${item.providerId}--${item.modelName}`] = item;
27+
return acc;
28+
}, {});
29+
30+
return { providerModels, modelLookup };
31+
}
32+
33+
async function getAiModelSelectionFields(providerModelsResult: IProviderModelsResult, aiSettingKeyPrefix: string): Promise<MacroApi.Context.IDynamicFormFieldConfig[]> {
34+
const globalSettings = await userSettings.loadGlobalAsync();
35+
const settingModelId = globalSettings.get(`${aiSettingKeyPrefix}.ModelId`);
36+
const settingThinkingLevel = globalSettings.get(`${aiSettingKeyPrefix}.ThinkingLevel`);
37+
38+
const { providerModels, modelLookup } = providerModelsResult;
39+
const initialThinkingType = modelLookup[settingModelId]?.thinkingType;
40+
41+
return [
42+
{
43+
id: "model",
44+
fieldType: "select",
45+
label: "Model",
46+
isRequired: true,
47+
hint: getModelHint(providerModels, initialThinkingType),
48+
selectOptions:
49+
Object.entries(modelLookup)
50+
.map(([key, value]: [string, IModelRecord]) => {
51+
return {
52+
id: key,
53+
description: value.modelName,
54+
additionalInfo: value.providerName
55+
};
56+
}),
57+
value: settingModelId,
58+
onChange: async (config) => {
59+
const curThinkingType = modelLookup[config.getField("model").value as string].thinkingType;
60+
const thinkingField = config.getField("thinking");
61+
62+
thinkingField.isHidden = curThinkingType === "None";
63+
thinkingField.selectOptions = getApplicableThinkingOptions(curThinkingType);
64+
thinkingField.hint = getModelHint(providerModels, curThinkingType);
65+
66+
if (curThinkingType === "ThinkingLevels") {
67+
thinkingField.value = "low";
68+
} else if (curThinkingType === "Unknown") {
69+
thinkingField.value = "none";
70+
} else {
71+
thinkingField.value = null;
72+
}
73+
}
74+
},
75+
{
76+
id: "thinking",
77+
fieldType: "select",
78+
label: "Thinking/reasoning mode",
79+
isHidden: settingThinkingLevel == null || providerModels.length === 0,
80+
value: settingThinkingLevel,
81+
selectOptions: getApplicableThinkingOptions(initialThinkingType)
82+
}
83+
];
84+
85+
function getModelHint(providerModels: IModelRecord[], thinkingType: ThinkingType | null): string {
86+
if (providerModels.length === 0) {
87+
return "Not seeing any AI Models? Learn how to configure or add models [here](https://docs.intentarchitect.com/articles/modules-common/intent-common-ai/intent-common-ai.html).";
88+
} else if (thinkingType == "Unknown") {
89+
return "Thinking level for model is unknown; none is selected by default.";
90+
} else {
91+
return "";
92+
}
93+
}
94+
95+
function getApplicableThinkingOptions(thinkingType: ThinkingType | null): MacroApi.Context.IDynamicFormFieldSelectOption[] {
96+
if (thinkingType === "ThinkingLevels") {
97+
return [
98+
{
99+
id: "low",
100+
description: "Low",
101+
additionalInfo: "Thinks less, quicker"
102+
},
103+
{
104+
id: "high",
105+
description: "High",
106+
additionalInfo: "Thinks more, slower"
107+
}
108+
];
109+
} else if (thinkingType === "Unknown") {
110+
return [
111+
{
112+
id: "none",
113+
description: "None",
114+
additionalInfo: "No thinking/reasoning"
115+
},
116+
{
117+
id: "low",
118+
description: "Low",
119+
additionalInfo: "Thinks less, quicker"
120+
},
121+
{
122+
id: "high",
123+
description: "High",
124+
additionalInfo: "Thinks more, slower"
125+
}
126+
];
127+
} else {
128+
return [];
129+
}
130+
}
131+
}
132+
133+
async function collectAndPersistAiSettingsFromPromptResult(promptResult: any, providerModelsResult: IProviderModelsResult, aiSettingKeyPrefix: string): Promise<ICollectedAiSettings> {
134+
const providerId = providerModelsResult.modelLookup[promptResult.model].providerId;
135+
const modelId = providerModelsResult.modelLookup[promptResult.model].modelName;
136+
const thinkingLevel = promptResult.thinking;
137+
138+
const globalSettings = await userSettings.loadGlobalAsync();
139+
globalSettings.set(`${aiSettingKeyPrefix}.ModelId`, `${providerId}--${modelId}`);
140+
globalSettings.set(`${aiSettingKeyPrefix}.ThinkingLevel`, thinkingLevel);
141+
142+
return { providerId, modelId, thinkingLevel: thinkingLevel };
143+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
async function execute(taskId: string): Promise<void> {
2+
3+
const providerModelsResult = await getAiProviderModels();
4+
const settingName = "AI.AutoImplementation";
5+
6+
// Open a dialog for the user to enter an AI prompt
7+
let promptResult = await dialogService.openForm({
8+
title: "AI: Auto-Implement Handler for " + element.getName(),
9+
icon: Icons.AiImplement,
10+
fields: [
11+
{
12+
id: "prompt",
13+
fieldType: "textarea",
14+
label: "Provide any additional context",
15+
placeholder: "Leave blank if you wish to provide no additional context.",
16+
hint: "NOTE: Additional context will be combined with the Intent Architect auto-generated prompt to guide the AI Agent."
17+
},
18+
...await getAiModelSelectionFields(providerModelsResult, settingName)
19+
],
20+
submitButtonText: "Execute",
21+
minWidth: "750px"
22+
});
23+
24+
// Check if the user cancelled
25+
if (!promptResult) {
26+
return;
27+
}
28+
29+
const { providerId, modelId, thinkingLevel: thinkingLevel } = await collectAndPersistAiSettingsFromPromptResult(
30+
promptResult, providerModelsResult, settingName);
31+
32+
await launchHostedModuleTask(taskId,
33+
[
34+
application.id,
35+
element.id,
36+
promptResult.prompt ?? "",
37+
providerId,
38+
modelId,
39+
thinkingLevel
40+
],
41+
{
42+
taskName: "AI: Handler for " + element.getName()
43+
});
44+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
$tsconfig = Join-Path $PSScriptRoot 'tsconfig.json'
2+
tsc -p $tsconfig
3+
4+
if ($LASTEXITCODE -ne 0) {
5+
Write-Host "Exited early as build failed for $tsconfig"
6+
exit
7+
}

0 commit comments

Comments
 (0)