Skip to content

Commit

Permalink
Adjust ai service (#7987)
Browse files Browse the repository at this point in the history
Signed-off-by: Kristina Fefelova <[email protected]>
  • Loading branch information
kristina-fefelova authored Feb 11, 2025
1 parent 7c3eb90 commit 9d8ec45
Show file tree
Hide file tree
Showing 59 changed files with 813 additions and 2,059 deletions.
2 changes: 0 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@
"MINIO_SECRET_KEY": "minioadmin",
"SERVER_SECRET": "secret",
"SERVICE_ID": "analytics-collector",
"SUPPORT_WORKSPACE": "09b65664-b3c3-4ea8-b9a1-c9688bde17f0",
"ACCOUNTS_URL": "http://localhost:3000"
},
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
Expand All @@ -586,7 +585,6 @@
"MONGO_URL": "mongodb://localhost:27017",
"PORT": "4010",
"SERVER_SECRET": "secret",
"SUPPORT_WORKSPACE": "09b65664-b3c3-4ea8-b9a1-c9688bde17f0",
"FIRST_NAME": "Jolie",
"LAST_NAME": "AI",
"PASSWORD": "password",
Expand Down
2 changes: 1 addition & 1 deletion desktop-package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "desktop",
"version": "0.6.271",
"version": "0.6.435",
"main": "dist/main/electron.js",
"author": "Hardcore Engineering <[email protected]>",
"template": "@hcengineering/default-package",
Expand Down
2 changes: 1 addition & 1 deletion desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hcengineering/desktop",
"version": "0.6.271",
"version": "0.6.435",
"main": "dist/main/electron.js",
"template": "@hcengineering/webpack-package",
"scripts": {
Expand Down
34 changes: 16 additions & 18 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ services:
- ACCOUNTS_URL=http://host.docker.internal:3000
- LAST_NAME_FIRST=true
- BRANDING_PATH=/var/cfg/branding.json
- SUPPORT_WORKSPACE=09b65664-b3c3-4ea8-b9a1-c9688bde17f0
- AI_BOT_URL=http://host.docker.internal:4010
restart: unless-stopped
transactor_cockroach:
Expand Down Expand Up @@ -282,6 +281,7 @@ services:
- ACCOUNTS_URL=http://host.docker.internal:3000
- LAST_NAME_FIRST=true
- BRANDING_PATH=/var/cfg/branding.json
- AI_BOT_URL=http://host.docker.internal:4010
restart: unless-stopped
green:
image: hardcoreeng/green
Expand Down Expand Up @@ -374,22 +374,21 @@ services:
- SERVICE_ID=sign-service
- BRANDING_PATH=/var/cfg/branding.json
- STATS_URL=http://host.docker.internal:4900
analytics:
image: hardcoreeng/analytics-collector
extra_hosts:
- 'host.docker.internal:host-gateway'
restart: unless-stopped
ports:
- 4017:4017
environment:
- SECRET=secret
- PORT=4017
- MONGO_URL=${MONGO_URL}
- 'MONGO_OPTIONS={"appName":"analytics","maxPoolSize":1}'
- SERVICE_ID=analytics-collector-service
- ACCOUNTS_URL=http://host.docker.internal:3000
- SUPPORT_WORKSPACE=09b65664-b3c3-4ea8-b9a1-c9688bde17f0
- STATS_URL=http://host.docker.internal:4900
# analytics:
# image: hardcoreeng/analytics-collector
# extra_hosts:
# - 'host.docker.internal:host-gateway'
# restart: unless-stopped
# ports:
# - 4017:4017
# environment:
# - SECRET=secret
# - PORT=4017
# - MONGO_URL=${MONGO_URL}
# - 'MONGO_OPTIONS={"appName":"analytics","maxPoolSize":1}'
# - SERVICE_ID=analytics-collector-service
# - ACCOUNTS_URL=http://host.docker.internal:3000
# - STATS_URL=http://host.docker.internal:4900
aiBot:
image: hardcoreeng/ai-bot
ports:
Expand All @@ -401,7 +400,6 @@ services:
- SERVER_SECRET=secret
- MONGO_URL=${MONGO_URL}
- ACCOUNTS_URL=http://host.docker.internal:3000
- SUPPORT_WORKSPACE=09b65664-b3c3-4ea8-b9a1-c9688bde17f0
- STORAGE_CONFIG=${STORAGE_CONFIG}
- FIRST_NAME=Jolie
- LAST_NAME=AI
Expand Down
34 changes: 16 additions & 18 deletions dev/local-mongo/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,31 +181,29 @@ services:
resources:
limits:
memory: 300M
analytics:
image: hardcoreeng/analytics-collector
restart: unless-stopped
ports:
- 4007:4007
environment:
- SECRET=secret
- PORT=4007
- MONGO_URL=mongodb://host.docker.internal:27017
- 'MONGO_OPTIONS={"appName":"analytics","maxPoolSize":1}'
- SERVICE_ID=analytics-collector-service
- ACCOUNTS_URL=http://account:3000
- SUPPORT_WORKSPACE=09b65664-b3c3-4ea8-b9a1-c9688bde17f0
deploy:
resources:
limits:
memory: 300M
# analytics:
# image: hardcoreeng/analytics-collector
# restart: unless-stopped
# ports:
# - 4007:4007
# environment:
# - SECRET=secret
# - PORT=4007
# - MONGO_URL=mongodb://host.docker.internal:27017
# - 'MONGO_OPTIONS={"appName":"analytics","maxPoolSize":1}'
# - SERVICE_ID=analytics-collector-service
# - ACCOUNTS_URL=http://account:3000
# deploy:
# resources:
# limits:
# memory: 300M
aiBot:
image: hardcoreeng/ai-bot
restart: unless-stopped
environment:
- SERVER_SECRET=secret
- MONGO_URL=mongodb://host.docker.internal:27017
- ACCOUNTS_URL=http://account:3000
- SUPPORT_WORKSPACE=09b65664-b3c3-4ea8-b9a1-c9688bde17f0
- FIRST_NAME=Jolie
- LAST_NAME=AI
- PASSWORD=password
Expand Down
4 changes: 1 addition & 3 deletions dev/prod/src/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
//

import { type AnalyticProvider, Analytics } from "@hcengineering/analytics"
import { AnalyticsCollectorProvider } from './analytics/analyticsCollector'
import { PosthogAnalyticProvider } from "./analytics/posthog"
import { SentryAnalyticProvider } from "./analytics/sentry"
import { type Config } from "./platform"

export function configureAnalytics (config: Config) {
const providers: AnalyticProvider[] = [
new SentryAnalyticProvider,
new PosthogAnalyticProvider,
new AnalyticsCollectorProvider
new PosthogAnalyticProvider
]
for (const provider of providers) {
Analytics.init(provider, config)
Expand Down
8 changes: 1 addition & 7 deletions models/ai-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,10 @@
},
"dependencies": {
"@hcengineering/ai-bot": "^0.6.0",
"@hcengineering/analytics-collector": "^0.6.0",
"@hcengineering/chunter": "^0.6.20",
"@hcengineering/contact": "^0.6.24",
"@hcengineering/core": "^0.6.32",
"@hcengineering/model": "^0.6.11",
"@hcengineering/model-contact": "^0.6.1",
"@hcengineering/model-core": "^0.6.0",
"@hcengineering/model-view": "^0.6.0",
"@hcengineering/platform": "^0.6.11",
"@hcengineering/ui": "^0.6.15",
"@hcengineering/view": "^0.6.13"
"@hcengineering/ui": "^0.6.15"
}
}
13 changes: 1 addition & 12 deletions models/ai-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,11 @@
//

import { type Builder } from '@hcengineering/model'
import core, { type Domain } from '@hcengineering/core'
import chunter from '@hcengineering/chunter'
import analyticsCollector from '@hcengineering/analytics-collector'

import aiBot from './plugin'

export { aiBotId } from '@hcengineering/ai-bot'
export { aiBotOperation } from './migration'
export default aiBot

export const DOMAIN_AI_BOT = 'ai_bot' as Domain

export function createModel (builder: Builder): void {
builder.createDoc(chunter.class.ChunterExtension, core.space.Model, {
point: 'aside',
ofClass: analyticsCollector.class.OnboardingChannel,
component: aiBot.component.OnboardingChannelPanelExtension
})
}
export function createModel (builder: Builder): void {}
7 changes: 1 addition & 6 deletions models/ai-bot/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,5 @@

import { mergeIds } from '@hcengineering/platform'
import aiBot, { aiBotId } from '@hcengineering/ai-bot'
import type { AnyComponent } from '@hcengineering/ui/src/types'

export default mergeIds(aiBotId, aiBot, {
component: {
OnboardingChannelPanelExtension: '' as AnyComponent
}
})
export default mergeIds(aiBotId, aiBot, {})
2 changes: 0 additions & 2 deletions models/analytics-collector/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
//

import { mergeIds } from '@hcengineering/platform'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Ref, Mixin } from '@hcengineering/core'
import analyticsCollector, { analyticsCollectorId } from '@hcengineering/analytics-collector'

export default mergeIds(analyticsCollectorId, analyticsCollector, {})
19 changes: 2 additions & 17 deletions models/chunter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ import {
TChatMessage,
TChatMessageViewlet,
TChatSyncInfo,
TChunterExtension,
TChunterSpace,
TDirectMessage,
TInlineButton,
TObjectChatPanel,
TThreadMessage,
TTypingInfo
TThreadMessage
} from './types'

export { chunterId } from '@hcengineering/chunter'
Expand All @@ -54,10 +51,7 @@ export function createModel (builder: Builder): void {
TThreadMessage,
TChatMessageViewlet,
TObjectChatPanel,
TChatSyncInfo,
TInlineButton,
TTypingInfo,
TChunterExtension
TChatSyncInfo
)

builder.createDoc(
Expand Down Expand Up @@ -161,10 +155,6 @@ export function createModel (builder: Builder): void {
presenter: chunter.component.ThreadMessagePresenter
})

builder.mixin(chunter.class.TypingInfo, core.class.Class, core.mixin.TransientConfiguration, {
broadcastOnly: true
})

builder.createDoc(
view.class.Viewlet,
core.space.Model,
Expand Down Expand Up @@ -315,11 +305,6 @@ export function createModel (builder: Builder): void {
defineActions(builder)
defineNotifications(builder)

builder.mixin(chunter.class.InlineButton, core.class.Class, core.mixin.IndexConfiguration, {
indexes: [],
searchDisabled: true
})

builder.mixin(chunter.class.ChatSyncInfo, core.class.Class, core.mixin.IndexConfiguration, {
indexes: [],
searchDisabled: true
Expand Down
39 changes: 3 additions & 36 deletions models/chunter/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,22 @@ import {
TypeString,
UX
} from '@hcengineering/model'
import core, { TAttachedDoc, TClass, TDoc, TSpace } from '@hcengineering/model-core'
import core, { TClass, TDoc, TSpace } from '@hcengineering/model-core'
import type {
Channel,
ChatMessage,
ChatMessageViewlet,
ChatSyncInfo,
ChunterExtension,
ChunterSpace,
DirectMessage,
InlineButton,
InlineButtonAction,
ObjectChatPanel,
ThreadMessage,
TypingInfo,
ChunterExtensionPoint
ThreadMessage
} from '@hcengineering/chunter'
import {
type Class,
type Doc,
type Domain,
DOMAIN_MODEL,
DOMAIN_TRANSIENT,
IndexKind,
type Ref,
type Timestamp
Expand All @@ -54,11 +48,10 @@ import contact, { type ChannelProvider as SocialChannelProvider, type Person } f
import activity, { type ActivityMessage } from '@hcengineering/activity'
import { TActivityMessage } from '@hcengineering/model-activity'
import attachment from '@hcengineering/model-attachment'
import type { IntlString, Resource } from '@hcengineering/platform'
import type { IntlString } from '@hcengineering/platform'
import type { DocNotifyContext } from '@hcengineering/notification'

import chunter from './plugin'
import type { AnyComponent } from '@hcengineering/ui'

export const DOMAIN_CHUNTER = 'chunter' as Domain

Expand Down Expand Up @@ -94,9 +87,6 @@ export class TChatMessage extends TActivityMessage implements ChatMessage {

@Prop(TypeRef(contact.class.ChannelProvider), core.string.Object)
provider?: Ref<SocialChannelProvider>

@Prop(PropCollection(chunter.class.InlineButton), core.string.Object)
inlineButtons?: number
}

@Model(chunter.class.ThreadMessage, chunter.class.ChatMessage)
Expand Down Expand Up @@ -145,26 +135,3 @@ export class TChatSyncInfo extends TDoc implements ChatSyncInfo {
hidden!: Ref<DocNotifyContext>[]
timestamp!: Timestamp
}

@Model(chunter.class.InlineButton, core.class.Doc, DOMAIN_CHUNTER)
export class TInlineButton extends TAttachedDoc implements InlineButton {
name!: string
titleIntl?: IntlString
title?: string
action!: Resource<InlineButtonAction>
}

@Model(chunter.class.TypingInfo, core.class.Doc, DOMAIN_TRANSIENT)
export class TTypingInfo extends TDoc implements TypingInfo {
objectId!: Ref<Doc>
objectClass!: Ref<Class<Doc>>
person!: Ref<Person>
lastTyping!: Timestamp
}

@Model(chunter.class.ChunterExtension, core.class.Doc, DOMAIN_MODEL)
export class TChunterExtension extends TDoc implements ChunterExtension {
ofClass!: Ref<Class<Doc>>
point!: ChunterExtensionPoint
component!: AnyComponent
}
Loading

0 comments on commit 9d8ec45

Please sign in to comment.