New post

Find

Article
· Nov 11, 2024 4m read

第十八章 TCP 客户端 服务器通信 - 使用OPEN命令 - Supported参数

第十八章 TCP 客户端 服务器通信 - 使用OPEN命令 - Supported参数

Supported 参数

parameters 参数可以是以下格式之一:

hostname
(hostname{:port{:mode{:terminators{:ibufsiz{:obufsiz{:queuesize{:keepalivetime}}}}}}})

parameters 参数中的参数如下:

Discussion (0)1
Log in or sign up to continue
Article
· Nov 11, 2024 4m read

IrisGoogleChat con IA

 

Hola comunidad,

Quería compartir con vosotros la última aplicación que he publicado en el Open Exchange: "IrisGoogleChat".

Es una utilidad para InterSystems IRIS que permite enviar mensajes a un canal de Google Chat mediante ObjectScript. Esta aplicación provee una colección de utilidades para configurar Canales de Google Chat, crear mensajes potenciados con "estados de humor" con IA y enviarlos a un canal de Google Chat.

Para proveer un estado de humor a tus mensajes será necesario que dispongas de un API Key y un ID de organización de OpenAI Chat GPT. También deberás contar con una cuenta de pago de Google Workspace para poder configurar los webhooks que utilizaremos para enviar los mensajes al canal.

La gracias de esta App es que puedes personalizar tus aburridos mensajes de alertas (o cualquier tipo de mensaje) con estados de humor personalizados, creando mensajes divertidos (o no).

Te dejo unos ejemplos que he creado simulando distintos estados de humo para el ejemplo he simulado un error <DIVIDE 0> :

Modo Drama:

 

Modo Poema:

Modo Pasivo Agresivo:

 

¿Te gustan estos mensajes y quieres deleitarte con unos increíbles mensajes como estos en lugar de lidiar con tus aburridos mensajes actuales? Pues abróchate el cinturón porque esto empieza!.

 

 

Configurando el API de OpenAI:

El primer paso será obtener tu Api Key y tu ID de organización, para ello entra en https://platform.openai.com/api-keys y presiona el botón "Create new Secret key", elige tu proyecto y dale un nombre, para finalizar pulsa el botón "Create Secret key".

 

Aparecerá en pantalla tu clave secreta, guardala bien porque no volverá a aparecer y la vamos a necesitar mas adelante.

Para obtener el ID de organización, presiona el icono del engranaje:

Luego pulsa en "General" y apunta tu ID de Organización:

 

Segundo paso, obtener la url de tu canal de Google:

Abre la página de Google Chat: https://mail.google.com/chat/u/0/#chat/home. Ahora presiona el botón "Nuevo Chat" y después en "Crear Espacio"

 

Dale un nombre y elige un icono y pulsa en "Crear".

 

Ahora entra en el canal recién creado y pulsa en "Apps e integraciones":

 

Una vez dentro de "Webhooks" presiona "Añadir webhooks". (Si el botón aparece desactivado es porque no has iniciado sesión con una cuenta de pago de Google Workspace:

 

 

Aparecerá una ventana, dale nu nombre y copia la url porque nos hará falta luego:

 

Genial, ahora, tenemos toda la información que necesitamos para empezar a configurar IrisGoogleChat. Para hacer este paso mas sencillo os he dejado en el repositorio una clase llamada GoogleChat.Example.cls donde podrás encontrar como:

 

Configurar tu API key e ID de Organización de ChatGPT:

 //Setup Google Chat (only needed first time)
Set url    ="https://api.openai.com/v1/chat/completions"
Set apiKey ="your api key"
Set orgId  ="your org id"
Do ##class(GoogleChat.Message).SetupGoogleChat(url, apiKey, orgId)

 

Crear un estado de ánimo:

// Mod lazy (only needed first time)
Set modName="passive-agresive"
Set modPrompt="Generate an error alert message, acting with an aggressive-passive behavior with a touch of sarcastic and blaming me for it. Add a touch of humor. You are only responsible to notify. Return only the text, without emojis or titles. This is the alert message: "
Do ##class(GoogleChat.Message).SaveMod(modName, modPrompt)

 

Configurar un Canal:

Set channelName="alertChannel"
Set url="/v1/spaces/AAAAJP9Vu54/messages?key=AIzZZcDdI0hCZtE6vySjMm-WEfRq3CPzqKqqYhg&token=RKjvKvRMnmdJbuyCoyGslos0Qce23Fd-P12lZtkU777"
Set icon = "https://fonts.gstatic.com/s/e/notoemoji/14.0/1f534/32.png"
Do ##class(GoogleChat.Message).CreateChannel(channelName,url,modName,icon)

 

Y finalmente, enviar un mensaje!:

Set channel="alertChannel"
Set title="Server XX - Alert!"
Set subtitle = "Warning Alert!!"
Set message = "The task 1001 has failed - Error Divide 0"
Do ##class(GoogleChat.Message).Send(channel, title, subtitle, message)

 

Lo que el metodo Send hace es enviar el mensaje al canal aplicando el estado de ánimo asociado al mismo. Para generar el mensaje con cierto estado de ánimo el método usa el prompt para ChatGPT que hemos configurado en nuestro estado de ánimo personalizado, ejemplo:

""Generate an error alert message, acting with an aggressive-passive behavior with a touch of sarcastic and blaming me for it. Add a touch of humor. You are only responsible to notify. Return only the text, without emojis or titles. This is the alert message: " 

Puedes añadir al final un.. In Spanish para recibir el idioma en español por ejemplo, o directamente traducirlo entero:

"Genera una alerta de error, actuando con un actitud pasiva-agrevisa con un toque de sarcasmo y culpándome por ello. Añade un toque de humor. Tu eres solo responsable de notificarme. Devuelve solo el texto, sin emojis o títulos. Este es el mensaje de alerta: "

 

Como puedes ver, puedes usar este prompt como una plantilla y modificarlo un poco o incluso crear el tuyo propio y obtener el mas serio, loco, divertido o aburrido mensaje!.

El límite está en tu imaginación!.

Estoy deseando ver los increíbles estados de ánimo y mensajes que vais a crear con esta utilidad. Por favor comparte en tus comentarios tus mejores prompts así como tus mejores mensajes!.

 

Gracias por leerme!.

Discussion (0)1
Log in or sign up to continue
Article
· Nov 11, 2024 4m read

IrisGoogleChat with AI

 

Hi Community,

I want to share with you the lastest app that I have uploaded to the Open Exchange "IrisGoogleChat". 

IrisGoogleChat is a utility for InterSystems IRIS that allows seamless message integration with Google Chat using Cache ObjectScript. This application provides a set of tools to configure Google Chat Channels, create messages powered by moods generated with AI and send them to a Google Chat Channel.

In order to provide the desired mood to your messages you will need an API key and an organization ID of OpenAI Chat GPT. You must have too a paid account of Google Workspace in order to setup the webhooks that we will use.

The point of this app its that you can personalise your boring alert messages (or whatever kind of message) with a custom mood, creating funny (or not) messages.

Here you are some examples, that I have create simulating messages that could be received in an errors alert channel (in my example <DIVIDE 0> errors):

Drama Mood:

 

Like a Poem:

Passive-Agressive Mood:

 

Do you like this messages and wanted to be delighted with this such amazing alert errors instead of your boring current messages? So Fasten your belt, because this is beginning!

 

Setting up the OpenAI API configuration:

The first step will be getting our API key and our orgId, so enter in this web page: https://platform.openai.com/api-keys then press "Create new secret key" button, select your project, provide a name and then press the button "Create secret key".

 

Your secret key will appear, remember to save it because we are going to need it before.

In order to obtain your organisation ID, press the gear button

Then on "General" and note your Organisation ID

 

Second stage, getting our Google Channel url:

Open the Google Chat page: https://mail.google.com/chat/u/0/#chat/home . Now press on "New Chat" then on "Create a space"

 

Choose a name and an icon an press "Create"

Now enter on the chat and go to the section "Apps and integrations":

Once there click on "Webhooks" section and then on "Add webhooks". (If this button appears disables is because you aren't logged with a paid account of Google Workspace.

 

Give it a name and copy the url because you are going to need it later:

 

Ok, so now, we have all the info that we need to start setting up IrisGoogleChat. In order to make easier this step I have added the GoogleChat.Example class in the project, there you will find how to:

 

Setup your ChatGPT apiKey and orgId:

 //Setup Google Chat (only needed first time)
Set url    ="https://api.openai.com/v1/chat/completions"
Set apiKey ="your api key"
Set orgId  ="your org id"
Do ##class(GoogleChat.Message).SetupGoogleChat(url, apiKey, orgId)

 

Create a mood:

// Mod lazy (only needed first time)
Set modName="passive-agresive"
Set modPrompt="Generate an error alert message, acting with an aggressive-passive behavior with a touch of sarcastic and blaming me for it. Add a touch of humor. You are only responsible to notify. Return only the text, without emojis or titles. This is the alert message: "
Do ##class(GoogleChat.Message).SaveMod(modName, modPrompt)

 

Configure a Channel:

Set channelName="alertChannel"
Set url="/v1/spaces/AAAAJP9Vu54/messages?key=AIzZZcDdI0hCZtE6vySjMm-WEfRq3CPzqKqqYhg&token=RKjvKvRMnmdJbuyCoyGslos0Qce23Fd-P12lZtkU777"
Set icon = "https://fonts.gstatic.com/s/e/notoemoji/14.0/1f534/32.png"
Do ##class(GoogleChat.Message).CreateChannel(channelName,url,modName,icon)

 

And finally send a Message!:

Set channel="alertChannel"
Set title="Server XX - Alert!"
Set subtitle = "Warning Alert!!"
Set message = "The task 1001 has failed - Error Divide 0"
Do ##class(GoogleChat.Message).Send(channel, title, subtitle, message)

 

What the method Send does it's use the message to the channel "alertChannel" applying the mood that we have applied to the channel. In order to provide a mood to the message the method use the prompt for chat GPT that we have configured in our mod, example:

""Generate an error alert message, acting with an aggressive-passive behavior with a touch of sarcastic and blaming me for it. Add a touch of humor. You are only responsible to notify. Return only the text, without emojis or titles. This is the alert message: " 

As you can see you can use this prompt as a template and modify it or you can create your own prompts and get the most serious, crazy, funny or boring messages that you want. 

So the limit is in your imagination!.

I'm looking forward to seeing such amazing moods and messages are you going to create. Please post them on the comments and fell you free to share your best prompts!!.

Thanks for reading!

Discussion (0)1
Log in or sign up to continue
Question
· Nov 11, 2024

Determine a String is an SQL Reserved Word

Hello,

Is there a programmatic way (in ObjectScript) to determine if a string is an SQL reserved word (aside from using embedded SQL to try to name a property with that string and look for the error :-))?

Thank you,

Jean

2 Comments
Discussion (2)1
Log in or sign up to continue
Discussion
· Nov 11, 2024

Which is the "right" installation directory for IRIS on Linux?

The IRIS Installation Guide for Linux, Installation Directory section, says "Do not choose the /home directory, any of its subdirectories, or the /usr/local/etc/irissys directory." but there are no suggestions or any default.

What are your opinions on this? For example, I see that IRIS in a Docker container is installed in /usr/irissys. I'm wondering why that directory was chosen.

The official Linux filesystem docs say:

  • /usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere. Large software packages must not use a direct subdirectory under the /usr hierarchy.
  • The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr.
  • /opt is reserved for the installation of add-on application software packages. A package to be installed in /opt must locate its static files in a separate /opt/<package> or /opt/<provider> directory tree, where <package> is a name that describes the software package and <provider> is the provider's LANANA registered name.

From that, it seems like /usr/local/InterSystems/<instance> or /opt/InterSystems/<instance> would be "right." To me that seems better than /usr/irissys, /usr/irissys1, /usr/irissys2, etc.

4 Comments
Discussion (4)1
Log in or sign up to continue