diff --git a/api/src/Sozsoft.Platform.Application.Contracts/AiBots/AiBotDto.cs b/api/src/Sozsoft.Platform.Application.Contracts/AiBots/AiBotDto.cs index d5cdfcf..9367377 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/AiBots/AiBotDto.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/AiBots/AiBotDto.cs @@ -7,5 +7,6 @@ public class AiBotDto : FullAuditedEntityDto { public string Name { get; set; } public string ApiUrl { get; set; } + public string Description { get; set; } } diff --git a/api/src/Sozsoft.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs b/api/src/Sozsoft.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs index 119df24..8dcc6d5 100644 --- a/api/src/Sozsoft.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs +++ b/api/src/Sozsoft.Platform.DbMigrator/Seeds/ListFormSeeder_Saas.cs @@ -1239,14 +1239,14 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { new() { FieldName = "Id", FieldDbType = DbType.Guid, Value = "@NEWID", CustomValueType = FieldCustomValueTypeEnum.CustomKey } }), - EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 450, true, true, true, true, false), + EditingOptionJson = DefaultEditingOptionJson(listFormName, 500, 750, true, true, true, true, false), EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = [ + new() { Order=1, ColCount=2, ColSpan=1, ItemType="group", Items = [ new EditingFormItemDto { Order=1, DataField="Name", ColSpan=1, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=2, DataField="Description", ColSpan=1, EditorType2=EditorTypes.dxTextArea }, - new EditingFormItemDto { Order=3, DataField="ApiUrl", ColSpan=1, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=4, DataField="IsActive", ColSpan=1, EditorType2=EditorTypes.dxCheckBox } + new EditingFormItemDto { Order=2, DataField="IsActive", ColSpan=1, EditorType2=EditorTypes.dxCheckBox }, + new EditingFormItemDto { Order=3, DataField="ApiUrl", ColSpan=2, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=4, DataField="Description", ColSpan=2, EditorType2=EditorTypes.dxHtmlEditor, EditorOptions=EditorOptionValues.HtmlEditorOptions }, ]} }), FormFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] @@ -1293,15 +1293,14 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency new() { ListFormCode = listForm.ListFormCode, CultureName = LanguageCodes.En, - SourceDbType = DbType.String, - FieldName = "Description", - CaptionName = "App.Listform.ListformField.Description", + SourceDbType = DbType.Boolean, + FieldName = "IsActive", + CaptionName = "App.Listform.ListformField.IsActive", Width = 0, ListOrderNo = 3, Visible = true, IsActive = true, AllowSearch = true, - ValidationRuleJson = DefaultValidationRuleRequiredJson, ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson @@ -1325,14 +1324,15 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency new() { ListFormCode = listForm.ListFormCode, CultureName = LanguageCodes.En, - SourceDbType = DbType.Boolean, - FieldName = "IsActive", - CaptionName = "App.Listform.ListformField.IsActive", + SourceDbType = DbType.String, + FieldName = "Description", + CaptionName = "App.Listform.ListformField.Description", Width = 0, ListOrderNo = 5, - Visible = true, + Visible = false, IsActive = true, AllowSearch = true, + ValidationRuleJson = DefaultValidationRuleRequiredJson, ColumnCustomizationJson = DefaultColumnCustomizationJson, PermissionJson = DefaultFieldPermissionJson(listForm.Name), PivotSettingsJson = DefaultPivotSettingsJson diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 16b69ae..98f0831 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -192,8 +192,8 @@ public class PlatformDbContext : b.ConfigureByConvention(); b.Property(a => a.Name).IsRequired().HasMaxLength(128); - b.Property(a => a.Description).HasMaxLength(256); b.Property(a => a.ApiUrl).HasMaxLength(256); + b.Property(a => a.Description).HasColumnType("text"); b.HasIndex(x => new { x.Name }).IsUnique().HasFilter(null); }); diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260622213308_Initial.Designer.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260623105928_Initial.Designer.cs similarity index 99% rename from api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260622213308_Initial.Designer.cs rename to api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260623105928_Initial.Designer.cs index bddb82d..ec574e6 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260622213308_Initial.Designer.cs +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260623105928_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Sozsoft.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20260622213308_Initial")] + [Migration("20260623105928_Initial")] partial class Initial { /// @@ -689,8 +689,7 @@ namespace Sozsoft.Platform.Migrations .HasColumnType("nvarchar(256)"); b.Property("Description") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); + .HasColumnType("text"); b.Property("IsActive") .HasColumnType("bit"); diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260622213308_Initial.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260623105928_Initial.cs similarity index 99% rename from api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260622213308_Initial.cs rename to api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260623105928_Initial.cs index 5613d37..4ff82df 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260622213308_Initial.cs +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260623105928_Initial.cs @@ -921,7 +921,7 @@ namespace Sozsoft.Platform.Migrations { Id = table.Column(type: "uniqueidentifier", nullable: false), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), - Description = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + Description = table.Column(type: "text", nullable: true), ApiUrl = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), IsActive = table.Column(type: "bit", nullable: false) }, diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index ff51bb1..18f3992 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -686,8 +686,7 @@ namespace Sozsoft.Platform.Migrations .HasColumnType("nvarchar(256)"); b.Property("Description") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); + .HasColumnType("text"); b.Property("IsActive") .HasColumnType("bit"); diff --git a/configs/ai/Chat.json b/configs/ai/Chat.json index 547f8d2..c086a92 100644 --- a/configs/ai/Chat.json +++ b/configs/ai/Chat.json @@ -30,7 +30,7 @@ "promptType": "define", "text": "={{ $('Webhook').item.json.body.question }}", "options": { - "systemMessage": "Kullanıcı: {{ $json.body.question }}\n\nDoğrudan yanıt ver. Açıklayıcı, öğretici ve samimi ol." + "systemMessage": "{{ $json.body.description }}" } }, "type": "@n8n/n8n-nodes-langchain.agent", @@ -184,7 +184,7 @@ "executionOrder": "v1", "availableInMCP": false }, - "versionId": "84010ee3-81a9-48c8-9b48-a0661355d85c", + "versionId": "d9036bcb-7257-49a0-b848-ff451bce5bb8", "meta": { "templateCredsSetupCompleted": true, "instanceId": "1d288821beaaeeada5e8dce6f282c802098a0c83ef6ddb35a174b09a9d43850e" diff --git a/ui/src/proxy/ai/models.ts b/ui/src/proxy/ai/models.ts index 8c04a3b..37268cc 100644 --- a/ui/src/proxy/ai/models.ts +++ b/ui/src/proxy/ai/models.ts @@ -1,8 +1,9 @@ import { FullAuditedEntityDto } from '../abp' -export interface AiDto extends FullAuditedEntityDto { +export interface AiBotDto extends FullAuditedEntityDto { name: string apiUrl?: string + description?: string } export type ChatType = 'chat' | 'query' | 'analyze' diff --git a/ui/src/services/ai.service.ts b/ui/src/services/ai.service.ts index 22cc7d1..108167a 100644 --- a/ui/src/services/ai.service.ts +++ b/ui/src/services/ai.service.ts @@ -1,4 +1,4 @@ -import { AiDto } from '@/proxy/ai/models' +import { AiBotDto } from '@/proxy/ai/models' import { PagedAndSortedResultRequestDto, PagedResultDto } from '../proxy' import apiService, { Config } from './api.service' @@ -6,7 +6,7 @@ export class AiService { apiName = 'Default' getList = (input: PagedAndSortedResultRequestDto, config?: Partial) => - apiService.fetchData, PagedAndSortedResultRequestDto>( + apiService.fetchData, PagedAndSortedResultRequestDto>( { method: 'GET', url: '/api/app/ai-bot', diff --git a/ui/src/views/ai/Assistant.tsx b/ui/src/views/ai/Assistant.tsx index 7eb17bf..3c3f35f 100644 --- a/ui/src/views/ai/Assistant.tsx +++ b/ui/src/views/ai/Assistant.tsx @@ -4,7 +4,7 @@ import { useStoreState } from '@/store' import { Avatar, Button, Drawer, Dropdown, ScrollBar } from '@/components/ui' import { useLocalization } from '@/utils/hooks/useLocalization' import { aiService } from '@/services/ai.service' -import { AiDto } from '@/proxy/ai/models' +import { AiBotDto } from '@/proxy/ai/models' import { Container } from '@/components/shared' import { Helmet } from 'react-helmet' import { APP_NAME } from '@/constants/app.constant' @@ -104,10 +104,10 @@ const Assistant = () => { const aiPosts: Message[] = [] const [input, setInput] = useState('') const [loading, setLoading] = useState(false) - const [bot, setBot] = useState([]) + const [bot, setBot] = useState([]) const [selectedBot, setSelectedBot] = useState(null) - const { avatar } = useStoreState((state) => state.auth.user) + const { user, tenant } = useStoreState((state) => state.auth) const inputRef = useRef(null) const bottomRef = useRef(null) @@ -329,6 +329,8 @@ const Assistant = () => { biletId: conversationId, question: userMessage, sessionId: conversationId, + tenantName: tenant.tenantName ?? null, + // description: selectedBotItem?.description?.replace(/\r?\n/g, '\\n'), }), }) @@ -643,7 +645,7 @@ const Assistant = () => { className={`w-8 h-8 rounded-full flex items-center justify-center ${msg.role === 'user' ? 'bg-blue-500' : 'bg-gray-600'}`} > {msg.role === 'user' ? ( - + ) : ( )}