Skip to content

Commit

Permalink
add current date in spanish
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed Nov 16, 2024
1 parent 27945b4 commit 584efd2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions services/openAI.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const config = require('../config')
const { AzureOpenAI } = require('openai');
const moment = require("moment");

const { AzureOpenAI } = require('openai')
const moment = require('moment')
require('moment/locale/es')
moment.locale('es')

const getClient = () => {
const assistantsClient = new AzureOpenAI({
Expand Down Expand Up @@ -100,14 +101,16 @@ async function askAssistant(message, username) {
}
);


//const assistantResponse = await assistantsClient.beta.assistants.create(options);
const assistantResponse = await assistantsClient.beta.assistants.retrieve(config.openAI.assistantId)
// Run the thread and poll it until it is in a terminal state
moment.locale('es')
const runResponse = await assistantsClient.beta.threads.runs.create(
assistantThread.id,
{
assistant_id: assistantResponse.id,
additional_instructions: `Today's date: ${moment().tz('Europe/Madrid').format('MMMM Do YYYY, h:mm:ss a')}`
additional_instructions: `Fecha actual: ${moment().tz('Europe/Madrid').format('MMMM Do YYYY, h:mm:ss a')}`
}
);

Expand Down

0 comments on commit 584efd2

Please sign in to comment.