separation of concerns
This commit is contained in:
		
							
								
								
									
										20
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -26,7 +26,7 @@ export const prisma = new PrismaClient(); | ||||
| export const envConfig = { | ||||
|   pleromaInstanceUrl: process.env.PLEROMA_INSTANCE_URL || "", | ||||
|   pleromaInstanceDomain: process.env.PLEROMA_INSTANCE_DOMAIN || "", | ||||
|   whitelistOnly: process.env.ONLY_WHITELIST === "true" ? true : false || "true", | ||||
|   whitelistOnly: process.env.ONLY_WHITELIST === "true" ? true : false, | ||||
|   whitelistedDomains: process.env.WHITELISTED_DOMAINS | ||||
|     ? process.env.WHITELISTED_DOMAINS.split(",") | ||||
|     : [process.env.PLEROMA_INSTANCE_DOMAIN], | ||||
| @ -42,9 +42,14 @@ export const envConfig = { | ||||
| }; | ||||
|  | ||||
| const ollamaConfig: OllamaConfigOptions = { | ||||
|   temperature: 1.2, | ||||
|   temperature: 1.4, | ||||
|   top_k: 100, | ||||
|   top_p: 0.8, | ||||
| }; | ||||
|  | ||||
| // this could be helpful | ||||
| // https://replicate.com/blog/how-to-prompt-llama | ||||
|  | ||||
| const generateOllamaRequest = async ( | ||||
|   notification: Notification | ||||
| ): Promise<OllamaResponse | undefined> => { | ||||
| @ -68,9 +73,9 @@ const generateOllamaRequest = async ( | ||||
|       const ollamaRequestBody: OllamaRequest = { | ||||
|         model: ollamaModel, | ||||
|         system: ollamaSystemPrompt, | ||||
|         prompt: `@${notification.status.account.fqn} says: ${trimInputData( | ||||
|           notification.status.content | ||||
|         )}`, | ||||
|         prompt: `[INST] @${ | ||||
|           notification.status.account.fqn | ||||
|         } says: ${trimInputData(notification.status.content)} [/INST]`, | ||||
|         stream: false, | ||||
|         options: ollamaConfig, | ||||
|       }; | ||||
| @ -162,4 +167,9 @@ console.log( | ||||
| console.log( | ||||
|   `Accepting prompts from: ${envConfig.whitelistedDomains.join(", ")}` | ||||
| ); | ||||
| console.log( | ||||
|   `Using model: ${envConfig.ollamaModel}\nConfig: ${JSON.stringify( | ||||
|     ollamaConfig | ||||
|   )}` | ||||
| ); | ||||
| await beginFetchCycle(); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user