Skip to content

Commit 56d5666

Browse files
committed
fixed the model
1 parent 84e2cd7 commit 56d5666

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

packages/adapter-sqlite/src/index.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,17 @@ export class SqliteDatabaseAdapter
8787
async getConversationMessages(conversationId: UUID): Promise<Memory[]> {
8888
const conversation = await this.getConversation(conversationId);
8989
if (!conversation) return [];
90-
90+
9191
const messageIds = JSON.parse(conversation.messageIds);
9292
const messages = await Promise.all(
9393
messageIds.map(id => this.getMemoryById(id))
9494
);
95-
95+
9696
return messages
9797
.filter((m): m is Memory => m !== null)
9898
.map(memory => {
9999
let timestamp: number;
100-
100+
101101
if (typeof memory.createdAt === 'number') {
102102
timestamp = memory.createdAt;
103103
} else if (typeof memory.createdAt === 'string') {
@@ -121,12 +121,12 @@ export class SqliteDatabaseAdapter
121121
if (!conversation) return "";
122122

123123
const messages = await this.getConversationMessages(conversationId);
124-
124+
125125
// Format each message showing only username
126126
const formattedMessages = await Promise.all(messages.map(async msg => {
127127
// First try to get username from message content
128128
let username = msg.content.username;
129-
129+
130130
// If no username in content, try to get it from accounts table
131131
if (!username) {
132132
const account = await this.getAccountById(msg.userId);
@@ -809,7 +809,7 @@ export class SqliteDatabaseAdapter
809809
try {
810810
let sql;
811811
let params;
812-
812+
813813
// Check if we're dealing with a username or userId
814814
if (userIdOrUsername.includes('-')) {
815815
// It's a UUID
@@ -820,7 +820,7 @@ export class SqliteDatabaseAdapter
820820
sql = "UPDATE accounts SET userRapport = userRapport + ? WHERE username = ?";
821821
params = [score, userIdOrUsername.replace('@', '')];
822822
}
823-
823+
824824
console.log("Setting rapport for", userIdOrUsername, "score:", score);
825825
this.db.prepare(sql).run(...params);
826826
} catch (error) {
@@ -868,9 +868,9 @@ export class SqliteDatabaseAdapter
868868
async getConversation(conversationId: UUID): Promise<Conversation | null> {
869869
const sql = "SELECT * FROM conversations WHERE id = ?";
870870
const conversation = this.db.prepare(sql).get(conversationId) as (Omit<Conversation, 'status'> & { status?: string }) | undefined;
871-
871+
872872
if (!conversation) return null;
873-
873+
874874
return {
875875
...conversation,
876876
startedAt: new Date(conversation.startedAt),
@@ -882,12 +882,12 @@ export class SqliteDatabaseAdapter
882882
async storeConversation(conversation: Conversation): Promise<void> {
883883
const sql = `
884884
INSERT INTO conversations (
885-
id, rootTweetId, messageIds, participantIds,
885+
id, rootTweetId, messageIds, participantIds,
886886
startedAt, lastMessageAt, context, agentId, status
887-
)
887+
)
888888
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
889889
`;
890-
890+
891891
this.db.prepare(sql).run(
892892
conversation.id,
893893
conversation.rootTweetId || '', // Ensure string
@@ -912,7 +912,7 @@ export class SqliteDatabaseAdapter
912912
const allNewIds = JSON.parse(conversation.messageIds);
913913
const lastNewId = allNewIds[allNewIds.length - 1]; // Get the last message ID
914914
console.log("added new message ", lastNewId);
915-
915+
916916
if (existingIds.includes(lastNewId)) {
917917
console.log("message already exists");
918918
return; // Exit early if message already exists
@@ -949,14 +949,14 @@ export class SqliteDatabaseAdapter
949949
async getConversationsByStatus(status: 'ACTIVE' | 'CLOSED', limit?: number): Promise<Conversation[]> {
950950
let sql = "SELECT * FROM conversations WHERE status = ?";
951951
const params: any[] = [status];
952-
952+
953953
if (typeof limit === 'number') {
954954
sql += " LIMIT ?";
955955
params.push(limit);
956956
}
957-
957+
958958
const conversations = this.db.prepare(sql).all(...params) as (Omit<Conversation, 'status'> & { status?: string })[];
959-
959+
960960
return conversations.map(conversation => ({
961961
...conversation,
962962
startedAt: new Date(conversation.startedAt),

packages/core/src/models.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,12 @@ export const models: Models = {
486486
"Meta-Llama-3-1-405B-Instruct-FP8",
487487
},
488488
},
489-
489+
490490
};
491491

492492
export function getModel(provider: ModelProviderName, type: ModelClass) {
493493
return models[provider].model[type];
494-
}
494+
}
495495

496496
export function getEndpoint(provider: ModelProviderName) {
497497
return models[provider].endpoint;

0 commit comments

Comments
 (0)