Skip to content

Commit

Permalink
Fixed date time appearing before delimeter
Browse files Browse the repository at this point in the history
Added quick way to select what to include into system prompt
  • Loading branch information
realkalash committed Jan 2, 2025
1 parent 29cb832 commit fd16d0a
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 16 deletions.
75 changes: 73 additions & 2 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,10 @@ class PageHeaderText extends StatelessWidget {
),
),
GestureDetector(
onTap: ()=> chatProvider.recalculateTokensFromLocalMessages(),
child: const Icon(ic.FluentIcons.arrow_counterclockwise_20_filled)),
onTap: () =>
chatProvider.recalculateTokensFromLocalMessages(),
child: const Icon(
ic.FluentIcons.arrow_counterclockwise_20_filled)),
const Spacer(),
IconButton(
icon: const Icon(ic.FluentIcons.search_20_filled, size: 20),
Expand Down Expand Up @@ -1318,6 +1320,75 @@ class _ChatGPTContentState extends State<ChatGPTContent> {
checked:
AppCache.learnAboutUserAfterCreateNewChat.value!,
icon: ic.FluentIcons.brain_circuit_20_regular,
shrinkWrapActions: true,
maxWidthContextMenu: 300,
contextItems: [
Text('Select items to include in system prompt'),
Padding(
padding: const EdgeInsets.all(8.0),
child: Divider(),
),
CheckBoxTile(
isChecked: AppCache
.includeKnowledgeAboutUserToSysPrompt.value!,
child: Text('Knowledge about user'),
onChanged: (p0) {
setState(() {
AppCache.learnAboutUserAfterCreateNewChat
.value = p0;
});
},
),
CheckBoxTile(
isChecked:
AppCache.includeUserCityNamePrompt.value!,
child: Text('City name'),
onChanged: (p0) {
setState(() {
AppCache.includeUserCityNamePrompt.value = p0;
});
},
),
CheckBoxTile(
isChecked: AppCache.includeWeatherPrompt.value!,
child: Text('Weather'),
onChanged: (p0) {
setState(() {
AppCache.includeWeatherPrompt.value = p0;
});
},
),
CheckBoxTile(
isChecked:
AppCache.includeUserNameToSysPrompt.value!,
child: Text('User name'),
onChanged: (p0) {
setState(() {
AppCache.includeUserNameToSysPrompt.value = p0;
});
},
),
CheckBoxTile(
isChecked:
AppCache.includeTimeToSystemPrompt.value!,
child: Text('Current timestamp'),
onChanged: (p0) {
setState(() {
AppCache.includeUserNameToSysPrompt.value = p0;
});
},
),
CheckBoxTile(
isChecked:
AppCache.includeSysInfoToSysPrompt.value!,
child: Text('OS info'),
onChanged: (p0) {
setState(() {
AppCache.includeSysInfoToSysPrompt.value = p0;
});
},
),
],
onChanged: (v) {
setState(() {
AppCache.learnAboutUserAfterCreateNewChat.value = v;
Expand Down
28 changes: 14 additions & 14 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ class _OverlaySettingsState extends State<OverlaySettings> {
children: [
Text('Overlay settings',
style: FluentTheme.of(context).typography.subtitle),
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.enableOverlay.value!,
onChanged: (value) {
setState(() {
Expand All @@ -569,7 +569,7 @@ class _OverlaySettingsState extends State<OverlaySettings> {
},
child: const Text('Enable overlay'),
),
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.showSettingsInOverlay.value!,
onChanged: (value) {
setState(() {
Expand Down Expand Up @@ -823,35 +823,35 @@ class _GlobalSettingsState extends State<GlobalSettings> {
Text('User name in OS: ${SysInfo.userName}'),
]),
),
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.includeUserCityNamePrompt.value!,
onChanged: (value) {
AppCache.includeUserCityNamePrompt.value = value;
},
child: const Text('Include user city name in system prompt'),
),
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.includeWeatherPrompt.value!,
onChanged: (value) {
AppCache.includeWeatherPrompt.value = value;
},
child: const Text('Include weather in system prompt'),
),
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.includeUserNameToSysPrompt.value!,
onChanged: (value) {
AppCache.includeUserNameToSysPrompt.value = value;
},
child: const Text('Include user name in system prompt'),
),
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.includeTimeToSystemPrompt.value!,
onChanged: (value) {
AppCache.includeTimeToSystemPrompt.value = value;
},
child: const Text('Include current date and time in system prompt'),
),
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.includeSysInfoToSysPrompt.value!,
onChanged: (value) {
AppCache.includeSysInfoToSysPrompt.value = value;
Expand All @@ -865,7 +865,7 @@ class _GlobalSettingsState extends State<GlobalSettings> {
'\nCAN CAUSE ADDITIONAL SIGNIFICANT CHARGES!',
child: Row(
children: [
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.learnAboutUserAfterCreateNewChat.value!,
onChanged: (value) {
AppCache.learnAboutUserAfterCreateNewChat.value = value;
Expand Down Expand Up @@ -894,7 +894,7 @@ class _GlobalSettingsState extends State<GlobalSettings> {
),
Row(
children: [
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.includeKnowledgeAboutUserToSysPrompt.value!,
onChanged: (value) {
AppCache.includeKnowledgeAboutUserToSysPrompt.value = value;
Expand All @@ -919,8 +919,8 @@ class _GlobalSettingsState extends State<GlobalSettings> {
}
}

class _CheckBoxTile extends StatefulWidget {
const _CheckBoxTile({
class CheckBoxTile extends StatefulWidget {
const CheckBoxTile({
super.key,
required this.isChecked,
required this.child,
Expand All @@ -930,10 +930,10 @@ class _CheckBoxTile extends StatefulWidget {
final Widget child;
final void Function(bool?)? onChanged;
@override
State<_CheckBoxTile> createState() => _CheckBoxTileState();
State<CheckBoxTile> createState() => _CheckBoxTileState();
}

class _CheckBoxTileState extends State<_CheckBoxTile> {
class _CheckBoxTileState extends State<CheckBoxTile> {
bool isChecked = false;
bool isHovered = false;
@override
Expand Down Expand Up @@ -1052,7 +1052,7 @@ class _EnabledGptToolsState extends State<EnabledGptTools> {
Wrap(
spacing: 15.0,
children: [
_CheckBoxTile(
CheckBoxTile(
isChecked: AppCache.gptToolCopyToClipboardEnabled.value!,
onChanged: (value) {
setState(() {
Expand Down
1 change: 1 addition & 0 deletions lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Future<String> getFormattedSystemPrompt(
AppCache.includeUserNameToSysPrompt.value! ||
AppCache.includeWeatherPrompt.value! ||
AppCache.includeUserCityNamePrompt.value! ||
AppCache.includeTimeToSystemPrompt.value! ||
AppCache.includeKnowledgeAboutUserToSysPrompt.value!;

if (isIncludeAdditionalEnabled) {
Expand Down

0 comments on commit fd16d0a

Please sign in to comment.