api = azure function (included chatgpt)

yo office 

 

 

taskpane.js

 

export async function run() {
  /**
   * Insert your Outlook code here
   *
   */
  let body = ''

  async function outputResult(body){
    console.log(body)
    let response = await runAzure(body)
    console.log(response.output)
  }
  async function getBody(){
    Office.context.mailbox.item.body.getAsync("text", function(result) {
      if (result.status == Office.AsyncResultStatus.Succeeded) {
        body = result.value
        outputResult(body)
      }
    })

  }

  async function runAzure(body) {
  const Url = 'your api site address';
  const otherParam = {
    body: '{"model":"text-davinci-003","prompt":"summarize the following in 50 words or less: ' + body.replace(/['"]+/g, '').trim().replace(/(\r\n|\n|\n)/gm, "") + '","max_tokens":200,"temperature":0}',
    method: 'POST'
  };
  const response = await fetch(Url,otherParam);
  var output = await response.text()
  return {output}

  }

  await getBody()
}
 
 
위 내용을 조금 다르게...  로그내용 출력
 
export async function run() {
  /**
   * Insert your Outlook code here
   *
   */
  let body = ''

  async function outputResult(body){
    console.log(body)
    let response = await runAzure(body)
    console.log(response.output)
  }
  async function getBody(){
    Office.context.mailbox.item.body.getAsync("text", function(result) {
      if (result.status == Office.AsyncResultStatus.Succeeded) {
        body = result.value
        outputResult(body)
      }
    })

  }

  async function runAzure(body) {
  const Url = 'your api address';
  const bodyjson = '{"model":"text-davinci-003","prompt":"summarize the following in 50 words or less: ' + body.replace(/['"]+/g, '').trim().replace(/(\r\n|\n|\n)/gm, "") + '","max_tokens":200,"temperature":0}'
  console.log(bodyjson)
  const otherParam = {
    body: bodyjson,
    method: 'POST'
  };
  const response = await fetch(Url,otherParam);
  var output = await response.text()
  return {output}

  }

  await getBody()
}

your api address = azure function [for chatgpt api : post]

 

메일 내용을 요약해서 보여줌

 

/*
 * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
 * See LICENSE in the project root for license information.
 */

/* global document, Office */

Office.onReady((info) => {
  if (info.host === Office.HostType.Outlook) {
    document.getElementById("sideload-msg").style.display = "none";
    document.getElementById("app-body").style.display = "flex";
    document.getElementById("run").onclick = run;
  }
});

export async function run() {
  /**
   * Insert your Outlook code here
   *
   */
  let body = ''

  async function outputResult(body){
    console.log(body)
    let response = await runAzure(body)
    console.log(response.output)
    document.getElementById('app-body').innerHTML = "<b>Summary: </b><br/>" + response.output
  }
  async function getBody(){
    Office.context.mailbox.item.body.getAsync("text", function(result) {
      if (result.status == Office.AsyncResultStatus.Succeeded) {
        body = result.value
        outputResult(body)
      }
    })

  }

  async function runAzure(body) {
  const Url = 'your ajpi site address';
  const bodyjson = '{"model":"text-davinci-003","prompt":"summarize the following in 50 words or less: ' + body.replace(/['"]+/g, '').trim().replace(/(\r\n|\n|\n)/gm, "") + '","max_tokens":200,"temperature":0}'
  console.log(bodyjson)
  const otherParam = {
    body: bodyjson,
    method: 'POST'
  };
  const response = await fetch(Url,otherParam);
  var output = await response.text()
  return {output}

  }

  await getBody()
}

 

Summarize This Email 선택시 기존에서는 콘솔(개발자모드)에서 내용이 보였으나 이젠 그냥 화면에 보임

 

 

Full+code+in+task_pane.js.txt
0.00MB
Fake+email.txt
0.00MB
CORS+policy.txt
0.00MB

 

회신기능

 

export async function run() {
  /**
   * Insert your Outlook code here
   */

  const item = Office.context.mailbox.item
  async function getBody(){
    Office.context.mailbox.item.body.getAsync("text",function(result){
      if (result.status == Office.AsyncResultStatus.Succeeded){
        let body =  result.value
       
        PutItAllTogether(body)
     
      }
    })
  }
async function RunAPI(body){
  const Url = 'https://~'
  const bodyJson ='{"model":"text-davinci-003","prompt":"Reply to the following email and  politely and professionally manner while saying no '+  body.replace(/['"]+/g, '').trim().replace(/(\r\n|\n|\r)/gm, "") +'","max_tokens":400,"temperature":0}'
  console.log(bodyJson)
  const otherParam = {
    body: bodyJson,
    method: 'POST'
  }
  const response = await fetch(Url, otherParam)
  var output = await response.text()

  return {output}

}

async function PutItAllTogether(body){

  console.log(body)
  let response = await RunAPI(body)
  console.log(response)
  item.displayReplyForm(response.output)
}

await getBody()
}

 

Generate Reply 클릭시 - 자동회신 양식을 띄우고 회신 내용을 자동으로 채워줌 

 

><> helm version WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/bacongobbler/.kube/config version.BuildInfo{Version:"v3.4.1", GitCommit:"c4e74854886b2efe3321e185578e6db9be0a6e29", GitTreeState:"clean", GoVersion:"go1.14.11"} ><> chmod o+r ~/.kube/config ><> helm version

WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/bacongobbler/.kube/config

WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/bacongobbler/.kube/config

 

 

 

chmod go-r ~/.kube/config

legato client agent설치시

libc.so.6 is needed by lgtoclnt-~
libc.so.6(GLIBC_2.0) is needed by
뭐 이런 에러(디펜선시)가 주저주저리
날땐

yum downgrade glibc glibc-common glibc-devel glibc-headers

yum install gcc

이렇게 하면 된다

아님 처음부터 yum install gcc를 해봐도 될듯

홈 디렉토리에서 그냥 .viminfo를 삭제하면 된다

sysetemctl staus나 그 관련 명령어 실행시 제목같은 에러가 날경우 daemon을 실행할때 cgroup을 찾지 못하거나 권한 문제로 이용할수 없게 되어 일어나는 문제라고 한다
도커는 완전 가사화가 아닌 격리의 개념이기 때문에 리눅스의 커널시스템을 어느정도 차용하게 된는데 거기에 있어서 특히 cgroup라는 놈은 리눅스 자원을 그룹단위로 할당하는 역할을 한다 centos컨테이너에서 systemd를 통해 실행하는 daemon이 해당 자원을 할당받지 못하여 생기를문제

해결책

cgroup을 사용할수 있게 설정된 centos이미지를 사용하면된다

FROM centos
ENV container docker

~~~
RUN yum -y install systemd; yum clean all; \
(cd /lib/systemd/system/sysinit.target.wants/; for in in *; do [ $i == systemd-tempfiles-setup.service] || rm -f $i;done); \


~
VOLUME [“/sys/fs/cgroup”]
CMD [“/usr/sbin/init”]


docker run —privileged —name centos-deo —itd -e container=docker -v /sys/fs/cgroup:/sys/fs/cgroup centos-7-image /usr/sbin/init

npm install -g gulp설치시
위같틍 에라가 나오면

npm config set strict-ssl false 하고 다시 해보자

npm config set strict-ssl true

Deployment create or apply -f 파일이름 실행시 아래와 같이 에러 메세지 출력 (참고 apiVersion: apps/v1)



[root@hadoopm KUBE]# kubectl apply -f deployment-definition.yml

Error from server (BadRequest): error when creating "deployment-definition.yml": Deployment in version "v1" cannot be handled as a Deployment: no kind "Deployment" is registered for version "apps/v1"



이럴때 우선 k8s 버젼확인

root@hadoopm KUBE]# kubectl  version

Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d


뭐 이렇게 하는게 맞는진 모르지만


암튼..


K8S가 1.9 밑에 버젼 1.8 이나 1.7 버젼이면 apiVersion: apps/v1beta1   <=요렇게 변경해준다 1.9이상이면 에러가 안나겠죵(apps/v1)


그럼 된다..


-----------------deployment-definition.yml ------------------------------

apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
labels:
app: myapp
type: front-end
spec:
template:
metadata:
name: myapp-pod
labels:
app: myapp
type: front-end
spec:
containers:
- name: nginx-container
image: dockertest2.io:12000/nginx:latest
replicas: 3
selector:
matchLabels:
type: front-end

[root@hadoopm KUBE]# kubectl get deployments

NAME               DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE

myapp-deployment   3         3         3            3           6m

nginx              1         1         1            1           5d


[root@hadoopm KUBE]# kubectl get replicaset

NAME                          DESIRED   CURRENT   READY     AGE

myapp-deployment-3571195553   3         3         3         6m

nginx-2496978322              1         1         1         5d


[root@hadoopm KUBE]# kubectl get pods

NAME                                READY     STATUS    RESTARTS   AGE

myapp-deployment-3571195553-27hgj   1/1       Running   0          7m

myapp-deployment-3571195553-7hzvr   1/1       Running   0          7m

myapp-deployment-3571195553-gw4xn   1/1       Running   0          7m



위치 :

/etc/systemd/system/kubelet.service.d/10-kubeadm.conf

 

root@nevido home]# more 10-kubeadm.conf
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
Environment="KUBELET_CGROUP_ARGS=--cgroup-driver=cgroupfs"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/sysconfig/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS $KUBELET_CGROUP_ARGS

 

systemctl daemon-reload
systemctl restart kubele

R>


> library(tensorflow)

> install_tensorflow()
실행시

 여러 에러가 나면서


Command /root/.virtualenvs/r-tensorflow/bin/python - setuptools pkg_resources pip wheel failed


요런 에러가 나면




pip install --upgrade virtualenv

sudo virtualenv .env   <= 요건 안해도 되던데...


R> 



> library(tensorflow)

> install_tensorflow()

아마도 정상 동작 할것임



해당 부분은 ip 등록 부분이 빠져서 생긴 문제임

 

sudo apt update
sudo apt install python3-pip
sudo pip3 install -vU setuptools
sudo pip3 install jupyter
jupyter notebook --ip=0.0.0.0 --port=8888 --allow-root

 

+ Recent posts