40 lines
553 B
Markdown
40 lines
553 B
Markdown
|
|
||
|
### Configure
|
||
|
|
||
|
#### env.yml
|
||
|
|
||
|
```yaml
|
||
|
llm:
|
||
|
openai:
|
||
|
default:
|
||
|
apiKey: ...
|
||
|
aurze:
|
||
|
apiKey: ...
|
||
|
endpoint: ...
|
||
|
zhipu:
|
||
|
default:
|
||
|
apiKey: ...
|
||
|
```
|
||
|
|
||
|
#### encrypt apiKey
|
||
|
|
||
|
```shell
|
||
|
go install github.com/ssgo/tool/sskey@latest
|
||
|
sskey -e 'your apiKey' | grep 'url base64'
|
||
|
```
|
||
|
|
||
|
js code:
|
||
|
|
||
|
```javascript
|
||
|
import {zhipu, aurze} from 'llm'
|
||
|
import console from 'console'
|
||
|
|
||
|
function main(...args) {
|
||
|
let r = zhipu.fastAsk((args.length>0?args[0]:'你好', r => {
|
||
|
console.print(r)
|
||
|
})
|
||
|
console.println()
|
||
|
return r
|
||
|
}
|
||
|
```
|