# 概览

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/assistant-session/
Language: zh

创建()和获得()手背:您可以不断询问的对话框, 其配置随附 。

Status: 3 methods · 1 property · memory on by default

你从来不建建建,它来自 [api.models.create()](/zh/sdk/ref/models/create) 用于新对话,或 [api.models.get(id)](/zh/sdk/ref/models/get) 将恢复你所享受的享受。

## 表面表面 {#surface}

| 成员 | 功能 |
| --- | --- |
| ({投入,产出}) | 问,这是花掉的钱 |
| getHistory() | 阅读所说的话,但不增加。 |
| destroy() | 删除会议及其信息。 |
| 数据数据数据数据数据 | 配置, 以平面物体 的形式 。 |

```javascript
const assistant = await api.models.create({ model: "gemini-3.5-flash" });

assistant.id;         // keep this — it is all you need to come back
assistant.model;
assistant.settings;
assistant.schema;
assistant.memory;     // true unless you asked otherwise
assistant.title;      // named by the first message
assistant.createdAt;
assistant.updatedAt;
```

## 使用一个形状的形状 {#lifecycle}

```javascript
// Open, and remember which conversation this is
const assistant = await api.models.create({ model: "gemini-3.5-flash" });
await db.save({ userId, sessionId: assistant.id });

// Ask, as many times as the conversation needs
await assistant.generate({ inputs: [{ type: "text", content: "…" }] });

// Later, anywhere, any process
const again = await api.models.get(await db.load(userId));

// And when it is over
await again.destroy();
```

> **对象是一个控点, 不是对话框**
>
> 对话在服务器上。 同一身份的两个把手是相同的对话, 丢掉一个也没有丢失任何东西。

## 无法改变的东西 {#no-settings}

模式、设置和模式在会话创建时是固定的,没有办法改变它们——以不同的方式回答,再打开另一会,这是深思熟虑的:规则在中途改变的谈话是历史不再解释答案的谈话。

- [generate()](/zh/sdk/ref/assistant-session/generate): 问,什么回来, 和它的成本。
- [api.models.create()](/zh/sdk/ref/models/create): 届会行为决定的场合。

```python
assistant = api.models.create(model="gemini-3.5-flash")

assistant.id           # keep this — it is all you need to come back
assistant.model
assistant.settings
assistant.schema
assistant.memory       # True unless you asked otherwise
assistant.title        # named by the first message
assistant.created_at
assistant.updated_at
```

```python
# Open, and remember which conversation this is
assistant = api.models.create(model="gemini-3.5-flash")
db.save(user_id=user_id, session_id=assistant.id)

# Ask, as many times as the conversation needs
assistant.generate(inputs=[{"type": "text", "content": "…"}])

# Later, anywhere, any process
again = api.models.get(db.load(user_id))

# And when it is over
again.destroy()
```
