weave-typescript 0.52.0 → 0.53.0
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/dist/weaveapi/inference/v1/model.pb.d.ts +2 -0
- package/dist/weaveapi/inference/v1/model.pb.js +46 -2
- package/dist/weaveapi/inference/v1/model_route.pb.d.ts +2 -0
- package/dist/weaveapi/inference/v1/model_route.pb.js +45 -2
- package/dist/weavesql/weavedb/identity_sql.d.ts +14 -7
- package/dist/weavesql/weavedb/identity_sql.js +21 -14
- package/dist/weavesql/weavedb/inference_model_route_sql.d.ts +8 -2
- package/dist/weavesql/weavedb/inference_model_route_sql.js +99 -24
- package/dist/weavesql/weavedb/organization_sql.d.ts +4 -2
- package/dist/weavesql/weavedb/organization_sql.js +6 -4
- package/package.json +1 -1
|
@@ -134,6 +134,8 @@ export interface OrganizationChatSettings {
|
|
|
134
134
|
organizationId: string;
|
|
135
135
|
defaultChatModelId: string;
|
|
136
136
|
defaultProviderConfigurationId: string;
|
|
137
|
+
defaultFastModelId: string;
|
|
138
|
+
defaultFastProviderConfigurationId: string;
|
|
137
139
|
}
|
|
138
140
|
export declare const Model: MessageFns<Model>;
|
|
139
141
|
export declare const InferenceModel: MessageFns<InferenceModel>;
|
|
@@ -1743,7 +1743,13 @@ exports.OrganizationIngestionSettings = {
|
|
|
1743
1743
|
},
|
|
1744
1744
|
};
|
|
1745
1745
|
function createBaseOrganizationChatSettings() {
|
|
1746
|
-
return {
|
|
1746
|
+
return {
|
|
1747
|
+
organizationId: "",
|
|
1748
|
+
defaultChatModelId: "",
|
|
1749
|
+
defaultProviderConfigurationId: "",
|
|
1750
|
+
defaultFastModelId: "",
|
|
1751
|
+
defaultFastProviderConfigurationId: "",
|
|
1752
|
+
};
|
|
1747
1753
|
}
|
|
1748
1754
|
exports.OrganizationChatSettings = {
|
|
1749
1755
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -1756,6 +1762,12 @@ exports.OrganizationChatSettings = {
|
|
|
1756
1762
|
if (message.defaultProviderConfigurationId !== "") {
|
|
1757
1763
|
writer.uint32(26).string(message.defaultProviderConfigurationId);
|
|
1758
1764
|
}
|
|
1765
|
+
if (message.defaultFastModelId !== "") {
|
|
1766
|
+
writer.uint32(34).string(message.defaultFastModelId);
|
|
1767
|
+
}
|
|
1768
|
+
if (message.defaultFastProviderConfigurationId !== "") {
|
|
1769
|
+
writer.uint32(42).string(message.defaultFastProviderConfigurationId);
|
|
1770
|
+
}
|
|
1759
1771
|
return writer;
|
|
1760
1772
|
},
|
|
1761
1773
|
decode(input, length) {
|
|
@@ -1786,6 +1798,20 @@ exports.OrganizationChatSettings = {
|
|
|
1786
1798
|
message.defaultProviderConfigurationId = reader.string();
|
|
1787
1799
|
continue;
|
|
1788
1800
|
}
|
|
1801
|
+
case 4: {
|
|
1802
|
+
if (tag !== 34) {
|
|
1803
|
+
break;
|
|
1804
|
+
}
|
|
1805
|
+
message.defaultFastModelId = reader.string();
|
|
1806
|
+
continue;
|
|
1807
|
+
}
|
|
1808
|
+
case 5: {
|
|
1809
|
+
if (tag !== 42) {
|
|
1810
|
+
break;
|
|
1811
|
+
}
|
|
1812
|
+
message.defaultFastProviderConfigurationId = reader.string();
|
|
1813
|
+
continue;
|
|
1814
|
+
}
|
|
1789
1815
|
}
|
|
1790
1816
|
if ((tag & 7) === 4 || tag === 0) {
|
|
1791
1817
|
break;
|
|
@@ -1811,6 +1837,16 @@ exports.OrganizationChatSettings = {
|
|
|
1811
1837
|
: isSet(object.default_provider_configuration_id)
|
|
1812
1838
|
? globalThis.String(object.default_provider_configuration_id)
|
|
1813
1839
|
: "",
|
|
1840
|
+
defaultFastModelId: isSet(object.defaultFastModelId)
|
|
1841
|
+
? globalThis.String(object.defaultFastModelId)
|
|
1842
|
+
: isSet(object.default_fast_model_id)
|
|
1843
|
+
? globalThis.String(object.default_fast_model_id)
|
|
1844
|
+
: "",
|
|
1845
|
+
defaultFastProviderConfigurationId: isSet(object.defaultFastProviderConfigurationId)
|
|
1846
|
+
? globalThis.String(object.defaultFastProviderConfigurationId)
|
|
1847
|
+
: isSet(object.default_fast_provider_configuration_id)
|
|
1848
|
+
? globalThis.String(object.default_fast_provider_configuration_id)
|
|
1849
|
+
: "",
|
|
1814
1850
|
};
|
|
1815
1851
|
},
|
|
1816
1852
|
toJSON(message) {
|
|
@@ -1824,17 +1860,25 @@ exports.OrganizationChatSettings = {
|
|
|
1824
1860
|
if (message.defaultProviderConfigurationId !== "") {
|
|
1825
1861
|
obj.defaultProviderConfigurationId = message.defaultProviderConfigurationId;
|
|
1826
1862
|
}
|
|
1863
|
+
if (message.defaultFastModelId !== "") {
|
|
1864
|
+
obj.defaultFastModelId = message.defaultFastModelId;
|
|
1865
|
+
}
|
|
1866
|
+
if (message.defaultFastProviderConfigurationId !== "") {
|
|
1867
|
+
obj.defaultFastProviderConfigurationId = message.defaultFastProviderConfigurationId;
|
|
1868
|
+
}
|
|
1827
1869
|
return obj;
|
|
1828
1870
|
},
|
|
1829
1871
|
create(base) {
|
|
1830
1872
|
return exports.OrganizationChatSettings.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1831
1873
|
},
|
|
1832
1874
|
fromPartial(object) {
|
|
1833
|
-
var _a, _b, _c;
|
|
1875
|
+
var _a, _b, _c, _d, _e;
|
|
1834
1876
|
const message = createBaseOrganizationChatSettings();
|
|
1835
1877
|
message.organizationId = (_a = object.organizationId) !== null && _a !== void 0 ? _a : "";
|
|
1836
1878
|
message.defaultChatModelId = (_b = object.defaultChatModelId) !== null && _b !== void 0 ? _b : "";
|
|
1837
1879
|
message.defaultProviderConfigurationId = (_c = object.defaultProviderConfigurationId) !== null && _c !== void 0 ? _c : "";
|
|
1880
|
+
message.defaultFastModelId = (_d = object.defaultFastModelId) !== null && _d !== void 0 ? _d : "";
|
|
1881
|
+
message.defaultFastProviderConfigurationId = (_e = object.defaultFastProviderConfigurationId) !== null && _e !== void 0 ? _e : "";
|
|
1838
1882
|
return message;
|
|
1839
1883
|
},
|
|
1840
1884
|
};
|
|
@@ -105,6 +105,8 @@ export interface GetChatDefaultsResponse {
|
|
|
105
105
|
export interface SetChatDefaultsRequest {
|
|
106
106
|
defaultChatModelId: string;
|
|
107
107
|
defaultProviderConfigurationId: string;
|
|
108
|
+
defaultFastModelId: string;
|
|
109
|
+
defaultFastProviderConfigurationId: string;
|
|
108
110
|
}
|
|
109
111
|
export interface SetChatDefaultsResponse {
|
|
110
112
|
settings: OrganizationChatSettings | undefined;
|
|
@@ -1941,7 +1941,12 @@ exports.GetChatDefaultsResponse = {
|
|
|
1941
1941
|
},
|
|
1942
1942
|
};
|
|
1943
1943
|
function createBaseSetChatDefaultsRequest() {
|
|
1944
|
-
return {
|
|
1944
|
+
return {
|
|
1945
|
+
defaultChatModelId: "",
|
|
1946
|
+
defaultProviderConfigurationId: "",
|
|
1947
|
+
defaultFastModelId: "",
|
|
1948
|
+
defaultFastProviderConfigurationId: "",
|
|
1949
|
+
};
|
|
1945
1950
|
}
|
|
1946
1951
|
exports.SetChatDefaultsRequest = {
|
|
1947
1952
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -1951,6 +1956,12 @@ exports.SetChatDefaultsRequest = {
|
|
|
1951
1956
|
if (message.defaultProviderConfigurationId !== "") {
|
|
1952
1957
|
writer.uint32(18).string(message.defaultProviderConfigurationId);
|
|
1953
1958
|
}
|
|
1959
|
+
if (message.defaultFastModelId !== "") {
|
|
1960
|
+
writer.uint32(26).string(message.defaultFastModelId);
|
|
1961
|
+
}
|
|
1962
|
+
if (message.defaultFastProviderConfigurationId !== "") {
|
|
1963
|
+
writer.uint32(34).string(message.defaultFastProviderConfigurationId);
|
|
1964
|
+
}
|
|
1954
1965
|
return writer;
|
|
1955
1966
|
},
|
|
1956
1967
|
decode(input, length) {
|
|
@@ -1974,6 +1985,20 @@ exports.SetChatDefaultsRequest = {
|
|
|
1974
1985
|
message.defaultProviderConfigurationId = reader.string();
|
|
1975
1986
|
continue;
|
|
1976
1987
|
}
|
|
1988
|
+
case 3: {
|
|
1989
|
+
if (tag !== 26) {
|
|
1990
|
+
break;
|
|
1991
|
+
}
|
|
1992
|
+
message.defaultFastModelId = reader.string();
|
|
1993
|
+
continue;
|
|
1994
|
+
}
|
|
1995
|
+
case 4: {
|
|
1996
|
+
if (tag !== 34) {
|
|
1997
|
+
break;
|
|
1998
|
+
}
|
|
1999
|
+
message.defaultFastProviderConfigurationId = reader.string();
|
|
2000
|
+
continue;
|
|
2001
|
+
}
|
|
1977
2002
|
}
|
|
1978
2003
|
if ((tag & 7) === 4 || tag === 0) {
|
|
1979
2004
|
break;
|
|
@@ -1994,6 +2019,16 @@ exports.SetChatDefaultsRequest = {
|
|
|
1994
2019
|
: isSet(object.default_provider_configuration_id)
|
|
1995
2020
|
? globalThis.String(object.default_provider_configuration_id)
|
|
1996
2021
|
: "",
|
|
2022
|
+
defaultFastModelId: isSet(object.defaultFastModelId)
|
|
2023
|
+
? globalThis.String(object.defaultFastModelId)
|
|
2024
|
+
: isSet(object.default_fast_model_id)
|
|
2025
|
+
? globalThis.String(object.default_fast_model_id)
|
|
2026
|
+
: "",
|
|
2027
|
+
defaultFastProviderConfigurationId: isSet(object.defaultFastProviderConfigurationId)
|
|
2028
|
+
? globalThis.String(object.defaultFastProviderConfigurationId)
|
|
2029
|
+
: isSet(object.default_fast_provider_configuration_id)
|
|
2030
|
+
? globalThis.String(object.default_fast_provider_configuration_id)
|
|
2031
|
+
: "",
|
|
1997
2032
|
};
|
|
1998
2033
|
},
|
|
1999
2034
|
toJSON(message) {
|
|
@@ -2004,16 +2039,24 @@ exports.SetChatDefaultsRequest = {
|
|
|
2004
2039
|
if (message.defaultProviderConfigurationId !== "") {
|
|
2005
2040
|
obj.defaultProviderConfigurationId = message.defaultProviderConfigurationId;
|
|
2006
2041
|
}
|
|
2042
|
+
if (message.defaultFastModelId !== "") {
|
|
2043
|
+
obj.defaultFastModelId = message.defaultFastModelId;
|
|
2044
|
+
}
|
|
2045
|
+
if (message.defaultFastProviderConfigurationId !== "") {
|
|
2046
|
+
obj.defaultFastProviderConfigurationId = message.defaultFastProviderConfigurationId;
|
|
2047
|
+
}
|
|
2007
2048
|
return obj;
|
|
2008
2049
|
},
|
|
2009
2050
|
create(base) {
|
|
2010
2051
|
return exports.SetChatDefaultsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
2011
2052
|
},
|
|
2012
2053
|
fromPartial(object) {
|
|
2013
|
-
var _a, _b;
|
|
2054
|
+
var _a, _b, _c, _d;
|
|
2014
2055
|
const message = createBaseSetChatDefaultsRequest();
|
|
2015
2056
|
message.defaultChatModelId = (_a = object.defaultChatModelId) !== null && _a !== void 0 ? _a : "";
|
|
2016
2057
|
message.defaultProviderConfigurationId = (_b = object.defaultProviderConfigurationId) !== null && _b !== void 0 ? _b : "";
|
|
2058
|
+
message.defaultFastModelId = (_c = object.defaultFastModelId) !== null && _c !== void 0 ? _c : "";
|
|
2059
|
+
message.defaultFastProviderConfigurationId = (_d = object.defaultFastProviderConfigurationId) !== null && _d !== void 0 ? _d : "";
|
|
2017
2060
|
return message;
|
|
2018
2061
|
},
|
|
2019
2062
|
};
|
|
@@ -2,7 +2,7 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
|
2
2
|
interface Client {
|
|
3
3
|
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
4
|
}
|
|
5
|
-
export declare const createOrganizationQuery = "-- name: CreateOrganization :one\nINSERT INTO weave.organization (\n slug,\n name,\n description,\n primary_color,\n logo,\n logo_content_type,\n timezone,\n location,\n status\n) VALUES (\n $1,\n $2,\n COALESCE($3::text, ''),\n COALESCE($4::text, '#22d3ee'),\n $5,\n $6,\n COALESCE($7::text, 'UTC'),\n COALESCE($8::text, ''),\n COALESCE($9::text, 'active')\n)\nRETURNING id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at";
|
|
5
|
+
export declare const createOrganizationQuery = "-- name: CreateOrganization :one\nINSERT INTO weave.organization (\n slug,\n name,\n description,\n primary_color,\n logo,\n logo_content_type,\n timezone,\n location,\n status\n) VALUES (\n $1,\n $2,\n COALESCE($3::text, ''),\n COALESCE($4::text, '#22d3ee'),\n $5,\n $6,\n COALESCE($7::text, 'UTC'),\n COALESCE($8::text, ''),\n COALESCE($9::text, 'active')\n)\nRETURNING id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id";
|
|
6
6
|
export interface CreateOrganizationArgs {
|
|
7
7
|
slug: string;
|
|
8
8
|
name: string;
|
|
@@ -29,9 +29,10 @@ export interface CreateOrganizationRow {
|
|
|
29
29
|
defaultChatModelRouteId: string | null;
|
|
30
30
|
createdAt: Date;
|
|
31
31
|
updatedAt: Date;
|
|
32
|
+
defaultFastModelRouteId: string | null;
|
|
32
33
|
}
|
|
33
34
|
export declare function createOrganization(client: Client, args: CreateOrganizationArgs): Promise<CreateOrganizationRow | null>;
|
|
34
|
-
export declare const getOrganizationQuery = "-- name: GetOrganization :one\nSELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at\nFROM weave.organization\nWHERE id = $1";
|
|
35
|
+
export declare const getOrganizationQuery = "-- name: GetOrganization :one\nSELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id\nFROM weave.organization\nWHERE id = $1";
|
|
35
36
|
export interface GetOrganizationArgs {
|
|
36
37
|
organizationId: string;
|
|
37
38
|
}
|
|
@@ -50,9 +51,10 @@ export interface GetOrganizationRow {
|
|
|
50
51
|
defaultChatModelRouteId: string | null;
|
|
51
52
|
createdAt: Date;
|
|
52
53
|
updatedAt: Date;
|
|
54
|
+
defaultFastModelRouteId: string | null;
|
|
53
55
|
}
|
|
54
56
|
export declare function getOrganization(client: Client, args: GetOrganizationArgs): Promise<GetOrganizationRow | null>;
|
|
55
|
-
export declare const getOrganizationBySlugQuery = "-- name: GetOrganizationBySlug :one\nSELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at\nFROM weave.organization\nWHERE slug = $1";
|
|
57
|
+
export declare const getOrganizationBySlugQuery = "-- name: GetOrganizationBySlug :one\nSELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id\nFROM weave.organization\nWHERE slug = $1";
|
|
56
58
|
export interface GetOrganizationBySlugArgs {
|
|
57
59
|
slug: string;
|
|
58
60
|
}
|
|
@@ -71,9 +73,10 @@ export interface GetOrganizationBySlugRow {
|
|
|
71
73
|
defaultChatModelRouteId: string | null;
|
|
72
74
|
createdAt: Date;
|
|
73
75
|
updatedAt: Date;
|
|
76
|
+
defaultFastModelRouteId: string | null;
|
|
74
77
|
}
|
|
75
78
|
export declare function getOrganizationBySlug(client: Client, args: GetOrganizationBySlugArgs): Promise<GetOrganizationBySlugRow | null>;
|
|
76
|
-
export declare const listOrganizationsQuery = "-- name: ListOrganizations :many\nSELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at\nFROM weave.organization\nWHERE status = 'active'\nORDER BY created_at DESC, id DESC";
|
|
79
|
+
export declare const listOrganizationsQuery = "-- name: ListOrganizations :many\nSELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id\nFROM weave.organization\nWHERE status = 'active'\nORDER BY created_at DESC, id DESC";
|
|
77
80
|
export interface ListOrganizationsRow {
|
|
78
81
|
id: string;
|
|
79
82
|
slug: string;
|
|
@@ -89,9 +92,10 @@ export interface ListOrganizationsRow {
|
|
|
89
92
|
defaultChatModelRouteId: string | null;
|
|
90
93
|
createdAt: Date;
|
|
91
94
|
updatedAt: Date;
|
|
95
|
+
defaultFastModelRouteId: string | null;
|
|
92
96
|
}
|
|
93
97
|
export declare function listOrganizations(client: Client): Promise<ListOrganizationsRow[]>;
|
|
94
|
-
export declare const listOrganizationsForUserQuery = "-- name: ListOrganizationsForUser :many\nSELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at\nFROM weave.organization o\n JOIN weave.organization_membership om\n ON om.organization_id = o.id\nWHERE om.user_id = $1\n AND om.status = 'active'\n AND o.status = 'active'\nORDER BY o.created_at DESC, o.id DESC";
|
|
98
|
+
export declare const listOrganizationsForUserQuery = "-- name: ListOrganizationsForUser :many\nSELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at, o.default_fast_model_route_id\nFROM weave.organization o\n JOIN weave.organization_membership om\n ON om.organization_id = o.id\nWHERE om.user_id = $1\n AND om.status = 'active'\n AND o.status = 'active'\nORDER BY o.created_at DESC, o.id DESC";
|
|
95
99
|
export interface ListOrganizationsForUserArgs {
|
|
96
100
|
userId: string;
|
|
97
101
|
}
|
|
@@ -110,9 +114,10 @@ export interface ListOrganizationsForUserRow {
|
|
|
110
114
|
defaultChatModelRouteId: string | null;
|
|
111
115
|
createdAt: Date;
|
|
112
116
|
updatedAt: Date;
|
|
117
|
+
defaultFastModelRouteId: string | null;
|
|
113
118
|
}
|
|
114
119
|
export declare function listOrganizationsForUser(client: Client, args: ListOrganizationsForUserArgs): Promise<ListOrganizationsForUserRow[]>;
|
|
115
|
-
export declare const getOrganizationForUserBySlugQuery = "-- name: GetOrganizationForUserBySlug :one\nSELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at\nFROM weave.organization o\n JOIN weave.organization_membership om\n ON om.organization_id = o.id\nWHERE o.slug = $1\n AND om.user_id = $2\n AND om.status = 'active'\n AND o.status = 'active'";
|
|
120
|
+
export declare const getOrganizationForUserBySlugQuery = "-- name: GetOrganizationForUserBySlug :one\nSELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at, o.default_fast_model_route_id\nFROM weave.organization o\n JOIN weave.organization_membership om\n ON om.organization_id = o.id\nWHERE o.slug = $1\n AND om.user_id = $2\n AND om.status = 'active'\n AND o.status = 'active'";
|
|
116
121
|
export interface GetOrganizationForUserBySlugArgs {
|
|
117
122
|
slug: string;
|
|
118
123
|
userId: string;
|
|
@@ -132,9 +137,10 @@ export interface GetOrganizationForUserBySlugRow {
|
|
|
132
137
|
defaultChatModelRouteId: string | null;
|
|
133
138
|
createdAt: Date;
|
|
134
139
|
updatedAt: Date;
|
|
140
|
+
defaultFastModelRouteId: string | null;
|
|
135
141
|
}
|
|
136
142
|
export declare function getOrganizationForUserBySlug(client: Client, args: GetOrganizationForUserBySlugArgs): Promise<GetOrganizationForUserBySlugRow | null>;
|
|
137
|
-
export declare const getOrganizationByExternalIdentityQuery = "-- name: GetOrganizationByExternalIdentity :one\nSELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at\nFROM weave.organization o\n JOIN weave.organization_identity_link oil\n ON oil.organization_id = o.id\nWHERE oil.auth_provider = $1\n AND oil.external_organization_id = $2";
|
|
143
|
+
export declare const getOrganizationByExternalIdentityQuery = "-- name: GetOrganizationByExternalIdentity :one\nSELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at, o.default_fast_model_route_id\nFROM weave.organization o\n JOIN weave.organization_identity_link oil\n ON oil.organization_id = o.id\nWHERE oil.auth_provider = $1\n AND oil.external_organization_id = $2";
|
|
138
144
|
export interface GetOrganizationByExternalIdentityArgs {
|
|
139
145
|
authProvider: string;
|
|
140
146
|
externalOrganizationId: string;
|
|
@@ -154,6 +160,7 @@ export interface GetOrganizationByExternalIdentityRow {
|
|
|
154
160
|
defaultChatModelRouteId: string | null;
|
|
155
161
|
createdAt: Date;
|
|
156
162
|
updatedAt: Date;
|
|
163
|
+
defaultFastModelRouteId: string | null;
|
|
157
164
|
}
|
|
158
165
|
export declare function getOrganizationByExternalIdentity(client: Client, args: GetOrganizationByExternalIdentityArgs): Promise<GetOrganizationByExternalIdentityRow | null>;
|
|
159
166
|
export declare const upsertOrganizationIdentityLinkQuery = "-- name: UpsertOrganizationIdentityLink :one\nINSERT INTO weave.organization_identity_link (\n organization_id,\n auth_provider,\n external_organization_id,\n last_seen_at\n) VALUES (\n $1,\n $2,\n $3,\n now()\n)\nON CONFLICT (auth_provider, external_organization_id)\n DO UPDATE SET\n last_seen_at = EXCLUDED.last_seen_at\nRETURNING id, organization_id, auth_provider, external_organization_id, last_seen_at, created_at, updated_at";
|
|
@@ -72,7 +72,7 @@ INSERT INTO weave.organization (
|
|
|
72
72
|
COALESCE($8::text, ''),
|
|
73
73
|
COALESCE($9::text, 'active')
|
|
74
74
|
)
|
|
75
|
-
RETURNING id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at`;
|
|
75
|
+
RETURNING id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id`;
|
|
76
76
|
async function createOrganization(client, args) {
|
|
77
77
|
const result = await client.query({
|
|
78
78
|
text: exports.createOrganizationQuery,
|
|
@@ -97,11 +97,12 @@ async function createOrganization(client, args) {
|
|
|
97
97
|
defaultChatAgentId: row[10],
|
|
98
98
|
defaultChatModelRouteId: row[11],
|
|
99
99
|
createdAt: row[12],
|
|
100
|
-
updatedAt: row[13]
|
|
100
|
+
updatedAt: row[13],
|
|
101
|
+
defaultFastModelRouteId: row[14]
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
exports.getOrganizationQuery = `-- name: GetOrganization :one
|
|
104
|
-
SELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at
|
|
105
|
+
SELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id
|
|
105
106
|
FROM weave.organization
|
|
106
107
|
WHERE id = $1`;
|
|
107
108
|
async function getOrganization(client, args) {
|
|
@@ -128,11 +129,12 @@ async function getOrganization(client, args) {
|
|
|
128
129
|
defaultChatAgentId: row[10],
|
|
129
130
|
defaultChatModelRouteId: row[11],
|
|
130
131
|
createdAt: row[12],
|
|
131
|
-
updatedAt: row[13]
|
|
132
|
+
updatedAt: row[13],
|
|
133
|
+
defaultFastModelRouteId: row[14]
|
|
132
134
|
};
|
|
133
135
|
}
|
|
134
136
|
exports.getOrganizationBySlugQuery = `-- name: GetOrganizationBySlug :one
|
|
135
|
-
SELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at
|
|
137
|
+
SELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id
|
|
136
138
|
FROM weave.organization
|
|
137
139
|
WHERE slug = $1`;
|
|
138
140
|
async function getOrganizationBySlug(client, args) {
|
|
@@ -159,11 +161,12 @@ async function getOrganizationBySlug(client, args) {
|
|
|
159
161
|
defaultChatAgentId: row[10],
|
|
160
162
|
defaultChatModelRouteId: row[11],
|
|
161
163
|
createdAt: row[12],
|
|
162
|
-
updatedAt: row[13]
|
|
164
|
+
updatedAt: row[13],
|
|
165
|
+
defaultFastModelRouteId: row[14]
|
|
163
166
|
};
|
|
164
167
|
}
|
|
165
168
|
exports.listOrganizationsQuery = `-- name: ListOrganizations :many
|
|
166
|
-
SELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at
|
|
169
|
+
SELECT id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id
|
|
167
170
|
FROM weave.organization
|
|
168
171
|
WHERE status = 'active'
|
|
169
172
|
ORDER BY created_at DESC, id DESC`;
|
|
@@ -188,12 +191,13 @@ async function listOrganizations(client) {
|
|
|
188
191
|
defaultChatAgentId: row[10],
|
|
189
192
|
defaultChatModelRouteId: row[11],
|
|
190
193
|
createdAt: row[12],
|
|
191
|
-
updatedAt: row[13]
|
|
194
|
+
updatedAt: row[13],
|
|
195
|
+
defaultFastModelRouteId: row[14]
|
|
192
196
|
};
|
|
193
197
|
});
|
|
194
198
|
}
|
|
195
199
|
exports.listOrganizationsForUserQuery = `-- name: ListOrganizationsForUser :many
|
|
196
|
-
SELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at
|
|
200
|
+
SELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at, o.default_fast_model_route_id
|
|
197
201
|
FROM weave.organization o
|
|
198
202
|
JOIN weave.organization_membership om
|
|
199
203
|
ON om.organization_id = o.id
|
|
@@ -222,12 +226,13 @@ async function listOrganizationsForUser(client, args) {
|
|
|
222
226
|
defaultChatAgentId: row[10],
|
|
223
227
|
defaultChatModelRouteId: row[11],
|
|
224
228
|
createdAt: row[12],
|
|
225
|
-
updatedAt: row[13]
|
|
229
|
+
updatedAt: row[13],
|
|
230
|
+
defaultFastModelRouteId: row[14]
|
|
226
231
|
};
|
|
227
232
|
});
|
|
228
233
|
}
|
|
229
234
|
exports.getOrganizationForUserBySlugQuery = `-- name: GetOrganizationForUserBySlug :one
|
|
230
|
-
SELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at
|
|
235
|
+
SELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at, o.default_fast_model_route_id
|
|
231
236
|
FROM weave.organization o
|
|
232
237
|
JOIN weave.organization_membership om
|
|
233
238
|
ON om.organization_id = o.id
|
|
@@ -259,11 +264,12 @@ async function getOrganizationForUserBySlug(client, args) {
|
|
|
259
264
|
defaultChatAgentId: row[10],
|
|
260
265
|
defaultChatModelRouteId: row[11],
|
|
261
266
|
createdAt: row[12],
|
|
262
|
-
updatedAt: row[13]
|
|
267
|
+
updatedAt: row[13],
|
|
268
|
+
defaultFastModelRouteId: row[14]
|
|
263
269
|
};
|
|
264
270
|
}
|
|
265
271
|
exports.getOrganizationByExternalIdentityQuery = `-- name: GetOrganizationByExternalIdentity :one
|
|
266
|
-
SELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at
|
|
272
|
+
SELECT o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at, o.default_fast_model_route_id
|
|
267
273
|
FROM weave.organization o
|
|
268
274
|
JOIN weave.organization_identity_link oil
|
|
269
275
|
ON oil.organization_id = o.id
|
|
@@ -293,7 +299,8 @@ async function getOrganizationByExternalIdentity(client, args) {
|
|
|
293
299
|
defaultChatAgentId: row[10],
|
|
294
300
|
defaultChatModelRouteId: row[11],
|
|
295
301
|
createdAt: row[12],
|
|
296
|
-
updatedAt: row[13]
|
|
302
|
+
updatedAt: row[13],
|
|
303
|
+
defaultFastModelRouteId: row[14]
|
|
297
304
|
};
|
|
298
305
|
}
|
|
299
306
|
exports.upsertOrganizationIdentityLinkQuery = `-- name: UpsertOrganizationIdentityLink :one
|
|
@@ -112,7 +112,7 @@ export interface ListInferenceModelRoutesRow {
|
|
|
112
112
|
updatedAt: Date;
|
|
113
113
|
}
|
|
114
114
|
export declare function listInferenceModelRoutes(client: Client, args: ListInferenceModelRoutesArgs): Promise<ListInferenceModelRoutesRow[]>;
|
|
115
|
-
export declare const getOrganizationChatSettingsQuery = "-- name: GetOrganizationChatSettings :one\nSELECT\n o.id AS organization_id,\n
|
|
115
|
+
export declare const getOrganizationChatSettingsQuery = "-- name: GetOrganizationChatSettings :one\nSELECT\n o.id AS organization_id,\n chat_im.model_id AS default_chat_model_id,\n chat_r.inference_provider_configuration_id AS default_provider_configuration_id,\n fast_im.model_id AS default_fast_model_id,\n fast_r.inference_provider_configuration_id AS default_fast_provider_configuration_id\nFROM weave.organization o\n LEFT JOIN weave.inference_model_route chat_r\n ON chat_r.organization_id = o.id\n AND chat_r.id = o.default_chat_model_route_id\n LEFT JOIN weave.inference_model chat_im\n ON chat_im.organization_id = chat_r.organization_id\n AND chat_im.id = chat_r.inference_model_id\n LEFT JOIN weave.inference_model_route fast_r\n ON fast_r.organization_id = o.id\n AND fast_r.id = o.default_fast_model_route_id\n LEFT JOIN weave.inference_model fast_im\n ON fast_im.organization_id = fast_r.organization_id\n AND fast_im.id = fast_r.inference_model_id\nWHERE o.id = $1";
|
|
116
116
|
export interface GetOrganizationChatSettingsArgs {
|
|
117
117
|
organizationId: string;
|
|
118
118
|
}
|
|
@@ -120,18 +120,24 @@ export interface GetOrganizationChatSettingsRow {
|
|
|
120
120
|
organizationId: string;
|
|
121
121
|
defaultChatModelId: string | null;
|
|
122
122
|
defaultProviderConfigurationId: string | null;
|
|
123
|
+
defaultFastModelId: string | null;
|
|
124
|
+
defaultFastProviderConfigurationId: string | null;
|
|
123
125
|
}
|
|
124
126
|
export declare function getOrganizationChatSettings(client: Client, args: GetOrganizationChatSettingsArgs): Promise<GetOrganizationChatSettingsRow | null>;
|
|
125
|
-
export declare const setOrganizationChatSettingsQuery = "-- name: SetOrganizationChatSettings :one\nWITH
|
|
127
|
+
export declare const setOrganizationChatSettingsQuery = "-- name: SetOrganizationChatSettings :one\nWITH requested_defaults AS (\n SELECT\n $1::uuid AS organization_id,\n $2::text AS default_chat_model_id,\n $3::uuid AS default_provider_configuration_id,\n $4::text AS default_fast_model_id,\n $5::uuid AS default_fast_provider_configuration_id\n),\nselected_chat_route AS (\n SELECT\n r.id,\n requested_defaults.organization_id,\n requested_defaults.default_chat_model_id,\n requested_defaults.default_provider_configuration_id,\n requested_defaults.default_fast_model_id,\n requested_defaults.default_fast_provider_configuration_id\n FROM requested_defaults\n JOIN weave.inference_model_route r\n ON r.organization_id = requested_defaults.organization_id\n JOIN weave.inference_model im\n ON im.organization_id = r.organization_id\n AND im.id = r.inference_model_id\n WHERE im.model_id = requested_defaults.default_chat_model_id\n AND r.inference_provider_configuration_id =\n requested_defaults.default_provider_configuration_id\n),\nselected_fast_route AS (\n SELECT r.id\n FROM requested_defaults\n JOIN weave.inference_model_route r\n ON r.organization_id = requested_defaults.organization_id\n JOIN weave.inference_model im\n ON im.organization_id = r.organization_id\n AND im.id = r.inference_model_id\n WHERE requested_defaults.default_fast_model_id IS NOT NULL\n AND requested_defaults.default_fast_provider_configuration_id IS NOT NULL\n AND im.model_id = requested_defaults.default_fast_model_id\n AND r.inference_provider_configuration_id =\n requested_defaults.default_fast_provider_configuration_id\n),\nupdated_organization AS (\n UPDATE weave.organization o\n SET default_chat_model_route_id = selected_chat_route.id,\n default_fast_model_route_id = COALESCE(\n selected_fast_route.id,\n o.default_fast_model_route_id\n )\n FROM selected_chat_route\n LEFT JOIN selected_fast_route ON TRUE\n WHERE o.id = selected_chat_route.organization_id\n AND (\n (\n selected_chat_route.default_fast_model_id IS NULL\n AND selected_chat_route.default_fast_provider_configuration_id IS NULL\n )\n OR selected_fast_route.id IS NOT NULL\n )\n RETURNING\n o.id AS organization_id,\n o.default_chat_model_route_id,\n o.default_fast_model_route_id\n)\nSELECT\n updated_organization.organization_id,\n chat_im.model_id AS default_chat_model_id,\n chat_r.inference_provider_configuration_id AS default_provider_configuration_id,\n fast_im.model_id AS default_fast_model_id,\n fast_r.inference_provider_configuration_id AS default_fast_provider_configuration_id\nFROM updated_organization\n JOIN weave.inference_model_route chat_r\n ON chat_r.organization_id = updated_organization.organization_id\n AND chat_r.id = updated_organization.default_chat_model_route_id\n JOIN weave.inference_model chat_im\n ON chat_im.organization_id = chat_r.organization_id\n AND chat_im.id = chat_r.inference_model_id\n LEFT JOIN weave.inference_model_route fast_r\n ON fast_r.organization_id = updated_organization.organization_id\n AND fast_r.id = updated_organization.default_fast_model_route_id\n LEFT JOIN weave.inference_model fast_im\n ON fast_im.organization_id = fast_r.organization_id\n AND fast_im.id = fast_r.inference_model_id";
|
|
126
128
|
export interface SetOrganizationChatSettingsArgs {
|
|
127
129
|
organizationId: string;
|
|
128
130
|
defaultChatModelId: string;
|
|
129
131
|
defaultProviderConfigurationId: string;
|
|
132
|
+
defaultFastModelId: string | null;
|
|
133
|
+
defaultFastProviderConfigurationId: string | null;
|
|
130
134
|
}
|
|
131
135
|
export interface SetOrganizationChatSettingsRow {
|
|
132
136
|
organizationId: string;
|
|
133
137
|
defaultChatModelId: string;
|
|
134
138
|
defaultProviderConfigurationId: string;
|
|
139
|
+
defaultFastModelId: string | null;
|
|
140
|
+
defaultFastProviderConfigurationId: string | null;
|
|
135
141
|
}
|
|
136
142
|
export declare function setOrganizationChatSettings(client: Client, args: SetOrganizationChatSettingsArgs): Promise<SetOrganizationChatSettingsRow | null>;
|
|
137
143
|
export declare const getModelRuntimeConfigurationQuery = "-- name: GetModelRuntimeConfiguration :one\nSELECT\n imr.id AS inference_model_route_id,\n imr.organization_id,\n im.id AS inference_model_id,\n im.model_id,\n imr.provider_model_id,\n imr.priority,\n p.id AS inference_provider_configuration_id,\n p.kind AS provider_kind,\n p.name AS provider_name,\n p.slug AS provider_slug,\n p.base_url AS provider_base_url,\n c.credential_kind,\n c.encrypted_credentials,\n c.credential_hint,\n c.key_id,\n c.last_rotated_at\nFROM weave.inference_model_route imr\n JOIN weave.inference_model im\n ON im.organization_id = imr.organization_id\n AND im.id = imr.inference_model_id\n JOIN weave.inference_provider_configuration p\n ON p.organization_id = imr.organization_id\n AND p.id = imr.inference_provider_configuration_id\n JOIN weave.inference_provider_credential c\n ON c.inference_provider_configuration_id = p.id\nWHERE imr.organization_id = $1\n AND im.model_id = $2\nORDER BY imr.priority ASC\nLIMIT 1";
|
|
@@ -285,15 +285,23 @@ async function listInferenceModelRoutes(client, args) {
|
|
|
285
285
|
exports.getOrganizationChatSettingsQuery = `-- name: GetOrganizationChatSettings :one
|
|
286
286
|
SELECT
|
|
287
287
|
o.id AS organization_id,
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
chat_im.model_id AS default_chat_model_id,
|
|
289
|
+
chat_r.inference_provider_configuration_id AS default_provider_configuration_id,
|
|
290
|
+
fast_im.model_id AS default_fast_model_id,
|
|
291
|
+
fast_r.inference_provider_configuration_id AS default_fast_provider_configuration_id
|
|
290
292
|
FROM weave.organization o
|
|
291
|
-
LEFT JOIN weave.inference_model_route
|
|
292
|
-
ON
|
|
293
|
-
AND
|
|
294
|
-
LEFT JOIN weave.inference_model
|
|
295
|
-
ON
|
|
296
|
-
AND
|
|
293
|
+
LEFT JOIN weave.inference_model_route chat_r
|
|
294
|
+
ON chat_r.organization_id = o.id
|
|
295
|
+
AND chat_r.id = o.default_chat_model_route_id
|
|
296
|
+
LEFT JOIN weave.inference_model chat_im
|
|
297
|
+
ON chat_im.organization_id = chat_r.organization_id
|
|
298
|
+
AND chat_im.id = chat_r.inference_model_id
|
|
299
|
+
LEFT JOIN weave.inference_model_route fast_r
|
|
300
|
+
ON fast_r.organization_id = o.id
|
|
301
|
+
AND fast_r.id = o.default_fast_model_route_id
|
|
302
|
+
LEFT JOIN weave.inference_model fast_im
|
|
303
|
+
ON fast_im.organization_id = fast_r.organization_id
|
|
304
|
+
AND fast_im.id = fast_r.inference_model_id
|
|
297
305
|
WHERE o.id = $1`;
|
|
298
306
|
async function getOrganizationChatSettings(client, args) {
|
|
299
307
|
const result = await client.query({
|
|
@@ -308,32 +316,97 @@ async function getOrganizationChatSettings(client, args) {
|
|
|
308
316
|
return {
|
|
309
317
|
organizationId: row[0],
|
|
310
318
|
defaultChatModelId: row[1],
|
|
311
|
-
defaultProviderConfigurationId: row[2]
|
|
319
|
+
defaultProviderConfigurationId: row[2],
|
|
320
|
+
defaultFastModelId: row[3],
|
|
321
|
+
defaultFastProviderConfigurationId: row[4]
|
|
312
322
|
};
|
|
313
323
|
}
|
|
314
324
|
exports.setOrganizationChatSettingsQuery = `-- name: SetOrganizationChatSettings :one
|
|
315
|
-
WITH
|
|
325
|
+
WITH requested_defaults AS (
|
|
326
|
+
SELECT
|
|
327
|
+
$1::uuid AS organization_id,
|
|
328
|
+
$2::text AS default_chat_model_id,
|
|
329
|
+
$3::uuid AS default_provider_configuration_id,
|
|
330
|
+
$4::text AS default_fast_model_id,
|
|
331
|
+
$5::uuid AS default_fast_provider_configuration_id
|
|
332
|
+
),
|
|
333
|
+
selected_chat_route AS (
|
|
334
|
+
SELECT
|
|
335
|
+
r.id,
|
|
336
|
+
requested_defaults.organization_id,
|
|
337
|
+
requested_defaults.default_chat_model_id,
|
|
338
|
+
requested_defaults.default_provider_configuration_id,
|
|
339
|
+
requested_defaults.default_fast_model_id,
|
|
340
|
+
requested_defaults.default_fast_provider_configuration_id
|
|
341
|
+
FROM requested_defaults
|
|
342
|
+
JOIN weave.inference_model_route r
|
|
343
|
+
ON r.organization_id = requested_defaults.organization_id
|
|
344
|
+
JOIN weave.inference_model im
|
|
345
|
+
ON im.organization_id = r.organization_id
|
|
346
|
+
AND im.id = r.inference_model_id
|
|
347
|
+
WHERE im.model_id = requested_defaults.default_chat_model_id
|
|
348
|
+
AND r.inference_provider_configuration_id =
|
|
349
|
+
requested_defaults.default_provider_configuration_id
|
|
350
|
+
),
|
|
351
|
+
selected_fast_route AS (
|
|
316
352
|
SELECT r.id
|
|
317
|
-
FROM
|
|
353
|
+
FROM requested_defaults
|
|
354
|
+
JOIN weave.inference_model_route r
|
|
355
|
+
ON r.organization_id = requested_defaults.organization_id
|
|
318
356
|
JOIN weave.inference_model im
|
|
319
357
|
ON im.organization_id = r.organization_id
|
|
320
358
|
AND im.id = r.inference_model_id
|
|
321
|
-
WHERE
|
|
322
|
-
AND
|
|
323
|
-
AND
|
|
359
|
+
WHERE requested_defaults.default_fast_model_id IS NOT NULL
|
|
360
|
+
AND requested_defaults.default_fast_provider_configuration_id IS NOT NULL
|
|
361
|
+
AND im.model_id = requested_defaults.default_fast_model_id
|
|
362
|
+
AND r.inference_provider_configuration_id =
|
|
363
|
+
requested_defaults.default_fast_provider_configuration_id
|
|
364
|
+
),
|
|
365
|
+
updated_organization AS (
|
|
366
|
+
UPDATE weave.organization o
|
|
367
|
+
SET default_chat_model_route_id = selected_chat_route.id,
|
|
368
|
+
default_fast_model_route_id = COALESCE(
|
|
369
|
+
selected_fast_route.id,
|
|
370
|
+
o.default_fast_model_route_id
|
|
371
|
+
)
|
|
372
|
+
FROM selected_chat_route
|
|
373
|
+
LEFT JOIN selected_fast_route ON TRUE
|
|
374
|
+
WHERE o.id = selected_chat_route.organization_id
|
|
375
|
+
AND (
|
|
376
|
+
(
|
|
377
|
+
selected_chat_route.default_fast_model_id IS NULL
|
|
378
|
+
AND selected_chat_route.default_fast_provider_configuration_id IS NULL
|
|
379
|
+
)
|
|
380
|
+
OR selected_fast_route.id IS NOT NULL
|
|
381
|
+
)
|
|
382
|
+
RETURNING
|
|
383
|
+
o.id AS organization_id,
|
|
384
|
+
o.default_chat_model_route_id,
|
|
385
|
+
o.default_fast_model_route_id
|
|
324
386
|
)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
387
|
+
SELECT
|
|
388
|
+
updated_organization.organization_id,
|
|
389
|
+
chat_im.model_id AS default_chat_model_id,
|
|
390
|
+
chat_r.inference_provider_configuration_id AS default_provider_configuration_id,
|
|
391
|
+
fast_im.model_id AS default_fast_model_id,
|
|
392
|
+
fast_r.inference_provider_configuration_id AS default_fast_provider_configuration_id
|
|
393
|
+
FROM updated_organization
|
|
394
|
+
JOIN weave.inference_model_route chat_r
|
|
395
|
+
ON chat_r.organization_id = updated_organization.organization_id
|
|
396
|
+
AND chat_r.id = updated_organization.default_chat_model_route_id
|
|
397
|
+
JOIN weave.inference_model chat_im
|
|
398
|
+
ON chat_im.organization_id = chat_r.organization_id
|
|
399
|
+
AND chat_im.id = chat_r.inference_model_id
|
|
400
|
+
LEFT JOIN weave.inference_model_route fast_r
|
|
401
|
+
ON fast_r.organization_id = updated_organization.organization_id
|
|
402
|
+
AND fast_r.id = updated_organization.default_fast_model_route_id
|
|
403
|
+
LEFT JOIN weave.inference_model fast_im
|
|
404
|
+
ON fast_im.organization_id = fast_r.organization_id
|
|
405
|
+
AND fast_im.id = fast_r.inference_model_id`;
|
|
333
406
|
async function setOrganizationChatSettings(client, args) {
|
|
334
407
|
const result = await client.query({
|
|
335
408
|
text: exports.setOrganizationChatSettingsQuery,
|
|
336
|
-
values: [args.organizationId, args.defaultChatModelId, args.defaultProviderConfigurationId],
|
|
409
|
+
values: [args.organizationId, args.defaultChatModelId, args.defaultProviderConfigurationId, args.defaultFastModelId, args.defaultFastProviderConfigurationId],
|
|
337
410
|
rowMode: "array"
|
|
338
411
|
});
|
|
339
412
|
if (result.rows.length !== 1) {
|
|
@@ -343,7 +416,9 @@ async function setOrganizationChatSettings(client, args) {
|
|
|
343
416
|
return {
|
|
344
417
|
organizationId: row[0],
|
|
345
418
|
defaultChatModelId: row[1],
|
|
346
|
-
defaultProviderConfigurationId: row[2]
|
|
419
|
+
defaultProviderConfigurationId: row[2],
|
|
420
|
+
defaultFastModelId: row[3],
|
|
421
|
+
defaultFastProviderConfigurationId: row[4]
|
|
347
422
|
};
|
|
348
423
|
}
|
|
349
424
|
exports.getModelRuntimeConfigurationQuery = `-- name: GetModelRuntimeConfiguration :one
|
|
@@ -2,7 +2,7 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
|
2
2
|
interface Client {
|
|
3
3
|
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
4
|
}
|
|
5
|
-
export declare const updateOrganizationDefaultChatAgentQuery = "-- name: UpdateOrganizationDefaultChatAgent :one\nWITH valid_agent AS (\n SELECT a.id\n FROM weave.agent a\n WHERE a.organization_id = $1\n AND a.id = $2\n)\nUPDATE weave.organization o\nSET default_chat_agent_id = valid_agent.id\nFROM valid_agent\nWHERE o.id = $1\nRETURNING o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at";
|
|
5
|
+
export declare const updateOrganizationDefaultChatAgentQuery = "-- name: UpdateOrganizationDefaultChatAgent :one\nWITH valid_agent AS (\n SELECT a.id\n FROM weave.agent a\n WHERE a.organization_id = $1\n AND a.id = $2\n)\nUPDATE weave.organization o\nSET default_chat_agent_id = valid_agent.id\nFROM valid_agent\nWHERE o.id = $1\nRETURNING o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at, o.default_fast_model_route_id";
|
|
6
6
|
export interface UpdateOrganizationDefaultChatAgentArgs {
|
|
7
7
|
organizationId: string;
|
|
8
8
|
agentId: string;
|
|
@@ -22,9 +22,10 @@ export interface UpdateOrganizationDefaultChatAgentRow {
|
|
|
22
22
|
defaultChatModelRouteId: string | null;
|
|
23
23
|
createdAt: Date;
|
|
24
24
|
updatedAt: Date;
|
|
25
|
+
defaultFastModelRouteId: string | null;
|
|
25
26
|
}
|
|
26
27
|
export declare function updateOrganizationDefaultChatAgent(client: Client, args: UpdateOrganizationDefaultChatAgentArgs): Promise<UpdateOrganizationDefaultChatAgentRow | null>;
|
|
27
|
-
export declare const updateOrganizationQuery = "-- name: UpdateOrganization :one\nUPDATE weave.organization\nSET\n slug = COALESCE($1::text, slug),\n name = COALESCE($2::text, name),\n description = COALESCE($3::text, description),\n primary_color = COALESCE($4::text, primary_color),\n timezone = COALESCE($5::text, timezone),\n location = COALESCE($6::text, location)\nWHERE id = $7\nRETURNING id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at";
|
|
28
|
+
export declare const updateOrganizationQuery = "-- name: UpdateOrganization :one\nUPDATE weave.organization\nSET\n slug = COALESCE($1::text, slug),\n name = COALESCE($2::text, name),\n description = COALESCE($3::text, description),\n primary_color = COALESCE($4::text, primary_color),\n timezone = COALESCE($5::text, timezone),\n location = COALESCE($6::text, location)\nWHERE id = $7\nRETURNING id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id";
|
|
28
29
|
export interface UpdateOrganizationArgs {
|
|
29
30
|
slug: string | null;
|
|
30
31
|
name: string | null;
|
|
@@ -49,6 +50,7 @@ export interface UpdateOrganizationRow {
|
|
|
49
50
|
defaultChatModelRouteId: string | null;
|
|
50
51
|
createdAt: Date;
|
|
51
52
|
updatedAt: Date;
|
|
53
|
+
defaultFastModelRouteId: string | null;
|
|
52
54
|
}
|
|
53
55
|
export declare function updateOrganization(client: Client, args: UpdateOrganizationArgs): Promise<UpdateOrganizationRow | null>;
|
|
54
56
|
export declare const deleteOrganizationQuery = "-- name: DeleteOrganization :execrows\nDELETE FROM weave.organization\nWHERE id = $1";
|
|
@@ -14,7 +14,7 @@ UPDATE weave.organization o
|
|
|
14
14
|
SET default_chat_agent_id = valid_agent.id
|
|
15
15
|
FROM valid_agent
|
|
16
16
|
WHERE o.id = $1
|
|
17
|
-
RETURNING o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at`;
|
|
17
|
+
RETURNING o.id, o.slug, o.name, o.description, o.primary_color, o.logo, o.logo_content_type, o.timezone, o.location, o.status, o.default_chat_agent_id, o.default_chat_model_route_id, o.created_at, o.updated_at, o.default_fast_model_route_id`;
|
|
18
18
|
async function updateOrganizationDefaultChatAgent(client, args) {
|
|
19
19
|
const result = await client.query({
|
|
20
20
|
text: exports.updateOrganizationDefaultChatAgentQuery,
|
|
@@ -39,7 +39,8 @@ async function updateOrganizationDefaultChatAgent(client, args) {
|
|
|
39
39
|
defaultChatAgentId: row[10],
|
|
40
40
|
defaultChatModelRouteId: row[11],
|
|
41
41
|
createdAt: row[12],
|
|
42
|
-
updatedAt: row[13]
|
|
42
|
+
updatedAt: row[13],
|
|
43
|
+
defaultFastModelRouteId: row[14]
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
exports.updateOrganizationQuery = `-- name: UpdateOrganization :one
|
|
@@ -52,7 +53,7 @@ SET
|
|
|
52
53
|
timezone = COALESCE($5::text, timezone),
|
|
53
54
|
location = COALESCE($6::text, location)
|
|
54
55
|
WHERE id = $7
|
|
55
|
-
RETURNING id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at`;
|
|
56
|
+
RETURNING id, slug, name, description, primary_color, logo, logo_content_type, timezone, location, status, default_chat_agent_id, default_chat_model_route_id, created_at, updated_at, default_fast_model_route_id`;
|
|
56
57
|
async function updateOrganization(client, args) {
|
|
57
58
|
const result = await client.query({
|
|
58
59
|
text: exports.updateOrganizationQuery,
|
|
@@ -77,7 +78,8 @@ async function updateOrganization(client, args) {
|
|
|
77
78
|
defaultChatAgentId: row[10],
|
|
78
79
|
defaultChatModelRouteId: row[11],
|
|
79
80
|
createdAt: row[12],
|
|
80
|
-
updatedAt: row[13]
|
|
81
|
+
updatedAt: row[13],
|
|
82
|
+
defaultFastModelRouteId: row[14]
|
|
81
83
|
};
|
|
82
84
|
}
|
|
83
85
|
exports.deleteOrganizationQuery = `-- name: DeleteOrganization :execrows
|