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
3 changes: 2 additions & 1 deletion api/net/TNO.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.0.0" />
<PackageReference Include="Microsoft.AspnetCore.Authentication.jwtBearer" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.3.9" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes security warnings

<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.1" />
<!-- <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.1" /> -->
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.0.0" />
<PackageReference Include="prometheus-net.AspNetCore" Version="8.2.1" />
<PackageReference Include="FTTLib.dll" Version="1.1.7" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />

<PackageReference Include="System.Formats.Asn1" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions api/net/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,11 @@
"Watch": {
"IsEnabled": false,
"SendTo": ""
},
"Azure": {
"AI": {
"ProjectEndpoint": "",
"ModelDeploymentName": ""
}
}
}
Binary file not shown.
2 changes: 1 addition & 1 deletion app/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"redux-logger": "3.0.6",
"styled-components": "6.1.11",
"stylis": "4.3.2",
"tno-core": "1.0.29"
"tno-core": "1.0.31"
},
"devDependencies": {
"@simbathesailor/use-what-changed": "2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@
@(section.Value.Data)
</div>
}
else if (section.Value.SectionType == ReportSectionType.AI)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have a new section in the report

{
@* AI SECTION *@
var alt = section.Value.Settings.Label;
<div>
@(section.Value.Data)
</div>
}

@if (!horizontalCharts && !endChartGroup)
{
Expand Down
10 changes: 10 additions & 0 deletions app/editor/src/features/admin/reports/ReportFormSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
ReportContentOptions,
ReportHeadlineOptions,
ReportOptions,
ReportSectionAI,
ReportSectionContent,
ReportSectionData,
ReportSectionGallery,
Expand Down Expand Up @@ -160,6 +161,12 @@ export const ReportFormSections = () => {
>
Text
</Button>
<Button
variant={ButtonVariant.secondary}
onClick={() => handleAddSection(ReportSectionTypeName.AI)}
>
AI
</Button>
<Button
variant={ButtonVariant.secondary}
onClick={() => handleAddSection(ReportSectionTypeName.Content)}
Expand Down Expand Up @@ -277,6 +284,9 @@ export const ReportFormSections = () => {
<Show visible={section.sectionType === ReportSectionTypeName.Data}>
<ReportSectionData index={index} />
</Show>
<Show visible={section.sectionType === ReportSectionTypeName.AI}>
<ReportSectionAI index={index} />
</Show>
</>
)}
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { useFormikContext } from 'formik';
import { Checkbox, Col, FieldSize, FormikText, FormikTextArea, IReportModel, Row } from 'tno-core';

export interface IReportSectionAIProps {
index: number;
}

export const ReportSectionAI = ({ index }: IReportSectionAIProps) => {
const { values, setFieldValue } = useFormikContext<IReportModel>();

return (
<Col gap="1rem" className="section">
<FormikText
name={`sections.${index}.settings.label`}
label="Heading"
tooltip="A heading label to display at the beginning of the section"
maxLength={100}
/>
<FormikTextArea
name={`sections.${index}.description`}
label="Description"
tooltip="Describe the purpose of this section"
placeholder="An AI summary of the report"
/>
<Row>
<FormikText
name={`sections.${index}.settings.deploymentName`}
label="Model Deployment Name"
tooltip="The name of the model deployment"
maxLength={100}
placeholder="gpt-5.1-chat"
/>
<FormikText
name={`sections.${index}.settings.temperature`}
label="Temperature"
tooltip="Apply randomness to responses. Depending on the model it may support values 0 - 2. Lower is more deterministic. Higher is creative."
type="number"
width={FieldSize.Tiny}
placeholder="0"
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
let value = e.target.value;
setFieldValue(
`sections.${index}.settings.temperature`,
value.trim() === '' ? undefined : +value,
);
console.debug(value);
}}
/>
<FormikText
name={`sections.${index}.settings.choiceQty`}
label="Choices"
tooltip="Number of responses you want provided to compare. Some models do not have this feature."
type="number"
width={FieldSize.Tiny}
placeholder="1"
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
let value = e.target.value;
setFieldValue(
`sections.${index}.settings.choiceQty`,
value.trim() === '' ? undefined : +value,
);
console.debug(value);
}}
/>
</Row>
<FormikTextArea
name={`sections.${index}.settings.systemPrompt`}
label="System Prompt"
tooltip="Sets the global instructions and behavior for the model."
placeholder="You are a report writer. Review the report data and generate summaries and analysis. The report data is JSON, each section groups related content and contains an array of story records. The `content.text` property contains the story information. The output generated must be in simple HTML that works within Outlook email client. Place all the output in a <div>\{output\}</div>."
/>
<FormikTextArea
name={`sections.${index}.settings.userPrompt`}
label="User Prompt"
tooltip="Represents end-user input — questions, instructions, data, or prompts."
placeholder="Create an executive summary of the report data."
/>
<Checkbox
name={`sections.${index}.settings.inTableOfContents`}
label="Include in Table of Contents"
checked={
values.sections[index].settings.inTableOfContents === undefined
? true
: values.sections[index].settings.inTableOfContents
}
onChange={(e) => {
setFieldValue(`sections.${index}.settings.inTableOfContents`, e.target.checked);
}}
/>
</Col>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BiSolidFileJson } from 'react-icons/bi';
import { FaAlignJustify, FaChartPie, FaImage, FaList, FaNewspaper } from 'react-icons/fa6';
import { FaAlignJustify, FaBrain, FaChartPie, FaImage, FaList, FaNewspaper } from 'react-icons/fa6';
import { ReportSectionTypeName } from 'tno-core';

export interface ISectionIconProps {
Expand All @@ -21,5 +21,7 @@ export const SectionIcon = ({ type }: ISectionIconProps) => {
return <FaImage />;
} else if (type === ReportSectionTypeName.Data) {
return <BiSolidFileJson />;
} else if (type === ReportSectionTypeName.AI) {
return <FaBrain />;
} else return null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,12 @@ export const SectionLabel = ({ section }: ISectionLabelProps) => {
Data: {section.settings.label}
</Row>
);
} else if (section.sectionType === ReportSectionTypeName.AI) {
return (
<Row gap="0.25rem" alignItems="center">
<SectionIcon type={section.sectionType} />
AI: {section.settings.label}
</Row>
);
} else return <>Unknown</>;
};
1 change: 1 addition & 0 deletions app/editor/src/features/admin/reports/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './ReportContentOptions';
export * from './ReportHeadlineOptions';
export * from './ReportOptions';
export * from './ReportSectionAI';
export * from './ReportSectionContent';
export * from './ReportSectionData';
export * from './ReportSectionGallery';
Expand Down
Binary file removed app/editor/tno-core-1.0.28.tgz
Binary file not shown.
10 changes: 5 additions & 5 deletions app/editor/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12209,7 +12209,7 @@ __metadata:
sass-extract-loader: 1.1.0
styled-components: 6.1.11
stylis: 4.3.2
tno-core: 1.0.29
tno-core: 1.0.31
typescript: 4.9.5
vitest: 3.0.7
languageName: unknown
Expand Down Expand Up @@ -16674,9 +16674,9 @@ __metadata:
languageName: node
linkType: hard

"tno-core@npm:1.0.29":
version: 1.0.29
resolution: "tno-core@npm:1.0.29"
"tno-core@npm:1.0.31":
version: 1.0.31
resolution: "tno-core@npm:1.0.31"
dependencies:
"@elastic/elasticsearch": ^8.13.1
"@fortawesome/free-solid-svg-icons": ^6.4.2
Expand Down Expand Up @@ -16709,7 +16709,7 @@ __metadata:
styled-components: ^6.1.11
stylis: ^4.3.2
yup: ^1.1.1
checksum: 277dacbb5080703241317cb524e6faa7f7dd6e9af7b8bfb7e247d72f185c344cf2a486d6349960a2cf239c06f41c1124242d3e1c962ca37cee9e57de70e2ec62
checksum: 57f0f47bb6479e419dc71531fbf328f3a14e6ed0afdebc28c33c9dd5433ed3293f857e812220629aa30288c484323affff930191fd5e925b1696a402dbdeaf86
languageName: node
linkType: hard

Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion app/subscriber/Dockerfile.open
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM image-registry.openshift-image-registry.svc:5000/9b301c-tools/node:18-bullseye as build-deps
FROM image-registry.openshift-image-registry.svc:5000/9b301c-tools/node:18-bullseye AS build-deps

USER root

Expand Down
2 changes: 1 addition & 1 deletion app/subscriber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"sheetjs": "file:packages/xlsx-0.20.1.tgz",
"styled-components": "6.1.11",
"stylis": "4.3.2",
"tno-core": "1.0.29"
"tno-core": "1.0.31"
},
"devDependencies": {
"@testing-library/jest-dom": "6.6.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BiSolidFileJson } from 'react-icons/bi';
import { FaAlignJustify, FaChartPie, FaImage, FaList, FaNewspaper } from 'react-icons/fa6';
import { FaAlignJustify, FaBrain, FaChartPie, FaImage, FaList, FaNewspaper } from 'react-icons/fa6';
import { ReportSectionTypeName } from 'tno-core';

export interface ISectionIconProps {
Expand All @@ -21,5 +21,7 @@ export const SectionIcon = ({ type }: ISectionIconProps) => {
return <FaImage />;
} else if (type === ReportSectionTypeName.Data) {
return <BiSolidFileJson />;
} else if (type === ReportSectionTypeName.AI) {
return <FaBrain />;
} else return null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,13 @@ export const SectionLabel = ({ section, showIcon = true, showTotal }: ISectionLa
<span>{section.settings.label}</span>
</Row>
);
} else if (section.sectionType === ReportSectionTypeName.AI) {
return (
<Row gap="0.25rem" alignItems="center" className="section-header-label">
{showIcon && <SectionIcon type={section.sectionType} />}
<span>AI:</span>
<span>{section.settings.label}</span>
</Row>
);
} else return <>Unknown</>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useReportEditContext } from '../ReportEditContext';
import * as styled from './styled';
import {
AddSectionBar,
ReportSectionAI,
ReportSectionContent,
ReportSectionData,
ReportSectionGallery,
Expand Down Expand Up @@ -219,6 +220,10 @@ export const ReportEditTemplateForm = () => {
<Show visible={section.sectionType === ReportSectionTypeName.Data}>
<ReportSectionData index={index} />
</Show>
{/* AI */}
<Show visible={section.sectionType === ReportSectionTypeName.AI}>
<ReportSectionAI index={index} />
</Show>
</Section>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React from 'react';
import { BiSolidFileJson } from 'react-icons/bi';
import {
FaAlignJustify,
FaBrain,
FaChartPie,
FaImage,
FaImages,
Expand Down Expand Up @@ -84,6 +85,15 @@ export const AddSectionBar = () => {
<label>Table of Contents</label>
</Row>
</Button>
<Button
onClick={() => addSection(values.sections.length, ReportSectionTypeName.AI, false, false)}
disabled={isSubmitting}
>
<Row gap="1rem">
<FaBrain />
<label>AI</label>
</Row>
</Button>
<Button
onClick={() =>
addSection(values.sections.length, ReportSectionTypeName.Content, false, true)
Expand Down
Loading
Loading