Skip to content

Commit

Permalink
ai 编程规范
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodert committed Jul 8, 2024
1 parent 1a82080 commit 3527375
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: LangChain
title: langchain
icon: lightbulb
index: false
author: Wang Shiyu
date: 2022-07-04
date: 2022-07-07
category:
- langchain
- ai
Expand All @@ -13,7 +14,8 @@ tag:



TODO




<Catalog />
25 changes: 25 additions & 0 deletions src/posts/ai/langchain/langchain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: LangChain
icon: lightbulb
author: Wang Shiyu
date: 2022-07-04
category:
- langchain
- ai
tag:
- langchain
- ai
---



TODO



参考:

- https://python.langchain.com/v0.2/docs/introduction/
- https://blog.csdn.net/qq_35812205/article/details/131709720


18 changes: 18 additions & 0 deletions src/posts/ai/lm_studio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: lm_studio
icon: lightbulb
index: false
author: Wang Shiyu
date: 2022-07-06
category:
- lm_studio
- ai
tag:
- lm_studio
- ai
---




<Catalog />
File renamed without changes.
60 changes: 0 additions & 60 deletions src/posts/ai/ollama.md

This file was deleted.

26 changes: 26 additions & 0 deletions src/posts/ai/ollama/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: ollama
icon: lightbulb
index: false
author: Wang Shiyu
date: 2022-07-08
category:
- ollama
- ai
tag:
- ollama
- ai
---


ollama 使用

参考:

- 支持模型列表: https://ollama.com/library
- ollama官网: https://ollama.com




<Catalog />
167 changes: 167 additions & 0 deletions src/posts/ai/ollama/ollama.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
---
title: ollama本地调用大模型
icon: lightbulb
author: Wang Shiyu
date: 2022-07-04
category:
- ollama
- ai
tag:
- ollama
- ai
- llama3
---




> 大语言模型,ollama轻松打造本地LLM应用
> 普通人如何快速搭建本地大语言模型

视频: [https://space.bilibili.com/404747369](https://space.bilibili.com/404747369)

官网: [https://ollama.com/](https://ollama.com/)[https://github.com/ollama/ollama](https://github.com/ollama/ollama)

**建议环境&配置**

大于 `4c8g`


# ollama

## 认识 ollama

Ollama 是一个开源大语言模型工具,帮助用户快速在本地搭建运行大模型。支持一系列著名的模型。如Llama2、Mistral、Gemma,极大的简化了安装和配置的细节。


## 搭建

根据不同操作系统,选择对应的安装包进行安装: https://ollama.com/download

### Linux 为例

一键安装

```bash
curl -fsSL https://ollama.com/install.sh | sh
```

加载 llama3 模型

```bash
ollama run llama3
```

查询模型安装是否成功

```bash
ollama list
```


## 测试

ollama 默认启动的端口是:11434

```bash
curl http://127.0.0.1:11434/

# Ollama is running
```


### 调用llama3试用

测试响应

```bash
curl http://localhost:11434/api/generate -d '{
"model": "llama3",
"prompt":"你知道 JavaPub 吗?"
}'
```

与模型对话

```bash
curl http://localhost:11434/api/chat -d '{
"model": "llama3",
"messages": [
{ "role": "user", "content": "你知道 JavaPub 吗?" }
]
}'
```



# webui

## 前言

首先安装 docker

## 搭建

推荐使用: [https://github.com/open-webui/open-webui](https://github.com/open-webui/open-webui)

ollama 我已经单独安装,现在只需要安装 webui。

```bash
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
```

默认端口是 3000,`http://127.0.0.1:3000`

![image-](https://javapub-common-oss.oss-cn-beijing.aliyuncs.com/javapub/202407081509663.png)

第一次进来没有账户,点击 Create 创建,第一个新创建的账户拥有管理员权限。

接下来登陆进来,就可以使用了。

![image](https://javapub-common-oss.oss-cn-beijing.aliyuncs.com/javapub/202407081511790.png)









TODO

[ ] 搭建 llama3 模型,并调用成功
[ ] 整合 go 语言,实现 api 调用
[ ] 流式回复


以 llama3 为例: https://ollama.com/library/llama3




参考:
- https://zhuanlan.zhihu.com/p/694843237
- https://blog.csdn.net/tirestay/article/details/139744309
- https://blog.csdn.net/qq_40999403/article/details/139320266
- 视频参考: https://www.bilibili.com/video/av1903594994/?vd_source=f2a0231e07e27f42fa11f05024479cb8
-



## 附录

- 支持模型列表: https://ollama.com/library
- 中文参考文档: https://ollama.fan/reference/api/#generate-a-completion-request-streaming
- webui: https://github.com/open-webui/open-webui




原文: [https://javapub.net.cn/posts/ai/](https://javapub.net.cn/posts/ai/)





6 changes: 6 additions & 0 deletions src/posts/programming_standard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
title: 编程规范
icon: lightbulb
index: false
author: Wang Shiyu
date: 2022-07-04
category:
- 编程规范
tag:
- 编程规范
---


Expand Down
14 changes: 14 additions & 0 deletions src/posts/programming_standard/clear_if_else.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: 优化if-else的八种方案
icon: lightbulb
author: Wang Shiyu
date: 2022-07-08
category:
- 编程规范
tag:
- 编程规范
---




8 changes: 8 additions & 0 deletions src/posts/programming_standard/interface_design_11.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
---
title: 接口设计这11点要注意
icon: lightbulb
author: Wang Shiyu
date: 2022-07-04
category:
- 编程规范
- 接口
tag:
- 编程规范
- 接口
---


Expand Down
8 changes: 8 additions & 0 deletions src/posts/programming_standard/log_11_suggest.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
---
title: 工作总结!日志打印的11条建议
icon: lightbulb
author: Wang Shiyu
date: 2022-07-04
category:
- 编程规范
- 日志
tag:
- 编程规范
- 日志
---

> 工作总结!日志打印的11条建议
Expand Down

0 comments on commit 3527375

Please sign in to comment.