Skip to content

Commit a4e9a75

Browse files
committed
Merge branch 'fix/ai' of github.com:codex-team/hawk.api.nodejs into prod
2 parents 0ecc56d + a3b2e71 commit a4e9a75

File tree

3 files changed

+121
-4
lines changed

3 files changed

+121
-4
lines changed

docs/Database.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
We have 2 dbs:
2+
3+
1) hawk_events - for storing events
4+
2) hawk - for storing hawk data (accounts, workspaces, projects, etc)
5+
6+
7+
## Hawk Accounts DB
8+
9+
1) users - for storing users
10+
11+
| field | description | example |
12+
|-------|-------------|---------|
13+
| _id | User's id | 5e4f05324658711f198eacda |
14+
| email | User's email | "[email protected]" |
15+
| password | User's password | "$argon2id$v=11$m=4096,t=3,p=1$SKEK3jKkdWOKwPqlEjRc+A$jz07GCY9nVRMMP1wc…" |
16+
| notifications | User's notifications Settings | Object |
17+
| image | User's image | "https://static.hawk.so/4f01f0df-15d7-4c0f-9069-f5d67323183b.false" |
18+
| projectsLastVisit | When user last visited project | {67f81eff82a14b26e49dffa7: 1744317119.049} |
19+
| workspaces | User's membership in workspaces | { 5e4ff30a62fa6c73a415f4d5: { isPending: false } } |
20+
21+
2) workspaces - for storing workspaces
22+
23+
| field | description | example |
24+
|-------|-------------|---------|
25+
| _id | Workspace's id | 5e4fd1214ee6ce183f8361ef |
26+
| name | Workspace's name | "My workspae ekekekke" |
27+
| description | Workspace's description | null |
28+
| image | Workspace's image | null |
29+
| tariffPlanId | Workspace's tariff plan id | 5f47f031ff71f10040f433c1 |
30+
| lastChargeDate | Workspace's last charge date | 2025-11-17T23:05:00.111+00:00 |
31+
| billingPeriodEventsCount | Workspace's billing period events count | 123440 |
32+
| inviteHash | Workspace's invite hash | "52a72e2195ab264af5f7a05c477375d49e73b43bcebdc1f9a0039dca34d92a36" |
33+
| isBlocked | Workspace's is blocked | false |
34+
35+
3) projects - for storing projects
36+
37+
| field | description | example |
38+
|-------|-------------|---------|
39+
| _id | Project's id | 5e4fd1334ee6ce183e8361f2 |
40+
| name | Project's name | "Murrr" |
41+
| workspaceId | Project's workspace id | 5e4fd1314ee6ce18308361ef |
42+
| uidAdded | Project's user id | 5e4fd0f74ee6ce18308361ee |
43+
| token | Project's token | "eyJpbeRoZ3JhdGlvbklkIjoiMDAyZGFkZTAtZjU5ZC00NWY5LWE5ZTAtNGIwZTIxZjk3ZD…" |
44+
| archivedEventsCount | Project's archived events count | 7 |
45+
| integrationId | Project's integration id | "002dade0-f29d-45f9-a9e0-4b0e21fe7d2d" |
46+
| notifications | Project's notifications | [{_id: ObjectId, isEnabled: boolean, uidAdded: ObjectId, whatToReceive: string, including: string[], excluding: string[], channels: Object, threshold: number, thresholdPeriod: number}] |
47+
48+
3) team:<workspaceId>
49+
50+
| field | description | example |
51+
|-------|-------------|---------|
52+
| _id | Team's id | 5e4ff30a628a6cc93e15f4d6 |
53+
| userId | Team's user id. Null in case when user does not accept invitation | 5e4f053246587414198eabda |
54+
| isAdmin | Team's is admin | true |
55+
| userEmail | When uses does not accept invitation, user email is stored here | "[email protected]" |
56+
57+
58+
## Hawk Events DB
59+
60+
1) events:<projectId>
61+
62+
Stores original events from catchers.
63+
64+
| field | description | example |
65+
|-------|-------------|---------|
66+
| _id | Event's id | 6893631b2176d3aa5ee46b74 |
67+
| groupHash | Event's group hash | "0b8aa4148b28d8dd6f540fbdfa6e4830ab9c738134f56265157118140e79cad2" |
68+
| totalCount | Event's total count | 26482 |
69+
| catcherType | Event's catcher type | "errors/nodejs" |
70+
| payload | Original event payload | See <a href="https://docs.hawk.so/event-format">Event Payload</a> for more details |
71+
| timestamp | Event's timestamp | 1754489626 |
72+
| usersAffected | Event's users affected | 0 |
73+
| visitedBy | Event's visited by | Array (6) |
74+
75+
76+
2) repetitions:<projectId>
77+
78+
All remaining event repetitions are stored here.
79+
80+
| field | description | example |
81+
|-------|-------------|---------|
82+
| _id | Repetition's id | 690e1e84f4715e805f5df476 |
83+
| groupHash | Repetition's group hash | "0b8aa4148b28d8dd6ff40fbdfa6d4830ab9c738134f56265157118140e79cad2" |
84+
| delta | Repetition's delta | "{user: 2}" |
85+
| timestamp | Repetition's timestamp | 1762532996 |
86+
87+
3) dailyEvents:<projectId>
88+
89+
Stores daily events grouped by days
90+
91+
| field | description | example |
92+
|-------|-------------|---------|
93+
| _id | Daily event's id | 690e8c97c5dc69fda8ea321a |
94+
| groupHash | Daily event's group hash | "0b8aa4148b28d8dd6f540fbdfa6e4830ab9c738134f56265157118140e79cad2" |
95+
| groupingTimestamp | Particulary day timestamp | 1762560000 |
96+
| affectedUsers | Daily event's affected users | 0 |
97+
| count | Daily event's count | 14 |
98+
| lastRepetitionId | Daily event's last repetition id | 690fbc23f6b9df643ecbdf78 |
99+
| lastRepetitionTime | Daily event's last repetition time | 1762634787 |
100+
101+
102+
4) releases
103+
104+
Stores releases. See <a href="https://docs.hawk-tracker.ru/releases">Releases</a> for more details.
105+
106+
| field | description | example |
107+
|-------|-------------|---------|
108+
| _id | Release's id | 68d2cd44bc89c68673bc4ed9 |
109+
| projectId | Release's project id | "67dbc5744ded409f3e9ed738" |
110+
| release | Release's release | "v3" |
111+
| files | Release's files | Array (5) |
112+
| commits | Release's commits | Array (empty) |
113+
114+
115+
| workspace id | workspace name | project id | project name | website | segment |
116+
| -- | -- | -- | -- | -- | -- |
117+
| 5e4ff31a628a6c72a425f4d5 | ALLoEvents | 60d05cc31274895fded62138 | ALLoEvents production [PHP] | https://alloevents.com | ... |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hawk.api",
3-
"version": "1.2.31",
3+
"version": "1.2.32",
44
"main": "index.ts",
55
"license": "BUSL-1.1",
66
"scripts": {

src/integrations/vercel-ai/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ class VercelAIApi {
1717
/**
1818
* @todo make it dynamic, get from project settings
1919
*/
20-
this.modelId = 'gpt-4o';
20+
this.modelId = 'deepseek/deepseek-v3.1';
2121
}
2222

2323
/**
2424
* Generate AI suggestion for the event
2525
*
26-
* @param {EventData<EventAddons>} payload - event data
26+
* @param {EventData<EventAddons>} payload - event data to make suggestion
2727
* @returns {Promise<string>} AI suggestion for the event
2828
* @todo add defence against invalid prompt injection
2929
*/
3030
public async generateSuggestion(payload: EventData<EventAddons>) {
3131
const { text } = await generateText({
32-
model: openai(this.modelId),
32+
model: this.modelId,
3333
system: ctoInstruction,
3434
prompt: eventSolvingInput(payload),
3535
});

0 commit comments

Comments
 (0)