@myassis/gateway 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations/001_create_sessions_table.sql +38 -0
- package/migrations/002_alter_message_table.sql +3 -0
- package/migrations/003_add_tool_calls_data.sql +2 -0
- package/migrations/004_add_last_summary.sql +2 -0
- package/migrations/005_add_message_model_name.sql +1 -0
- package/migrations/006_add_unread_count.sql +1 -0
- package/migrations/008_add_agents_is_current.sql +12 -0
- package/migrations/009_add_is_current.sql +1 -0
- package/migrations/010_message_tool_call.sql +4 -0
- package/migrations/011_drop_message_toolcallsdata.sql +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- 创建 agents 表
|
|
2
|
+
CREATE TABLE IF NOT EXISTS agents (
|
|
3
|
+
id TEXT PRIMARY KEY,
|
|
4
|
+
user_id TEXT NOT NULL,
|
|
5
|
+
name TEXT NOT NULL,
|
|
6
|
+
description TEXT,
|
|
7
|
+
system_prompt TEXT,
|
|
8
|
+
avatar TEXT,
|
|
9
|
+
config TEXT,
|
|
10
|
+
created_at INTEGER NOT NULL,
|
|
11
|
+
updated_at INTEGER NOT NULL
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
-- 为 sessions 表添加 agent_id 外键
|
|
15
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
16
|
+
id TEXT PRIMARY KEY,
|
|
17
|
+
user_id TEXT NOT NULL,
|
|
18
|
+
agent_id TEXT,
|
|
19
|
+
title TEXT NOT NULL,
|
|
20
|
+
select_model_id TEXT,
|
|
21
|
+
voice_state TEXT,
|
|
22
|
+
created_at INTEGER NOT NULL,
|
|
23
|
+
updated_at INTEGER NOT NULL,
|
|
24
|
+
FOREIGN KEY (agent_id) REFERENCES agents(id) ON DELETE CASCADE
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
-- 创建 messages 表的 tool_calls 列
|
|
28
|
+
CREATE TABLE IF NOT EXISTS messages (
|
|
29
|
+
id TEXT PRIMARY KEY,
|
|
30
|
+
session_id TEXT NOT NULL,
|
|
31
|
+
role TEXT NOT NULL,
|
|
32
|
+
content TEXT,
|
|
33
|
+
attachments TEXT DEFAULT '[]',
|
|
34
|
+
tool_calls TEXT DEFAULT '[]',
|
|
35
|
+
created_at INTEGER NOT NULL,
|
|
36
|
+
updated_at INTEGER NOT NULL,
|
|
37
|
+
FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
|
|
38
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alter table messages add column model_name text default null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alter table sessions add column unread_count integer default 0 not null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Add is_current column to agents table
|
|
2
|
+
ALTER TABLE agents ADD COLUMN is_current INTEGER DEFAULT 0;
|
|
3
|
+
|
|
4
|
+
-- Set the first agent (by created_at) as current for each user
|
|
5
|
+
UPDATE agents
|
|
6
|
+
SET is_current = 1
|
|
7
|
+
WHERE id IN (
|
|
8
|
+
SELECT id FROM agents
|
|
9
|
+
GROUP BY user_id
|
|
10
|
+
ORDER BY created_at ASC
|
|
11
|
+
LIMIT 1
|
|
12
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alter table sessions add column is_current INTEGER DEFAULT 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alter table messages drop column tool_calls_data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myassis/gateway",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "我的助手 Gateway Service - 本地 AI 网关服务,支持认证、WebSocket 实时通信和任务调度",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"dist",
|
|
13
13
|
"scripts",
|
|
14
14
|
"README.md",
|
|
15
|
-
"LICENSE"
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"migrations"
|
|
16
17
|
],
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|