Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ export class DbTableAiPanelComponent implements OnInit, OnDestroy {
});
} else {
event.preventDefault();
this.createThread();
if (this.threadID) {
this.sendMessage();
} else {
this.createThread();
}
}
}
}
Expand Down Expand Up @@ -152,10 +156,10 @@ export class DbTableAiPanelComponent implements OnInit, OnDestroy {
const messageCopy = this.message;
this.message = '';
this.charactrsNumber = 0;
this._tables.requestAImessage(this.connectionID, this.tableName, this.threadID, messageCopy).subscribe((response) => {
this._tables.requestAImessage(this.connectionID, this.tableName, this.threadID, messageCopy).subscribe((response_message) => {
this.messagesChain.push({
type: 'ai',
text: this.markdownService.parse(response.response_message) as string
text: this.markdownService.parse(response_message) as string
});
this.submitting = false;

Expand Down
2 changes: 0 additions & 2 deletions frontend/src/app/services/connections.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ export class ConnectionsService {
const connections = res.connections.map(connectionItem => {
const connection = this.defineConnectionType(connectionItem.connection);
const displayTitle = this.defineConnectionTitle(connectionItem.connection);
console.log('displayTitle', displayTitle);
return {...connectionItem, connection, displayTitle};
});
this.ownConnections = connections.filter(connectionItem => !connectionItem.connection.isTestConnection);
Expand Down Expand Up @@ -330,7 +329,6 @@ export class ConnectionsService {
}

updateConnection(connection: Connection, masterKey: string) {
console.log('updateConnection');
let dbCredentials;
dbCredentials = {
...connection,
Expand Down
12 changes: 8 additions & 4 deletions frontend/src/app/services/tables.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ export class TablesService {
})
.pipe(
map((res) => {
const threadId = res.headers.get('x-openai-thread-id');
const threadId = res.headers.get('X-OpenAI-Thread-ID');
this.angulartics2.eventTrack.next({
action: 'AI: thread created'
});
Expand All @@ -495,14 +495,18 @@ export class TablesService {
}

requestAImessage(connectionID: string, tableName: string, threadId: string, message: string) {
return this._http.post<any>(`/ai/thread/message/${connectionID}/${threadId}`, {user_message: message}, {
console.log('threadId', threadId);
return this._http.post<any>(`/ai/v2/request/${connectionID}`, {user_message: message}, {
responseType: 'text' as 'json',
observe: 'response',
params: {
tableName
tableName,
threadId
}
})
.pipe(
map((res) => {
return res
return res.body as string;
}),
catchError((err) => {
console.log(err);
Expand Down